Keeping menu HTML code on my hosting server

  • 1
  • Question
  • Updated 9 years ago
  • Answered
I just created a new menu (finally)!! What I like about it is that I keep the CSS files on my hosting server so that if I wan to change my menu stylings, I just alter this file and every occurence of the menu changes automatically on my Yola website.

What I would love to do is be able to do the same thing with the HTML code that I paste into the HTML widgets that I have for each page that my menu appears. Is there a way to have the HTML code sit on my hosting server so that If I want to make changes to the menu content, I could just open up the HTML file on the hosting server, make the change and then all of my menus on my Yola site will update automatically (I sure hope so!!)
Photo of Randy

Randy

  • 643 Posts
  • 8 Reply Likes
  • hopeful

Posted 9 years ago

  • 1
Photo of UK Duke

UK Duke, Champion

  • 3321 Posts
  • 213 Reply Likes
do you wnat the simple answer?

No.

Ive try'd to do it myself - with no luck - its not 'good practice' to hold div's as html files and link to them.

Lee.
Photo of Randy

Randy

  • 643 Posts
  • 8 Reply Likes
Hi Lee,

I was wondering if you can send me your email address. Like I said in my previous post. I have a basic idea of how this works. I just need to know what the anchor tag syntax looks like so that it links up correctly to specific areas in the target text. I really think, actually I know that this will really solve a serious bottlenexk on two of my pages. Thanks so much!!!
Photo of Randy

Randy

  • 643 Posts
  • 8 Reply Likes
IT WORKS!!!!!! I am so happy!! Thank you so much Lee. Now all I have to do is tweak the CSS a bit. Wow. This is so cool. Check out my site on the Bennett Archives page (www.mcran.com)
Photo of UK Duke

UK Duke, Champion

  • 3321 Posts
  • 213 Reply Likes
<!--
Glad its working - it looks good - well done.

To finish it off you need to add the smooth sailing script...
Add this to your page and see the effect it has

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/...>

<script type="text/javascript" src="http://hexham.info/resources/bookmark...>

-->

If you want to host the java file yourself go here and download the file, upload it to your server and point to its url - http://www.dynamicdrive.com/dynamicin...

Lee.
Photo of Randy

Randy

  • 643 Posts
  • 8 Reply Likes
Thanks Lee,

Where exactly do I put this code?
Photo of UK Duke

UK Duke, Champion

  • 3321 Posts
  • 213 Reply Likes
in a html widget at the top of the page. It should work.
Photo of Randy

Randy

  • 643 Posts
  • 8 Reply Likes
Thanks Lee,

I was just wanted to find a way around having to update every occurence of the menu on my Yola site when I make a change to the HTML. I wish there was a way around this. I guess for now I will stay with what I have created until I come across a better solution.
Photo of UK Duke

UK Duke, Champion

  • 3321 Posts
  • 213 Reply Likes
i did a decent bit of research into hosting the div of the menu html so i could up date all pages if i wanted to change my menu - i have over 600 pages in my site so you can image that if i want to change the main nav menu ots alot of work - actually right now half the site has a slightly differnet menu to the other half -.

If you find a way let me know but i dont think its possible
Photo of Randy

Randy

  • 643 Posts
  • 8 Reply Likes
Thanks Lee!

I was just wondering about maybe using PHP to generate menus. I am going to look into it and see what I find and post back. 600 pages? Wow that is quite a lot of pages to manage. Are you using Yola for that site?
Photo of Randy

Randy

  • 643 Posts
  • 8 Reply Likes
I just received this from a HTML forum. Are you able to get this to work?

Not with straight HTML, but using a server side language you can include other documents (be they HTML or other server/client side code). In PHP, all you need to do is:

Put that wherever you want your menu to appear on a page. Now, changes in menu.html will be reflected throughout any sites using that line. You need to make sure your webhost has PHP enabled. All that is in menu.html is exactly the HTML you would usually copy into a given page to display the menu.
Photo of Monique

Monique, VP of Customer Support

  • 6294 Posts
  • 446 Reply Likes
Hi Randy. I know it is not possible to execute custom PHP scripts from Yola sites. I am going to ask one of our developers to take a look at this thread and see if there is a workaround he can suggest. He will probably get back to you in a day or two.
Photo of Randy

Randy

  • 643 Posts
  • 8 Reply Likes
Thanks Monique!!

