homepage Welcome to WebmasterWorld Guest from 54.145.183.169
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

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

5+ Year Member



 
Msg#: 4678155 posted 11:57 am on Jun 7, 2014 (gmt 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

 

rainborick

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 4678155 posted 3:00 am on Jun 8, 2014 (gmt 0)

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.

maxweels

5+ Year Member



 
Msg#: 4678155 posted 10:42 am on Jun 8, 2014 (gmt 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 :)

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved