Results 1 to 6 of 6

Thread: Call php or java?

  1. #1
    Join Date
    Jan 2008
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Call php or java?

    1) Script Title: AnyLink Vertical Menu

    2) Script URL (on DD): http://dynamicdrive.com/dynamicindex...nkvertical.htm

    3) Describe problem:
    I have searched and found an assortment of posts that do not seem to be the answer to my problem. I want to have a "master template" of my menu that I can call to all pages on my site. It seems that I should create a php file and call this to each page, the problem is I cannot understand how to achieve this as there seems to be 3 parts involved.

    The CSS style (No problem, I understand this)

    The Javascript part (where do I save this to?)
    Code:
    <script type="text/javascript">
    
    /***********************************************
    * AnyLink Vertical Menu- © Dynamic Drive (www.dynamicdrive.com)
    * This notice MUST stay intact for legal use
    * Visit http://www.dynamicdrive.com/ for full source code
    ***********************************************/
    
    //Contents for menu 1
    var menu1=new Array()
    menu1[0]='<a href="#">Quick Links<span style="position: relative; left: 74px"></span></a>'
    menu1[1]='<a href="http://www.benal-life.com/XMLAttraction/arroyomap.htm">Benalmadena Maps</a>'
    menu1[2]='<a href="http://www.benal-life.com/travel/travel.htm">Travel Shop</a>'
    menu1[3]='<a href="http://www.benal-life.com/information/info.htm">Things Useful</a>'
    menu1[4]='<a href="http://www.benal-life.com/travel/travel.htm">Local Travel Help</a>'
    menu1[5]='<a href="http://www.benal-life.com/hotels.htm" class="navlist">Hotels and Hostels</a>'
    
    //Contents for menu 2, and so on
    var menu2=new Array()
    menu2[0]='<a href="http://www.benal-life.com/bars/bars.htm" title="Featured Bars in Benalmadena">Benalmadena Bars</a>'
    menu2[1]='<a href="http://www.benal-life.com/restaurants/restaurants.htm" title="Featured Restaurants">Local Restaurants</a>'
    menu2[2]='<a href="http://www.benal-life.com/businesses/business.htm" title="Featured Businesses">Local Business</a>'
    menu2[4]='<a href="http://www.benal-life.com/weather_records/weather.htm" title="The Current and the forecast weather for Benalmadena">Weather Records</a>'
    menu2[3]='<a href="http://www.benal-life.com/latest_updates.htm" title="The most recent of our pages to have major updates">Latest Updates</a>'
    menu2[4]='<a href="http://www.benal-life.com/daysout/daysout.htm" title="Recommended days out with routes, pictures & maps">DIY Excursions</a>'
    menu2[5]='<a href="http://www.benal-life.com/golf.htm" title="Golf and the golf courses of the Costa del Sol">Golf</a>'
    menu2[6]='<a href="http://www.benal-life.com/fiestas/fiestas.htm" title="Things you might like to know about the many public holidays in spain">Parades & Fiestas</a>'
    menu2[7]='<a href="http://www.benal-life.com/artistes/artistes.htm" title="A Free to join directory of Artistes and Entertainers on the Costa del Sol">Performers Directory</a>'
    menu2[8]='<a href="http://www.benal-life.com/dementia/opener.htm" title="Do you think that you are safe from dementia?">An amusing test</a>'
    
    
    //Contents for menu 3, and so on
    and finally the navlist script which I presume is the part that I create the php file from

    Code:
    <ul class="navlist">
    
    	<li><a href="http://www.benal-life.com">Home Page</a></li>
    	<li onMouseover="dropdownmenu(this, event, menu2, '150px')" onMouseout="delayhidemenu()"><a href="#">Quick Links<span style="position: relative; left: 70px">&raquo;&raquo;</span></a></li>
    	<li><a href="http://www.benal-life.com/XMLAttraction/arroyomap.htm">Benalmadena Maps</a></li>
    	<li onMouseover="dropdownmenu(this, event, menu3, '150px')" onMouseout="delayhidemenu()"><a href="http://www.benal-life.com/travel/travel.htm" title="Travel deals from some of the best high street names">Travel Shop<span style="position: relative; left: 68px">&raquo;&raquo;</span></a></li>
    	<li onMouseover="dropdownmenu(this, event, menu4, '150px')" onMouseout="delayhidemenu()"><a href="http://www.benal-life.com/information/info.htm" title="A selection of informative things you need to know about Spain and the Costa">The Useful Index<span style="position: relative; left: 42px">&raquo;&raquo;</span></a></li>
    	<li onMouseover="dropdownmenu(this, event, menu5, '150px')" onMouseout="delayhidemenu()"><a href="http://www.benal-life.com/hotels.htm" title="Book your Hotel at the cheapest price available">Hotels & Hostels <span style="position: relative; left: 41px">&raquo;&raquo;</span></a></li>
    	<li><a href="http://www.benal-life.com/cpg1413/index.php" title="Members gallery where you show the world your photographs of Benalmadena">Picture Gallery</a></li>
    	<li><a href="http://www.benal-life.com/chat/" title="THE BEST place to chat about Benalmadena and Arroyo de la Miel">Benalmadena Forum</a></li>
    	<li><a href="http://www.benal-life.com/theme.htm" title="The sun has got his hat on and he's coming out to play">Cheer up with our song</a></li>
    	<li onMouseover="dropdownmenu(this, event, menu6, '150px')" onMouseout="delayhidemenu()"><a href=""#"" title="If you are travelling you might like to check out these sites">Travel Essentials<span style="position: relative; left: 40px">&raquo;&raquo;</span></a></li>
    	<li onMouseover="dropdownmenu(this, event, menu7, '150px')" onMouseout="delayhidemenu()"><a href="http://www.benal-life.com/shopping/travel/linktravelpackages.htm" title="The BEST of the package holiday companies operating in the UK">Package Holidays <span style="position: relative; left: 31px">&raquo;&raquo;</span></a></li>
    
    </ul>
    Even if my presumptions are correct I am still unsure of what to do with the javascript part of the code - help please

  2. #2
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Well, for the JavaScript portion, you can just save the entire contents (minus the surrounding <script> tags) into an external .js file, then reference that file on your page:

    Code:
    <script src="displaydate.js" type="text/javascript">
    </script>
    Here's a more detailed tutorial on the process.

    Regarding the HTML, it really depends on the type of your pages. For example, if they're .html (SSI), you'd use the includes ability of SSI to do your work.

  3. #3
    Join Date
    Jan 2008
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thank you very much that is just what I needed

  4. #4
    Join Date
    Jan 2008
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    All seemed well until I uploaded the page and scripts, although everything is fine when run locally the page is appearing blank when run from my server.

    here is the code and url for the page
    http://www.benal-life.com/java_nav/java_nav_good.htm

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>Untitled Document</title>
    
    <link href="/java_nav/vertical.css" rel="stylesheet" type="text/css">
    
    <script src="/java_nav/vertical.js" type="text/javascript"></script>
    
    
    <script type="text/javascript">
    /***********************************************
    * AnyLink Vertical Menu- © Dynamic Drive (www.dynamicdrive.com)
    * This notice MUST stay intact for legal use
    * Visit http://www.dynamicdrive.com/ for full source code
    ***********************************************/
    </script>
    </head>
    <body>
    <!--#include virtual="/java_nav/menu.htm"-->
    </body>
    </html>
    The menu (menu.htm)
    Code:
    <ul class="navlist">
    	<li><a href="http://www.benal-life.com">Home Page</a></li>
    	<li onMouseover="dropdownmenu(this, event, menu2, '150px')" onMouseout="delayhidemenu()"><a href="#">Quick Links<span style="position: relative; left: 68px">&raquo;&raquo;</span></a></li>
    	<li><a href="http://www.benal-life.com/XMLAttraction/arroyomap.htm">Benalmadena Maps</a></li>
    	<li onMouseover="dropdownmenu(this, event, menu3, '150px')" onMouseout="delayhidemenu()"><a href="http://www.benal-life.com/travel/travel.htm" title="Travel deals from some of the best high street names">Travel Shop<span style="position: relative; left: 68px">&raquo;&raquo;</span></a></li>
    	<li onMouseover="dropdownmenu(this, event, menu4, '150px')" onMouseout="delayhidemenu()"><a href="http://www.benal-life.com/information/info.htm" title="A selection of informative things you need to know about Spain and the Costa">The Useful Index<span style="position: relative; left: 40px">&raquo;&raquo;</span></a></li>
    	<li onMouseover="dropdownmenu(this, event, menu5, '150px')" onMouseout="delayhidemenu()"><a href="http://www.benal-life.com/hotels.htm" title="Book your Hotel at the cheapest price available">Hotels & Hostels <span style="position: relative; left: 36px">&raquo;&raquo;</span></a></li>
    	<li><a href="http://www.benal-life.com/cpg1413/index.php" title="Members gallery where you show the world your photographs of Benalmadena">Picture Gallery</a></li>
    	<li><a href="http://www.benal-life.com/chat/" title="THE BEST place to chat about Benalmadena and Arroyo de la Miel">Benalmadena Forum</a></li>
    	<li><a href="http://www.benal-life.com/theme.htm" title="The sun has got his hat on and he's coming out to play">Cheer up with our song</a></li>
    	<li onMouseover="dropdownmenu(this, event, menu6, '150px')" onMouseout="delayhidemenu()"><a href=""#"" title="If you are travelling you might like to check out these sites">Travel Essentials<span style="position: relative; left: 35px">&raquo;&raquo;</span></a></li>
    	<li onMouseover="dropdownmenu(this, event, menu7, '150px')" onMouseout="delayhidemenu()"><a href="http://www.benal-life.com/shopping/travel/linktravelpackages.htm" title="The BEST of the package holiday companies operating in the UK">Package Holidays <span style="position: relative; left: 28px">&raquo;&raquo;</span></a></li>
    	</ul>
    The Javascript code (vertical.js)
    Code:
    //Contents for menu 1
    var menu1=new Array()
    menu1[0]='<a href="#">Quick Links<span style="position: relative; left: 74px"></span></a>'
    menu1[1]='<a href="http://www.benal-life.com/XMLAttraction/arroyomap.htm">Benalmadena Maps</a>'
    menu1[2]='<a href="http://www.benal-life.com/travel/travel.htm">Travel Shop</a>'
    menu1[3]='<a href="http://www.benal-life.com/information/info.htm">Things Useful</a>'
    menu1[4]='<a href="http://www.benal-life.com/travel/travel.htm">Local Travel Help</a>'
    menu1[5]='<a href="http://www.benal-life.com/hotels.htm" class="navlist">Hotels and Hostels</a>'
    
    //Contents for menu 2, and so on
    var menu2=new Array()
    menu2[0]='<a href="http://www.benal-life.com/bars/bars.htm" title="Featured Bars in Benalmadena">Benalmadena Bars</a>'
    menu2[1]='<a href="http://www.benal-life.com/restaurants/restaurants.htm" title="Featured Restaurants">Local Restaurants</a>'
    menu2[2]='<a href="http://www.benal-life.com/businesses/business.htm" title="Featured Businesses">Local Business</a>'
    menu2[4]='<a href="http://www.benal-life.com/weather_records/weather.htm" title="The Current and the forecast weather for Benalmadena">Weather Records</a>'
    menu2[3]='<a href="http://www.benal-life.com/latest_updates.htm" title="The most recent of our pages to have major updates">Latest Updates</a>'
    menu2[4]='<a href="http://www.benal-life.com/daysout/daysout.htm" title="Recommended days out with routes, pictures & maps">DIY Excursions</a>'
    menu2[5]='<a href="http://www.benal-life.com/golf.htm" title="Golf and the golf courses of the Costa del Sol">Golf</a>'
    menu2[6]='<a href="http://www.benal-life.com/fiestas/fiestas.htm" title="Things you might like to know about the many public holidays in spain">Parades & Fiestas</a>'
    menu2[7]='<a href="http://www.benal-life.com/artistes/artistes.htm" title="A Free to join directory of Artistes and Entertainers on the Costa del Sol">Performers Directory</a>'
    menu2[8]='<a href="http://www.benal-life.com/dementia/opener.htm" title="Do you think that you are safe from dementia?">An amusing test</a>'
    
    
    //Contents for menu 3, and so on
    var menu3=new Array()
    menu3[0]='<a href="http://www.benal-
    I have tried viewing on Firefox and IE6 - what am I doing wrong please??

  5. #5
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    The file extension for your page online (.htm) is most likely static, and hence the include() statement isn't being interpreted. It should be something like .shtml assuming your server is set to recognize that as SSI enabled pages.

  6. #6
    Join Date
    Jan 2008
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks, I am sorry I should have read the link you pointed me at earlier in this post

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •