Linux Format forums Forum Index Linux Format forums
Help, discussion, magazine feedback and more
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Solved: HTML menu

 
Post new topic   Reply to topic    Linux Format forums Forum Index -> Programming
View previous topic :: View next topic  
Author Message
tedius



Joined: Fri Apr 08, 2005 4:20 pm
Posts: 83
Location: Cambridge, England

PostPosted: Mon Oct 24, 2005 11:57 am    Post subject: Solved: HTML menu Reply with quote

On my web site I have a persistent menu on every page. I use to hard code it into every page, but that got rather annoying very quickly, as any change means I have to change all my pages.

I then tried to add them menu to each page by embedding via the object tag i.e.
Code:
<object type="text/html" data="menu.html">
Menu failed to load.
</object>


This loads the menu find. I now have the same menu on every page and if anything changes I only have to update menu.html. But (and there is always a but) when I clink on one of the links it opens in the sub window and not the main window.

I have a test page to show what I mean, you can find it here.

Can anyone help me with this.

Edit:
PHP and server side include is the way to go! Very Happy


Last edited by tedius on Mon Oct 24, 2005 4:16 pm; edited 1 time in total
Back to top
View user's profile Send private message MSN Messenger
Lejon
LXF regular


Joined: Wed Oct 19, 2005 8:24 pm
Posts: 150
Location: Sweden

PostPosted: Mon Oct 24, 2005 1:28 pm    Post subject: RE: HTML menu Reply with quote

To get the page to open in that very window, just use the TAGET="_TOP"
option in the <A> Tag.. like <a href="http://www.linuxformat.co.uk" TARGET="_TOP">link</a>
But I suspect that you want the menue to presist.
Then I surgest PHP.
And if you dont have acces to that on the server I surgest you use Frames, or iFrames.
example: if you create an iframe: <iframe name="main" src="default.html" width=100% height=80% frameborder=0></iframe>
(80% hight so that your menu still appers on top.)
and then you suply TARGET="main", in the A tag.

However with this solution, you might as well just have the menu directly in the index page.
As that will be the "mother" to the site anyway.
(object would be overkill)
_________________
I am the one you thought I was! Just not the way, you expected...
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
tedius



Joined: Fri Apr 08, 2005 4:20 pm
Posts: 83
Location: Cambridge, England

PostPosted: Mon Oct 24, 2005 2:42 pm    Post subject: Reply with quote

Thanks Lejon, that was what I was looking for.

Saying that the menu was persistent was probably not the correct word to use. what I meant is that I have a file (menu.html) which is just a list of links and then I embed this file into each of pay pages using the object tag.

The PHP method does seem more elegant, do you know of a good website that can show me how to do things like this? I've never used PHP though I'm pretty good a picking new languages up.

Thanks
Back to top
View user's profile Send private message MSN Messenger
Lejon
LXF regular


Joined: Wed Oct 19, 2005 8:24 pm
Posts: 150
Location: Sweden

PostPosted: Mon Oct 24, 2005 3:04 pm    Post subject: Reply with quote

http://www.w3schools.com/php/
_________________
I am the one you thought I was! Just not the way, you expected...
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
tedius



Joined: Fri Apr 08, 2005 4:20 pm
Posts: 83
Location: Cambridge, England

PostPosted: Mon Oct 24, 2005 4:19 pm    Post subject: Reply with quote

Lejon wrote:
http://www.w3schools.com/php/


Thanks Lejon,

That is a much better way of doing it. PHP with server side include was the thing I was really after.

Now to try out some more fancy things, with dynamic menus Very Happy
Back to top
View user's profile Send private message MSN Messenger
Lejon
LXF regular


Joined: Wed Oct 19, 2005 8:24 pm
Posts: 150
Location: Sweden

PostPosted: Mon Oct 24, 2005 7:17 pm    Post subject: Reply with quote

tedius wrote:


Thanks Lejon,

That is a much better way of doing it. PHP with server side include was the thing I was really after.

Now to try out some more fancy things, with dynamic menus Very Happy


I wish you the best of luck Smile
_________________
I am the one you thought I was! Just not the way, you expected...
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
ollie
Moderator


Joined: Mon Jul 25, 2005 12:26 pm
Posts: 2749
Location: Bathurst NSW Australia

PostPosted: Tue Oct 25, 2005 9:03 am    Post subject: Reply with quote

I agree with Lejon that PHP is one of the better ways to dynamically generate menus - but frames are one of the abonimations that should be taken out of the W3C standard. Stick to standards compliant pages that load quickly and use CSS for style so your pages are accessible to everyone - especially with the growing use of non-computers to access the Internet.
Back to top
View user's profile Send private message
tenba



Joined: Sun Feb 26, 2006 2:55 am
Posts: 1

PostPosted: Sun Feb 26, 2006 3:12 am    Post subject: Re: RE: HTML menu Reply with quote

Lejon wrote:
To get the page to open in that very window, just use the TAGET="_TOP"
option in the <A> Tag.. like <a href="http://www.linuxformat.co.uk" TARGET="_TOP">link</a>
<a target="_top" ...> appears to work in Internet Explorer only if you include the embedded html file using an iframe. If you are using an object Firefox will do what you want (ie open the link using the entire window). I have not figured out how to get Explorer to do it yet (assuming it's even possible).
Back to top
View user's profile Send private message
View previous topic :: View next topic  
Display posts from previous:   
Post new topic   Reply to topic    Linux Format forums Forum Index -> Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Linux Format forums topic RSS feed 


Powered by phpBB © 2001, 2005 phpBB Group


Copyright 2011 Future Publishing, all rights reserved.


Web hosting by UKFast