URLs being generated in my dynamic sitemap are wrong

Discussion in 'PHP' started by Forty-Seven, Feb 3, 2008.

  1. #1
    Hi, wonder if someone could help me with this. My site has an article directory and it contains topics, and my sitemap contains links to those artciles topics. The problem is that the URLs being generated in the sitemap are wrong:

    For example the correct URL for artcile topic 5, the URL for the link should be:

    /articles.php?tPath=5

    But this is the link thats being generated in the sitemap:

    articles.php?topics_id=5

    i.e "topics_id=" instead of "tPath=". The code below is responsible (I think) for generating the link URLs to articles topics in sitemap.php. Can you see what needs to be changed in order for it to generate the correct URLS? (because I can;t:confused:):

    <?php
    //ARTICLE MANAGER START
    echo '<ul class="sitemap">';
    echo '<li><a href="' . tep_href_link(FILENAME_ARTICLES, '', 
    
    'NONSSL') . '">' . BOX_ALL_ARTICLES . '</a></li>' . ""; 
    $topics_query = tep_db_query("select t.topics_id, td.topics_name, t.parent_id from " . 
    
    TABLE_TOPICS . " t, " . TABLE_TOPICS_DESCRIPTION . " td where t.parent_id = '" . (int)
    
    $topic_links[$i] . "' and t.topics_id = td.topics_id and td.language_id = '" . (int)
    
    $languages_id . "' order by sort_order, td.topics_name");
    if (tep_db_num_rows($topics_query) > 0) {
    $row = 0;
    while ($topics = tep_db_fetch_array($topics_query)) {
    $row++;
    echo '<li><a href="' . tep_href_link(FILENAME_ARTICLES, 'topics_id=' . $topics
    
    ['topics_id']) . '">' . $topics['topics_name'] . '</a></li>' . "";
    }
    }
    echo '</ul>';
    //ARTICLE MANAGER END
    ?>
    Code (markup):
    Thanks, David.
     
    Forty-Seven, Feb 3, 2008 IP
  2. Barti1987

    Barti1987 Well-Known Member

    Messages:
    2,703
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    185
    #2
    
    <?php
    //ARTICLE MANAGER START
    echo '<ul class="sitemap">';
    echo '<li><a href="' . tep_href_link(FILENAME_ARTICLES, '', 
    
    'NONSSL') . '">' . BOX_ALL_ARTICLES . '</a></li>' . ""; 
    $topics_query = tep_db_query("select t.topics_id, td.topics_name, t.parent_id from " . 
    
    TABLE_TOPICS . " t, " . TABLE_TOPICS_DESCRIPTION . " td where t.parent_id = '" . (int)
    
    $topic_links[$i] . "' and t.topics_id = td.topics_id and td.language_id = '" . (int)
    
    $languages_id . "' order by sort_order, td.topics_name");
    if (tep_db_num_rows($topics_query) > 0) {
    $row = 0;
    while ($topics = tep_db_fetch_array($topics_query)) {
    $row++;
    echo '<li><a href="/' . tep_href_link(FILENAME_ARTICLES, 'tPath=' . $topics
    
    ['topics_id']) . '">' . $topics['topics_name'] . '</a></li>' . "";
    }
    }
    echo '</ul>';
    //ARTICLE MANAGER END
    ?>
    
    Code (markup):
    Peace,
     
    Barti1987, Feb 3, 2008 IP