Jump to content

Recommended Posts

Posted

Let me describe my dilemma. I have a java script drop down menu on each of my pages in my site. I was loking for a way to make one menu and have if displayed on each page so that all I have to do is change one page and all will follow suite. A friend suggested an frame, which works great except that when some on follows a link in the drop down menu it opens in the iframe. So I need either a way to target the main window or another method to save on my administrative time

Posted (edited)

Link targets

 

_blank loads the page into a new browser window.

 

_self loads the page into the current window.

 

_parent loads the page into the frame that is superior to the frame the hyperlink is in.

 

_top cancels all frames, and loads in full browser window.

 

Example: " target="_blank" (would be correct i think, anyone correct me if not :D )

Edited by Jikrantz
Posted

Another way is to include the menu on each page,

so you just change the menu in one place.

This could be using php to include the menu

or javascript src="menu.txt" with menu.txt

html wrapped in Document Writes

 

the php includes are easier

and if you do not want to use the php extention,

you can add

AddHandler application/x-httpd-php .htm .html .shtml

to your .htaccess file to use php in an html page.

And then in your page just insert

<?php include('menu.php'); ?>

where you want the menu.

Thats the basic idea.

Posted

Thank you but I am still a little confuse, ok a lot confused. I know nothing about PHP and what little I know of javascript has faded in the past few years here is the menu text , I think I have an idea of what you mean but this might help you help me,( probably not good english). Thanks

 

<script language="JavaScript">

<!--

function go(){

if (document.selecter.select1.options[document.selecter.select1.selectedIndex].value != "none") {

location = document.selecter.select1.options[document.selecter.select1.selectedIndex].value

}

}

//-->

</script>

 

<script language="JavaScript">

<!--

document.write('<form name="selecter"><select name="select1" size=1>');

document.write('<option value=none>Select your destination...');

document.write('<option value=none>--------------------');

document.write('<option value="index.htm">Home');

document.write('<option value="st_michael__menu.htm" >Site Menu');

document.write('<option value="church_contacts.htm">Contact Information');

document.write('<option value="directions.htm">Directions and schedules');

document.write('<option value="clergy.htm">Our Clergy');

document.write('<option value="Hierarchs.htm">Our Hierarchs');

 

document.write('</select>');

document.write('<INPUT TYPE="button" VALUE="Go" onclick="go()">');

document.write('</form>');

//-->

</script>

Posted

Ok if you can add the line

AddHandler application/x-httpd-php .htm .html .shtml

to your .htaccess file

by using cpanels file manager to edit it and insert the line anywhere

or however you like to edit a file on your site.

 

Then save that menu on your site as menu.php

 

and replace the java script menu in your html pages with

<?php include('menu.php'); ?>

and then all you have to do in the future to add a new page is edite the menu and upload it.

 

 

if you need help with file manager let me know.

Posted

Thank you so much, thank you, thank you, and again thank you.

 

You do not know how bad this was bugging me.

 

I will have to search out the site here so I can write to the upper management so I can tell them how much help all of you are and what a great decision it was to host with TCH.

Posted

You are welcome :rolleyes:

I hope that means you have the menu includes

working.

 

 

If so you can now insert snippets of php code just like you do for java script.

Such as inserting

copyright© <?php echo date("Y") ?>

to display copyright© 2004

and the year will always be updated.

Posted

This question is slightly off topic, but...

Such as inserting

copyright© <?php echo date("Y") ?>

to display copyright© 2004

and the year will always be updated.

This do write the year 2004 i figured out, but what if my stuff is older than 2004.

I mean sometimes we produce things earlier than we publish it.

In my case i have stuff that are published on a site but written 1996 and i want people to know that some stuff was copyrighted already then.

 

How would i write that php snippet then?

Posted

If you want to enter a static year just enter it like this, no PHP needed.

 

copyright© 1996

 

If it was from 1996 to current year then use this:

 

copyright© 1996-<?php echo date("Y") ?>

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...