Welcome to WebmasterWorld Guest from 54.205.20.160

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

How to create new html pages automatically from csv file with PHP?

   
11:57 am on Jun 7, 2014 (gmt 0)

5+ Year Member



Hello,

I have created html template with placeholders look like this

<html>
<head>
<title>{productname} Home Page</title>
<style></style>
</head>
<body>
<img style="width: 100%; height: 100%" src='data:image/png;base64,{productlogo}'/>
<img style="width: 100%; height: 100%" src='data:image/png;base64,{productimage}'/>
<strong>{productname}</strong>
<del>
<font color=#FF0000>
{productoldprice}
</font>
</del>
<strong>{productprice}</strong>
<input type=hidden name=model id=model value='{model}'>
<p>{productdescription} </p>
</body>
</html>

my csv will look like this

productname , productlogo , productimage , productoldprice , productprice , model , productdescription
aaaaaaaaaaa , bbbbbbbbbbb , cccccccccccc , ddddddddddddddd , eeeeeeeeeeee , fffff , gggggggggggggggggg
aaaaaaaaaaa , bbbbbbbbbbb , cccccccccccc , ddddddddddddddd , eeeeeeeeeeee , fffff , gggggggggggggggggg


So i want to know how to use the template and read the csv file and create pages automatically like this

productname1.html
productname2.html
productname3.html etc..


thanks for your time
3:00 am on Jun 8, 2014 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



PHP has a few functions that will help you parse a CSV file. Check out fgetcsv() and str_getcsv(), for examples. That should get you going.
10:42 am on Jun 8, 2014 (gmt 0)

5+ Year Member



this reply is close that what i want except is with form
[webmasterworld.com...]

i will check the functions if you have simple example for me would be great :)
 

Featured Threads

Hot Threads This Week

Hot Threads This Month