Back Forum Reply New

Will anyone help me create a website's navigation system?

I have been using html forever.  But I never really made projects larger than four pages.  Now, I am in charge of a 'real' site for the first time, and I am going mad at the simple site layout.  In the past, I put an identical menu in the body of every page.  For a real website, that is a bad habit, and bad to manage.  With that model, to add a page, I would need to add a link in every other page.  I need to make a menu that can be maintained independently from content pages (not a site map page, rather a navigation list on every page).
I will only use xhtml and css, no html 4.
I have tried using objects, and I think that is the best approach.  But I do not know how to target properly.  I mean, if I have a menu as an object, every link opens a page in that tiny menu object.  And, if I make a page with a menu, and the 'content' an object, I do not know how to tell that object to change directory.
Now, I know this can be done with a frameset document type (and I know how), but I would rather not get into that.
The page I am in charge of is here.  It horribly written (I mean, errors, not layout and ease of navigation, because those are good).  It has javascript popping menus, which I eventually would like to make myself.  The last person knew nothing of text markup, and made it entirely from Dreamweaver.  I rally can not tell much from the complex (and error-packed) menu script, but I think the menu is hard-coded on every page.
It has that header on top, which is why I do not want to use frameset.
So, essentially, I need to make a menu, which can be very basic for now.  In programming, I would make a menu class (and menu.paint (), etcetera), but how do I do this in markup?
Thank you, so much, for offering help.

I've used PHP for my site. If you don't know PHP , don't worry , neither do I .
I've just inserted couple of lines like this into my code:

(let's say hello.html) :

lt;htmlgt;
lt;headgt;
lt;/headgt;
lt;bodygt;

lt;? readfile(quot;up-frame.shtmlquot;); ?gt;
lt;? readfile(quot;left-frame.shtmlquot;); ?gt;      /* Site content goes here */

lt;/bodygt;
lt;/htmlgt;Note that quot;left-frame.shtmlquot; and quot;up-frame.shtmlquot; are NOT complete html files , i.e.  they should not have lt;htmlgt; or lt;bodygt;lt;/bodygt; tags.

When a web browser issues a request for hello.html  , web server will insert them directly into your current file. Something like Copy+Paste.

That means you won't see any results when playing with files at home. You have to copy them to web server first.

There are other methods to do it without web-server, some Java-script stuff, but who cares, this one works just fine and it looks elegant  .

Now , couple of notes:

On some servers , if you don't set extension to quot;.phpquot; , it won't work.
Also , on those servers,  you have to put included files ( like up-frame.shtml )  to have quot;.shtmlquot; extension.

Another  thing :
When writing something like:

lt;? readfile(quot;up-frame.shtmlquot;); ?gt;

pay attention to spaces. I.e :

lt; ?  [space]  readfile(quot;up-frame.htmlquot;   )  ?gt;    did not worked at my web server.
Replace [space] with one real space, This forum quot;eatsquot;  extra spaces in post.

That should do the job.
Cheers!

Hi, this is maybe not helping you very much directly, but in my opinion pure markup language like (X)HTML is not adequate for what you want to achieve. I would really suggest to make the effort and learn some script language suitable for web applications like PHP or Ruby (Ruby on Rails). It is really a pain to maintain a web site involving more than 10 pages via pure markup if the content is changing more or less on a regular basis.


Originally Posted by schallstromI would really suggest to make the effort and learn some script language suitable for web applications like PHP or Ruby (Ruby on Rails).

Or javascript, right?  Most menus use javascript, but I want the site to have basic accessibility.
Originally Posted by schallstromIt is really a pain to maintain a web site involving more than 10 pages via pure markup if the content is changing more or less on a regular basis.

But, this would work just fine using lt;framegt;s.  This is what I had in mind.
Code:
lt;!-- in index.html, where there is a slim menu on the left and a big content area on the right /--gt;
lt;frameset cols=quot;1, 4quot;gt;
lt;frame name=quot;menuframequot; src=quot;menu.htmlquot; /gt;
lt;frame name=quot;contentframequot; src=quot;startpage.htmlquot; /gt;
lt;/framesetgt;

lt;!-- in menu.html /--gt;
lt;a hrcf=quot;index.calender.htmlquot; target=quot;contentframequot;gt;a calenderlt;/agt;
lt;a hrcf=quot;startpage.htmlquot; target=quot;contentframequot;gt;back to startlt;/agt;
With the frame implementation, I can edit menu.html any time, to add or reorder links, that open the pages in a big content frame.  But frames take up the whole screen.
Now, instead, I have searched a lot for a way to use the 'target=quot;quot;' attribute on lt;objectgt; elements, but I found nothing.  I wish I could have a main page (probably just index.html) with a menu in it, that targets an lt;objectgt;.  Or, the opposite, with a bunch of unique pages, and a menu lt;objectgt; that can navigate the whole page, not just within the object itself.
If there is any way to do that, please tell me!  Or if there is a way to place lt;framegt;s with margins, not spanning the entire screen.  If there is no way, maybe I will try the PHP idea.


Originally Posted by dempl_demplThat means you won't see any results when playing with files at home. You have to copy them to web server first.
On some servers , if you don't set extension to quot;.phpquot; , it won't work.
Also , on those servers,  you have to put included files ( like up-frame.shtml )  to have quot;.shtmlquot; extension.

PHP is a magic word I sort of know about, but do not know.  Is it actual programing, like a host-side service?  I have no way to run server technologies, if that is what it is.  Just plain page delivery.  But if that is client side, like javascript, then maybe...  How do I position those, then?  Like this?
Code:
lt;!-- in index.html or index.php /--gt;
lt;headgt;lt;stylesheet is somewhere.cssgt;lt;/headgt;lt;bodygt;
lt;div id=quot;menufromphpquot;gt;lt;? readfile(quot;up-frame.shtmlquot;); ?gt;lt;/divgt;
lt;divgt;contentlt;/divgt;
lt;/bodygt;

lt;!-- in stylesheet.css /--gt;
div#menufromphp {
width: 200px;
left: 0px;
}
Is that right?  If there is no head inside the file read from php, are all styles inherited from the containing page?  Or is there some complete different way to handle this?
Thank you all for helping.

