View Full Version : site map

08-22-2006, 03:18 PM
Hello. I'm trying to create a site map, only I don't want to update it every time when adding another section. My site map is similar to my navigation menu, so I want somehow when adding a section to navigation menu, automatically add it to site map. I have never seen how the site maps work, but I'm 99% sure that they are controlled automatically. So here's my code:


some JS
some CSS
and finally HTML, something like this:

<ul id="primary-nav">
<li><a href="http://www.123.lv/123.php?sc=aboutme">About me</a></li>
<li class="menuparent"><a href="#">My marks</a>
<li><a href="http://www.123.lv/123.php?sc=123">123</a></li>
<li><a href="http://www.123.lv/123.php?sc=456">456</a></li>
<li><a href="http://www.123.lv/123.php?sc=789">789</a></li>

and I want my site map like this. I want to remove id="primary-nav" (that's the only place where it is) and remove <a href="#">...</a> where class="menuparent".
and of course I need to get rid from JS and CSS when I put this code into Site map section

Can you help me? How can I achieve this? I suppose that I can do it with preg_replace maybe, but I don't know if it's the right way...

08-22-2006, 04:09 PM
You'd be better off in the long run by storing your navigation elements in a database or file and then creating both your menu and your sitemap from the data in your database.

08-22-2006, 04:37 PM
ok I did like this:

--- start of navigation_menu_file.php ---

<? include='js_css.php'; ?>

then the html code with li's , ul's etc

--- end of navigation_menu_file.php ---

and when I click on the link saying "Site map" on my site, it does this:

<? include='navigation_menu_file.php'; ?>

But I don't need to include js_css.php file again, only the html code. I thught that include_once could solve this problem, but it doesn't. Any ideas?