Jump to content


How to modify SiteMap snippet for 0.5.3?


  • You cannot reply to this topic
2 replies to this topic

#1 visa79

    Etomite Forum Newbie

  • Member
  • 23 posts

Posted 14 October 2004 - 01:50 PM

Hi,

I wonder if someone could or would help with the old SiteMap snippet for etomite 0.5.3...
First, I would like it to print the page description with the page title.
Second, I would like it to print the sitemap according to some css..how do I do this?

Thanks,
Visa79

Here is the code
$sql = "SELECT id,parent,pagetitle,alias FROM $dbase.".$table_prefix."site_content WHERE published = 1 AND deleted = 0 ORDER BY parent,id"; 
$rs = $db->Execute($sql); 
$limit = $rs->RecordCount(); 
for($i = 0; $i < $limit; $i++) 
  $resultarr[$i] = $rs->FetchRow(); 
$parentid = $resultarr[$i]['id']; 
//blank out return variable 
$SiteMap = ""; 
$depth = 1; 
$startSeed = 1; 

find_child($parentid, $startSeed, $depth, $resultarr, $limit); 


//function to print indentations 
//replace SiteMap = statement contents with whatever you want to use for indentation 
function depth($depth) { 
    global $SiteMap; 
    for ($i=1; $i<= $depth; ++$i) { 
        $SiteMap .="     "; 
    } 
} 

function step_up ($parentID, $startSeed, $depth, $result_array, $arr_size) { 
    global $SiteMap; 

    if ($startSeed > $arr_size) { 
        return; 
    } else { 
        if ($result_array[$startSeed-1]['parent'] == 
           $result_array[$startSeed]['parent']) { 
              $depth--; 
              return find_child($result_array[$startSeed-1]['parent'], 
                    $startSeed, $depth, $result_array, $arr_size); 
        } else { 
            if ($result_array[$startSeed-1]['parent'] == "" && 
                $result_array[$startSeed]['parent'] == 1) { 
                return; 
            } 
            for ($j = 0; $j <= $arr_size; ++$j) { 
                if ($result_array[$j]['id'] == 
                  $result_array[$startSeed-1]['parent']) { 
                    $depth--; 
                    return 
                    step_up($result_array[$j+1]['id'], $j+1, $depth, $result_array, $arr_size); 
                } 
            } 
            return; 
        } 
    
} 
} 


function find_child ($parentID, $startSeed, $depth, $result_array, $arr_size) { 
    global $SiteMap; 
    for ($k = $startSeed; $k <= $arr_size; ++$k) { 
        if ($result_array[$k]['parent'] == $parentID) { 
            depth($depth);    
if($result_array[$k]['alias'] !='') 
  $SiteMap .="<a href='" . $result_array[$k]['alias'] . ".html'>";  //change .html to whatever extension you use 
else 
  $SiteMap .="<a href='index.php?id=" . $result_array[$k]['id'] ."'>";          
$SiteMap .= $result_array[$k]['pagetitle'] . "</a><br>\n"; 
            $parentID = $result_array[$k]['id']; 
            $startSeed = ++$k; 
            $depth++; 
            return find_child($parentID, $startSeed, $depth, $result_array, $arr_size); 
            
        } elseif ($result_array[$k]['parent'] > $parentID) { 
            break;    
        } 
    } 

    step_up ($parentID, $startSeed, $depth,$result_array,$arr_size); 
}


#2 visa79

    Etomite Forum Newbie

  • Member
  • 23 posts

Posted 14 October 2004 - 03:41 PM

Does someone have the original code of the sitemap snippet for 0.5.3..
Same with some nice styles would be even better.

#3 breezer

    Likes Etomite Forums!

  • Member
  • PipPip
  • 308 posts

Posted 14 October 2004 - 11:22 PM

visa79,
the code you posted above matches what I have, so that is the original [7/25/04]. I never used it though, so I cannot offer any customization advice...... :(





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users