1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

CMS/Script to render mySQL table to structured website

Discussion in 'Content Management' started by forcer, Jul 20, 2007.

  1. #1
    Guys,

    Really looking for an advice in what script / CMS to use on my newest project. Basically, I have a 2 mySQL tables - one list of countries (about 100) and second one list of cities (about 2500).

    I want to create a website using php with the following structure
    /australia - page about australia with one template
    /australia/sydney - page about sydney with different template
    /austria/vienna - etc..

    All the content is in database so could be rendered with some custom script but then I don't have any editing capabilities.

    I have tried exporting the data to Wordpress but quickly found out after 1000 pages the whole site became really slow.

    What other CMS/script would you recommend?

    Thank you.
     
    forcer, Jul 20, 2007 IP
  2. forcer

    forcer Peon

    Messages:
    151
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Cool. Haven't thought that its so easy to do in PHP.

    Here is my code:

    how simple is that :) (if someone wants to use it, beware of sql injection :)

    .htaccess file

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^([A-Za-z\-]*)$ /template.php?country=$1 [L]
    RewriteRule ^([A-Za-z\-]*)/([A-Za-z\-]*)$ /template.php?country=$1&city=$2 [L]
    </IfModule>


    template.php

    $city = $_GET['city'];
    $country = $_GET['country'];


    <?php
    $query = "SELECT id,name,aliasName FROM tbl_cities where countryAlias='".$country."'";
    $result = mysql_query($query) or die('Query failed: ' . mysql_error());

    while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
    echo '<a href="/'.$country.'/'.$line['aliasName'].'">'.$line['name'].'</a><br/>';
    }

    ?>

    <?php





    $query = "SELECT id,name,aliasName FROM tbl_countries";
    $result = mysql_query($query) or die('Query failed: ' . mysql_error());

    while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
    echo '<li><a href="/'.$line['aliasName'].'">'.$line['name'].'</a></li>';
    }
    mysql_free_result($result);
    ?>
     
    forcer, Jul 22, 2007 IP
  3. trichnosis

    trichnosis Prominent Member

    Messages:
    13,785
    Likes Received:
    333
    Best Answers:
    0
    Trophy Points:
    300
    #3
    i think you can create a web site with joomla. i saw data converter on official joomla extension site. you must try it
     
    trichnosis, Jul 22, 2007 IP