Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Nov 2010
    Posts
    3
    Thanks
    2
    Thanked 0 Times in 0 Posts

    replacing text in html using a form or csv file

    ok i have a very simple html craigslist design that i've set variables in (i.e. $PRICE $PIC1).
    what would be really cool is to use a csv or spreadsheet to fill in these blanks and output multiple html files based on my template, however ill settle for an input manual the variables i want changed, then output a file. i know i could just open some text editor and do a simple find and replace, but this is a massive scale operation of 130 pages, without help would take weeks if not months to do.
    any help would be GREATLY appreciated.
    Last edited by adebusk; 11-09-2010 at 01:36 AM.

  • #2
    Senior Coder
    Join Date
    Sep 2010
    Posts
    1,929
    Thanks
    15
    Thanked 229 Times in 229 Posts
    What kind of OS does your computer have? If you have any of the 'nixes, Unix, BSD, Linux or Mackintosh ( Mac is really a BSD ) you have access to a powerful command line with efficient text editors which will allow you to automate page building just by writing and running scripts. Or you can automate it putting it on a server that has PHP. perl, ect.. Maybe someone can suggest some tools for automating it on a Windows machine. You could install a wamp server for instance.

  • Users who have thanked DrDOS for this post:

    adebusk (11-09-2010)

  • #3
    New to the CF scene
    Join Date
    Nov 2010
    Posts
    3
    Thanks
    2
    Thanked 0 Times in 0 Posts
    I run mac osx.

  • #4
    Senior Coder
    Join Date
    Sep 2010
    Posts
    1,929
    Thanks
    15
    Thanked 229 Times in 229 Posts
    Quote Originally Posted by adebusk View Post
    I run mac osx.
    Then you should have a built in Apache server, I don't know if it has PHP or not, and you also have the bash shell along with the sed Stream Editor, which you can use to automate all kinds of text processes. I've used the bash shell and sed to make as many as 1,400 web pages at a session, so you really have all the tools you need.

  • Users who have thanked DrDOS for this post:

    adebusk (11-09-2010)

  • #5
    New to the CF scene
    Join Date
    Nov 2010
    Posts
    3
    Thanks
    2
    Thanked 0 Times in 0 Posts
    how can i do it is what i need to know. i just need an output file that "fills in the blanks," that is replace the $... with input from (would be amazing if) an excel spreadsheet.

    [CODE]
    <table style="width: 800px;BORDER-RIGHT: #c0c0c0 1px solid; BORDER-TOP: #c0c0c0 1px solid; BORDER-LEFT: #c0c0c0 1px solid; BORDER-BOTTOM: #c0c0c0 1px solid" align="center" bgcolor="#FFFFFF">
    <tr>
    <td>
    <table style="width: 100%" cellpadding="1" cellspacing="1">
    <tr>
    <td colspan="2" align="center">
    <font face="Verdana" size="5"><b>$YEAR&nbsp;$MAKE&nbsp;$MODEL</b></font><br><font size="2" face="Arial">$$PRICE</font>
    </td>
    </tr>
    <tr>
    <td align="center" colspan="2" style="BORDER-RIGHT: #c0c0c0 1px solid; BORDER-TOP: #c0c0c0 1px solid; BORDER-LEFT: #c0c0c0 1px solid; BORDER-BOTTOM: #c0c0c0 1px solid">
    <font size="2" face="Arial">Auto Mart USA<br>(719) 338-8737<br>6755 N. Academy Blvd<br>&nbsp;Colorado Springs,
    &nbsp;CO&nbsp;80918</font>
    </td>
    </tr>
    <tr>
    <td colspan="2" align="center">
    <font size="2" face="Arial"><a target="_blank" href="http://www.autoboing.com/master_list.aspx?qsource_id=41&amp;qInst_ID=101863&amp;qlot_id=58138" rel="nofollow"><b>View Our Other Vehicles</b></a></font><br></td>
    </tr>
    <tr>
    <td valign="top" style="width: 378px">
    <table width="100%" border="0" style="font-family: Arial" cellpadding="1" cellspacing="1">
    <tr>
    <td align="right">
    <font size="2" face="Arial">Year:</font>
    </td>
    <td><b><font size="2" face="Arial">$YEAR</font></b></td>
    </tr>
    <tr>
    <td align="right">
    <font size="2" face="Arial">Make:</font>
    </td>
    <td><b><font size="2" face="Arial">$MAKE</font></b></td>
    </tr>
    <tr>
    <td align="right">
    <font size="2">Model:</font>
    </td>
    <td><b><font size="2" face="Arial">$MODEL</font></b></td>
    </tr>
    <tr>
    <td align="right">
    <font size="2" face="Arial">Mileage:</font>
    </td>
    <td><b><font size="2" face="Arial">$MILEAGE</font></b></td>
    </tr>
    <tr>
    <td align="right">
    <font size="2" face="Arial">Exterior Color:</font>
    </td>
    <td><b><font size="2" face="Arial">$EXTCOLOR</font></b></td>
    </tr>
    <tr>
    <td align="right">
    <font size="2" face="Arial">Interior Color:</font>
    </td>
    <td><b><font size="2" face="Arial">$INTCOLOR</font></b></td>
    </tr>
    <tr>
    <td align="right">
    <font size="2" face="Arial">Stock #:</font>
    </td>
    <td><b><font size="2" face="Arial">$STOCK</font></b></td>
    </tr>
    <tr>
    <td align="right"></td>
    <td></td>
    </tr>
    <tr>
    <td align="right">
    <font size="2" face="Arial">Price:</font>
    </td>
    <td><b><font size="2" face="Arial">$$PRICE</font></b></td>
    </tr>
    <tr>
    <td align="right"></td>
    <td></td>
    </tr>
    <tr>
    </td>
    </tr>
    <tr>
    <td align="right"></td>
    <td></td>
    </tr>
    <tr>
    <td align="center" colspan="2">
    <font size="2" face="Arial">$DESC All vehicles 10 years and newer come with a 3mo/3,000 mi limited warranty. Come see Colorado Springs newest independant dealer! Let us save you money! Come see us today!</font>
    </td>
    </tr>
    </table>
    </td>
    <td valign="top" align="center"><img style="height: 261px; width: 348px" src="$IMGSRC1"></td>
    </tr>
    <tr>
    <td><img style="height: 261px; width: 348px" src="$IMGSRC2"></td>
    <td><img style="height: 261px; width: 348px" src="$IMGSRC3"></td>
    </tr>
    <tr>
    <td><img style="height: 261px; width: 348px" src="$IMGSRC4"></td>
    <td><img style="height: 261px; width: 348px" src="$IMGSRC5"></td>
    </tr>
    <tr>
    </table>
    </td>
    </tr>
    </table>
    </td>
    </tr>
    </table>
    </td>
    </tr>
    </table>
    [CODE]

  • #6
    Senior Coder
    Join Date
    Aug 2010
    Location
    High Point, NC
    Posts
    3,335
    Thanks
    5
    Thanked 363 Times in 360 Posts
    Wouldnt this be easier using a database and a server-side script like php. Thats what they're intended for. To store and retrieve data. Seems like you're making this normally easy process way too complicated.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •