PDA

View Full Version : targetting a div??


peterward
06-02-2004, 12:16 PM
im making a page where the menu at the side and the banner at the top are in divs, and there is a 'main' div for the content. is it possible to make it so that when one of the menu links is clicked, the linked page will load in the main div? otherwise i have to include the menu and banner on every page, and since the menu is just written in html, it means i have to have all its code on every page.

any ideas?? :confused:

ronaldb66
06-02-2004, 12:31 PM
Not the div, but the object element can be used to include HTML from an external source. This would leave the user in the same page all the time though, which may severely limit the possibilities to give the user sufficient clues as to where he/she is in the site and where he/she can go next.

Alternatively, maintaining seperate pages, if you don't want to include the same header and menu in every separate page, these code fragments could be included using Server Side Includes (SSI) or some form of server side scripting. The same drawbacks as mentioned earlier may apply, though.

These techniques to reuse code fragments which are identical / similar across a larger number of pages usually only pay off when a site becomes quite large; if a Content Management System (CMS) is used, these techniques usually are included in the CMS anyway.

mindlessLemming
06-02-2004, 12:35 PM
If your host has support for a server-side language you can use 'includes' to add elements like menus and footers to each page.


The php version is:
<?php include 'menu.htm' ?>
and the ColdFusion version is:
<cfinclude template = "menu.htm">

I don't know about ASP though...

*edit:Beat me again! I've really go to start typing faster...First liorean did this to me, now Ronald's in on it too. :o