Frames are so 90's.  Sorry for being brash, but it's the truth.

You're best off with CSS and something like PHP.  I just learned enough PHP to get the side bar for my model airplane's club website up, so it reads in a text file of the html that I want printed in the link column.
Here is the code that renders the sidebar.  cmalinks is a style for the div tag.

Code:
lt;!-- LINK BAR --gt;
lt;div class=quot;cmalinksquot;gt;lt;font size=quot;2quot;gt;   lt;brgt;lt;!-- This puts a nice gap under the dashed border --gt;   lt;!-- THIS PHP CODE READS IN A TEXT FILE WITH THE LINK HTML FOR THE SIDEBAR SO CHANGES --gt;   lt;!-- CAN BE MADE TO A SINGLE FILE AND WILL FITLER TO ALL THE PAGES --gt;   lt;?php       // Get a file into an array.         $lines = file(quot;./sidelinks.txtquot;);       // Loop through our array and dump out the HTML code it contains       foreach ($lines as $line_num =gt; $line) {echo $line;       }   ?gt;
lt;/divgt;
Here is what is contained in sidelinks.txt:

Code:   lt;!-- Main Items --gt;   amp;amp;raquo; lt;a class=quot;sidebarquot; hrcf=quot;./index.phpquot;gt;Homelt;/agt;lt;brgt;   amp;amp;raquo; lt;a class=quot;sidebarquot; hrcf=quot;./about.phpquot;gt;About CMAlt;/agt;lt;brgt;   amp;amp;raquo; lt;a class=quot;sidebarquot; hrcf=quot;./officers.phpquot;gt;Club Officerslt;/agt;lt;brgt;   amp;amp;raquo; lt;a class=quot;sidebarquot; hrcf=quot;quot;gt;Bylawslt;/agt;lt;brgt;   amp;amp;raquo; lt;a class=quot;sidebarquot; hrcf=quot;quot;gt;Calendarlt;/agt;lt;brgt;   amp;amp;raquo; lt;a class=quot;sidebarquot; hrcf=quot;./beginner.phpquot;gt;For Beginnerslt;/agt;lt;brgt;   amp;amp;raquo; lt;a class=quot;sidebarquot; hrcf=quot;./field.phpquot;gt;Flying Fieldlt;/agt;lt;brgt;   lt;!-- Sub Item --gt;   amp;amp;amp;amp;- lt;a class=quot;sidebarquot; hrcf=quot;./fieldrules.phpquot;gt;Field Ruleslt;/agt;lt;brgt;   amp;amp;amp;amp;- lt;a class=quot;sidebarquot; hrcf=quot;./student.phpquot;gt;Student Manuallt;/agt;lt;brgt;   amp;amp;raquo; Joininglt;brgt;       amp;amp;amp;amp;- lt;a class=quot;sidebarquot; hrcf=quot;./joincma.phpquot;gt;lt;bgt;Join CMAlt;/bgt;lt;/agt;lt;brgt;   amp;amp;amp;amp;- lt;a class=quot;sidebarquot; hrcf=quot; from : localhost/AMAlt;/agt;lt;brgt;   amp;amp;raquo; lt;a class=quot;sidebarquot; hrcf=quot;quot;gt;Flightline Archiveslt;/agt;lt;brgt;   amp;amp;raquo; lt;a class=quot;sidebarquot; hrcf=quot;quot;gthoto Gallerylt;/agt;lt;brgt;   amp;amp;raquo; lt;a class=quot;sidebarquot; hrcf=quot;quot;gt;R/C Linkslt;/agt;lt;brgt;