I'm just trying to find a more practical and efficient way to keep all of my files updated without having to make changes to all of the individual pages. I know you can do this with CSS. I tried it out by having a CSS file on my server and then if I need to make changes, I just modify that file and anything on my Yola site that points to that file would be updated automatically. I know that CSS deals with styling but am not sure if I could put links to my content in CSS. I tried PHP when I was using Rapidweaver on my Mac and it worked great.
Photo of Christo

Christo

  • 95 Posts
  • 13 Reply Likes
Hi Randy.

What you want to do is use JavaScript to create the content on your menu.

I've put together a little example for you here:
http://www.toast38coza.com/creating-a...

In a nutshell, what you do is:
1.) Store your menu configuration in JavaScript .. it will looks something like:


var aSubmenuData = [

{
id: &quot;communication&quot;,
itemdata: [
{ text: &quot;360&quot;, url: &quot;http://360.yahoo.com&quot; },
{ text: &quot;Alerts&quot;, url: &quot;http://alerts.yahoo.com&quot; },
{ text: &quot;Avatars&quot;, url: &quot;http://avatars.yahoo.com&quot; },
{ text: &quot;Groups&quot;, url: &quot;http://groups.yahoo.com &quot; },
{ text: &quot;Internet Access&quot;, url: &quot;http://promo.yahoo.com/broadband&quot; },
{
text: &quot;PIM&quot;,
submenu: {
id: &quot;pim&quot;,
itemdata: [
{ text: &quot;Yahoo! Mail&quot;, url: &quot;http://mail.yahoo.com&quot; },
{ text: &quot;Yahoo! Address Book&quot;, url: &quot;http://addressbook.yahoo.com&quot; },
{ text: &quot;Yahoo! Calendar&quot;, url: &quot;http://calendar.yahoo.com&quot; },
{ text: &quot;Yahoo! Notepad&quot;, url: &quot;http://notepad.yahoo.com&quot; }
]
}

},
{ text: &quot;Member Directory&quot;, url: &quot;http://members.yahoo.com&quot; },
{ text: &quot;Messenger&quot;, url: &quot;http://messenger.yahoo.com&quot; },
{ text: &quot;Mobile&quot;, url: &quot;http://mobile.yahoo.com&quot; },
{ text: &quot;Flickr Photo Sharing&quot;, url: &quot;http://www.flickr.com&quot; },
]
},

{
id: &quot;shopping&quot;,
itemdata: [
{ text: &quot;Auctions&quot;, url: &quot;http://auctions.shopping.yahoo.com&quot; },
{ text: &quot;Autos&quot;, url: &quot;http://autos.yahoo.com&quot; },
{ text: &quot;Classifieds&quot;, url: &quot;http://classifieds.yahoo.com&quot; },
{ text: &quot;Flowers &amp; Gifts&quot;, url: &quot;http://shopping.yahoo.com/b:Flowers%20%26%20Gifts:20146735&quot; },
{ text: &quot;Real Estate&quot;, url: &quot;http://realestate.yahoo.com&quot; },
{ text: &quot;Travel&quot;, url: &quot;http://travel.yahoo.com&quot; },
{ text: &quot;Wallet&quot;, url: &quot;http://wallet.yahoo.com&quot; },
{ text: &quot;Yellow Pages&quot;, url: &quot;http://yp.yahoo.com&quot; }
]
},

{
id: &quot;entertainment&quot;,
itemdata: [
{ text: &quot;Fantasy Sports&quot;, url: &quot;http://fantasysports.yahoo.com&quot; },
{ text: &quot;Games&quot;, url: &quot;http://games.yahoo.com&quot; },
{ text: &quot;Kids&quot;, url: &quot;http://www.yahooligans.com&quot; },
{ text: &quot;Music&quot;, url: &quot;http://music.yahoo.com&quot; },
{ text: &quot;Movies&quot;, url: &quot;http://movies.yahoo.com&quot; },
{ text: &quot;Radio&quot;, url: &quot;http://music.yahoo.com/launchcast&quot; },
{ text: &quot;Travel&quot;, url: &quot;http://travel.yahoo.com&quot; },
{ text: &quot;TV&quot;, url: &quot;http://tv.yahoo.com&quot; }
]
},

{
id: &quot;information&quot;,
itemdata: [
{ text: &quot;Downloads&quot;, url: &quot;http://downloads.yahoo.com&quot; },
{ text: &quot;Finance&quot;, url: &quot;http://finance.yahoo.com&quot; },
{ text: &quot;Health&quot;, url: &quot;http://health.yahoo.com&quot; },
{ text: &quot;Local&quot;, url: &quot;http://local.yahoo.com&quot; },
{ text: &quot;Maps &amp; Directions&quot;, url: &quot;http://maps.yahoo.com&quot; },
{ text: &quot;My Yahoo!&quot;, url: &quot;http://my.yahoo.com&quot; },
{ text: &quot;News&quot;, url: &quot;http://news.yahoo.com&quot; },
{ text: &quot;Search&quot;, url: &quot;http://search.yahoo.com&quot; },
{ text: &quot;Small Business&quot;, url: &quot;http://smallbusiness.yahoo.com&quot; },
{ text: &quot;Weather&quot;, url: &quot;http://weather.yahoo.com&quot; }
]
}
];



.. you store this javascript file on your server (or if you have Yola pro, you can just upload it with the file manager), and link to it from your Yola site like so:


&lt;script type=&quot;text/javascript&quot; src=&quot;http://www.yourserver.com/path/to/your/menu.js&quot;&gt; &lt;/script&gt;


.. this is a little advanced .. but hopefully should point you in the right direction ...
Photo of UK Duke

UK Duke, Champion

  • 3321 Posts
  • 213 Reply Likes
Thats a great suggestion Christo, its really nice of you to offer your knowledge and expertise like this. I wish i knew 1% of what you know about java.

In this case i have 2 questions - i know the answer is for Randy but i was also hopeing to have my menu in a single file as i now have 100's of pages.

So question 1 - is this 'normal' or good practice for a main site nav? - i presume if the browser has java scirpts blocked or can not display them the menu will not be visible. Do big sites use this method? or is standard practice a div on the page?

Question 2 - would this effect the chance of Goggle choosing sitel inks for your site? (you know the 4 or 5 page links under your domain name) Also would it have any bad effect in SEO terms?

Thanks Christo - Lee.
Photo of Randy

Randy

  • 643 Posts
  • 8 Reply Likes
Thank you so much Christo!!! I really apreciate you doing this for me. Looking forward to trying it out! :)
Photo of Christo

Christo

  • 95 Posts
  • 13 Reply Likes
Hey Guys,

It's a pleasure. It's quite difficult to implement, but at least you can see that it can be done :).

UK Duke, some answers to your questions:
1.) While this is acceptable practice, It is probably not best practice. The reason is precisely as you point out in question 2 - using JavaScript for your main navigation will likely negatively affect your SEO (because crawlers have a more difficult time following JavaScript links).

A thought on question 2, is that you could probably use the code I posted above to attach drop-down menu's to The main navigation generated by Yola.

.. If I get a moment I'll try and whip up an example doing that
Photo of papa

papa

  • 327 Posts
  • 20 Reply Likes
I've tried as you describe above and doesn't work for me. Tried it on this page http://www.wetlandexploration.com/tes... check spelling and everything else. Is there something else that I missed.
papa
Photo of Christo

Christo

  • 95 Posts
  • 13 Reply Likes
hey papa. You want to rename your file from Multi-Menu.txt to Multi-Menu.js (and update the html including appropriately).

The browser needs to know that the file you are loading up is JavaScript.
Photo of papa

papa

  • 327 Posts
  • 20 Reply Likes
I'm confused. Where is a good source for learning JavaScript

papa
Photo of Marije

Marije, Official Rep

  • 4636 Posts
  • 237 Reply Likes
Hey papa - you could probably start with w3schools: www.w3schools.com. Otherwise, I did a quick Google search and got these results: http://www.google.com/search?q=learn+...
Photo of papa

papa

  • 327 Posts
  • 20 Reply Likes
Thanks Marije

I've look at w3schools and will look at again. I went threw Christo link from above and look around and ended up here with a video about menu and some explanation also http://developer.yahoo.com/yui/menu/ I'll surely check out your Google suggestion also. Thought this would all be simpler with the above code and the script link. Surprise!

Thanks for all the assistance.

papa
Photo of Boomer

Boomer, Champion

  • 2055 Posts
  • 84 Reply Likes
@ Randy and Lee.
Here is a solution: http://forum.yola.com/yola/topics/can...
Photo of Randy

Randy

  • 643 Posts
  • 8 Reply Likes
Thanks Boomer! I will take a look at this.