Welcome to WebmasterWorld Guest from 54.146.194.42

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)

New User

5+ Year Member

joined:July 11, 2008
posts: 19
votes: 0


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 June 8, 2014 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Apr 15, 2003
posts:904
votes: 5


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 June 8, 2014 (gmt 0)

New User

5+ Year Member

joined:July 11, 2008
posts: 19
votes: 0


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 :)
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members