Forum Moderators: open

Message Too Old, No Replies

using array for navigation

         

fitzle

12:20 am on Jan 3, 2007 (gmt 0)

10+ Year Member



The basic template for my site:

<table id="main">
<tr>
<td id="top"><cfinclude template="top.cfm"></td>
</tr>
<tr>
<td id="menu"><cfinclude template="menu.cfm"></td>
<td id="content"><cfinclude template="main.cfm"></td>
</tr>
</table>

"top" is a logo and does not change
"menu" is a navigation menu and does not change
"content" are all static html pages and displayed via links in "menu"

I would like to structure the site so only the element "content" is loaded when the user clicks a link from "menu" so "top" and "menu" do not get reloaded. From what I understand, I need to set up an array of html pages and use onClick to call a function that loads "content" but I have no idea how to do this.

Please advise.

physics

8:24 pm on Jan 3, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I don't think this is the best way to go about what you want [however it can be done using AJAX]. For one thing the pages won't get indexed because Googlebot and other bots won't click your JavaScript menu links and thus will never see and index the content. This would be better accomplished using your server side language (ColdFusion in your case). So you want to show the menu links they are taken to yourpagename.cfm?content=3 ... then the page is pulled and the HTML is displayed to the bot/users. You could still use JavaScript menus to and AJAX accomplish the same thing but you should also have plain text menu links along the bottom so the bots can crawl your site.
If you really do want to use AJAX for this you'll need to get caught up on the basics of AJAX first and then jump into using it to pull and display the files. Start with:
Rasmus' 30 Second AJAX Tutorial [news.php.net] - This concept will work with any server-side language, not just PHP. You would just replace the backend PHP code with a ColdFusion script.