SoloSalsa: You don write entire page in PHP, you use  the HTML code, and for inclusion of l menu, you use
code I posted .  If you have not understand my post, read it again. I not so good in explaining things, indeed  , but do your best to understand me.

To recap:

lt;htmlgt;
your code
your code
your code
your code
....
//include menu file
lt;? readfile(¨menu.shtml¨) ?gt;  //  lt;----------- that all PHP there is to it ...
your code
your code
etc...
lt;/htmlgt;

Thank you, xtacocorex and dempl_dempl.  That does not look hard.  See, I never really knew what PHP was.  I thought it was something like SQL, something ran by the host, which I have no access to.  But, now I see that it is run by the client, just like javascript.  I never even considered it because I did not know about it.  But now it looks promising.
One question: how big is it on compatibility?  I know browsers toggle javascript (like me, I keep it disabled for unknown sites), but do people ever disable PHP?

PHP has to be enabled on the server for it to work, so as long as the server supports it, it'll work.

I also don't know much about PHP.  The code I showed you I learned in about 5 minutes to do pretty much what schallstrom said about ease of maintaining a site.

Glad I could help out.


Originally Posted by SoloSalsaThank you, xtacocorex and dempl_dempl.  That does not look hard.  See, I never really knew what PHP was.  I thought it was something like SQL, something ran by the host, which I have no access to.  But, now I see that it is run by the client, just like javascript.  I never even considered it because I did not know about it.  But now it looks promising.
One question: how big is it on compatibility?  I know browsers toggle javascript (like me, I keep it disabled for unknown sites), but do people ever disable PHP?

PHP is running on the server. So you need access to a web server which supports PHP processing. But almost every hosting company does include PHP support even in the cheapest offers today. If your hosting company does not support PHP, move away from them, they are bad.

PHP is a recursive acronym for PHP: Hypertext Preprocessor. And a Preprocessor it is, meaning there is some PHP code on the server side which gets processed by a PHP interpreter on the server. The result of this (pre)processing is (X)HTML code which then gets transferred to the client the request came from. So, no, PHP is not at all like JavaScript. The client will never see any of the PHP code. And yes, PHP is a real programming language.

There are alternatives to PHP which work basically the same way I described above: I already mentioned Ruby (and the Ruby on Rails framework) which is pretty fashionable these days. Or you could use Python which is a much nicer language then PHP. But PHP is the most common one and most supported by hosting companies, so to start you probably would be best off with PHP if you don't want to run your own server.

I suggest getting a O'Reilly book on PHP and read a bit and play a bit...
¥
Back Forum Reply New