Jump to content
xisto Community
Sign in to follow this  
KunstSammler

Best Way To Design A Nav System?

Recommended Posts

I hear that frames are bad, iframes are better but bad as well, you can't "target" a link to a div element, so what would you use to open pages from a div element nav.bar to a window on the same page? I'm running apache, mysql, and php so the tools to do it are there I just need to know what I should use. Any input is appreciated.

Share this post


Link to post
Share on other sites

well... there are multiple ways to do this. You could use AJAX to dynamically load pages into a "DIV" element. That way the whole page won't have to refresh, it will just update whatever parts you want it to update (whatever is in the DIV).

Share this post


Link to post
Share on other sites

As said AJAX and Js would do that for you but if you know php then you can use a url with a GET variable and change DIV content using another variable in the HTML part of the page in a method like this:

PHP$page1 = "<B> hello this is page one </B>;$page2 = "<B> hello this is page two </B>;$page = $_GET['page'];if($page == "1"){	$content = $page1;} ELSE {	$content = $page2;}HTML<div>$content</div>


the advantage is its really easy to add links, when i used a similar method i used a CASE statement to see what page the user requested by clicking a link with a GET var in the url, then i added a file extension to it and loaded the relevant file from the server and loaded it using an INCLUDE. And as fr the links i used another external file where the links were written in HTML as a vertical nav-bar and then loaded via another INCLUDE, so to add links ll i had to do was edit that one file and the php would automatically check to see if the corresponding HTML file existed and loaded it.

I hope that makes sense, i found this the easiest way to dynamically change page content, but if you prefer to write in JS then AJAX and JS might be easier, it all depends on what language you prefer.

I wouldnt have any worried using frames though, the only thing is there are a few browsers, very very ld ones, that arent frame-friendly, not very many users though i dont think, also, unless controlled by CSS frames can look a big ugly!

Share this post


Link to post
Share on other sites

this is actually a perfect example of how I would want my page to respond. And the content doesn't necessarily have to load in a div it can load in whatever it wants as long as i can control where exactly the content is on the page.

Wordpress

I looked into the PHP includes route and it seems like it fits the best but i'm having trouble figuring out how to direct the pages to where i want them to open. I'm not that great with php but i'm thinking php would have a more sophisticated method of directing pages as opposed to the "target" command when making links.

Edited by KunstSammler (see edit history)

Share this post


Link to post
Share on other sites

Well you can do something as i said before with storing the page content as a variable and calling it or you can use the FREAD function to open a HTML file, read the contents into a variable and then ECHO that variable out eg:


//get the extension of the file, its easier in a variable!$htm = ".htm";//get the filename by adding a variable from the url to the extension variable to get pagename.htm$file = "$module$htm";//make a new variable with the filename above to use with FREAD$filename = $file;//open the htm file to get its contents$handle = fopen($filename, "rb");//read these contents into a variable$content = fread($handle, filesize($filename));//close the file againfclose($handle);[/quote]//now you use an IF statement to see if the CONTENT variable is empty, if it is NULL or empty then you can ECHO an error message. If it isnt empty then now you can use something like...:echo "<DIV>$content</div>";//that will ECHO the content of the file we got above into the DIV

Its a little confusing i guess but it does work! You mentioned that word press is what you want, have you thought abut using a pre-made content management system, AKA CMS ?

Share this post


Link to post
Share on other sites

I hear that frames are bad, iframes are better but bad as well, you can't "target" a link to a div element, so what would you use to open pages from a div element nav.bar to a window on the same page? I'm running apache, mysql, and php so the tools to do it are there I just need to know what I should use. Any input is appreciated.


I guess I don't quite understand what the trouble is with "target" a link to a div element. I think you should be able to get along with CSS and Divs but maybe you are trying to do something I just don't understand. I am a big fan of no tables and whatever I need to do I figure out how to do it using CSS and DIVs. Some neat tricks with mouse over effects that work with JavaScript turned off. I like having the freedom to modify the style for color and such right in the CSS file without having to touch the HTML. You can certainly make a DIV scroll and change the way overflow is handled and the DOM applies when you need to make classes and nested DIVs etc. lots of control but some advanced options in CSS take a bit of searching and studying to master. In the end perhaps it's time to learn some PHP and create separate files for your navbar and header/body and you can use includes and have the includes pull whatever code you want into the target DIV. This will be better for search engine placement and ease of modifying your navbar by making a change in one file only no matter how many pages are in your site. This reason alone is good enough to want to use includes or templates if you use dreamweaver.

jamers

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.