Convert a list of cities into .html files

Discussion in 'Programming' started by Nigel Lew, Aug 5, 2009.

  1. #1
    Hi, I have a list of about 400 cities I need to convert into html or actually php files. Is there an app or a way to do this on the fly?

    thanks,
    Nigel
     
    Nigel Lew, Aug 5, 2009 IP
  2. codedeep

    codedeep Peon

    Messages:
    136
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You can do it manually with regular html layout with any design.... PM me for this service.
     
    codedeep, Aug 5, 2009 IP
  3. Nigel Lew

    Nigel Lew Notable Member

    Messages:
    4,642
    Likes Received:
    406
    Best Answers:
    21
    Trophy Points:
    295
    #3
    I don't require layout, I need to convert a list of cities in a txt document into separate blank html files. Pushing data to them on the fly is not a problem. I can use this http://www.ecobyte.com/replacetext/ for the latter.

    thanks though,
    Nigel
     
    Nigel Lew, Aug 5, 2009 IP
  4. ThePHPMaster

    ThePHPMaster Well-Known Member

    Messages:
    737
    Likes Received:
    52
    Best Answers:
    33
    Trophy Points:
    150
    #4
    Are you OK with using PHP Nigel?

    If the city list you have is newline delimited, I would do something like this:

    
    $fileName = 'citlist.txt';
    $content = file_get_contents($fileName);
    
    $tempLines = explode("\n",$content);
    
    $countLines = count($tempLines);
    
    for($x=0;$x<$countLines;$x++)
    {
        touch($countLines[$x].'.html');
    }
    
    PHP:
    This will simply create file names based on the city name: Brooklyn.html, Detroit.html, etc.. There are other efficient file read for newlines, I just used the above so you can tweet it around in the event you are using a different delimiter.
     
    ThePHPMaster, Aug 5, 2009 IP
    Nigel Lew likes this.
  5. Nigel Lew

    Nigel Lew Notable Member

    Messages:
    4,642
    Likes Received:
    406
    Best Answers:
    21
    Trophy Points:
    295
    #5
    Sweet dude, thanks alot!

    Nigel
     
    Nigel Lew, Aug 5, 2009 IP