Vertical Menu ( Smarty & Php )

Discussion in 'Programming' started by newzone, Feb 23, 2009.

  1. #1
    I have a problem with one of my directories, i want a vertical menu and i have it using this code :


    {php}
    $result = mysql_query("SELECT * FROM `categories` ORDER BY `title` ASC");
    echo mysql_error();
    while($row = mysql_fetch_array($result)){
       ?>
       <li><a href="<?=$row['path']?>/"><?=$row['title']?></a></li>
       <?
       }
    {/php} 
    Code (markup):
    The problem i have is the path, the path is incorrect when i browse one of the categories, example when i browse /category 1 and click "Category 2" i'm redirected to : category1/category2/ instead of /category2

    Can anyone tell me how to modify or to make a change to this code to work ?

    I received a sugestion to use a function like this : http://www.php.net/manual/en/function.strrpos.php#71882
    but i don't know what and how to modify it.
     
    newzone, Feb 23, 2009 IP