Jump to content

Menu - Help (Newbie)


Penterprises

Recommended Posts

Hi, I have mainly used WYSIWYG Kompozer to create my website but I have started to learn some HTML and therefore could follow coding.I have redesigned a website and put a menu bar across the top (as seen here: http://www.st-michaels-headingley.org.uk/worship.htm) however every time I want to add a new menu item I have to copy it and paste it across all the pages. Is there a way of having the menu on one page and if I alter it all the others will alter too?Also would it be possible to create one of the menu bars that drop down to sub menus that would work across all as well?Many thanks,Susan

Link to comment
Share on other sites

Hi, I have mainly used WYSIWYG Kompozer to create my website but I have started to learn some HTML and therefore could follow coding.I have redesigned a website and put a menu bar across the top (as seen here: http://www.st-michaels-headingley.org.uk/worship.htm) however every time I want to add a new menu item I have to copy it and paste it across all the pages. Is there a way of having the menu on one page and if I alter it all the others will alter too?Also would it be possible to create one of the menu bars that drop down to sub menus that would work across all as well?Many thanks,Susan
Easy to do. What you want is an include with the menu that appears on every page. Change the include once and it is changed for every page.Are you using or have access to PHP?
Link to comment
Share on other sites

Easy to do. What you want is an include with the menu that appears on every page. Change the include once and it is changed for every page.Are you using or have access to PHP?
Thanks Jerry, this is a bit out of my league as I'm not sure what an include is but I've looked on my cpanel and it says PHP Version 5.2.6 I've looked around Kompozer software and it doesn't mention PHP anywhere there so I'm not sure what the answer is!Hope you can make sense of this,Susan
Link to comment
Share on other sites

Jerry's right. This trick is easy. But first: You panel says you have access to PHP, and a late version, too. That's great. We just need to make sure it's actually enabled. There ought to be a widget in your panel that tells you that, or how to switch it on if it's not. Should be easy.Okay.First build your menu in a regular html file. When you have it all set, strip away all the html that's NOT part of the menu. Any CSS that affects the menu should go in an external file, if it's not there already. The rest of the html (the <html> and <header> tags, etc., I really mean EVERYTHING not part of the menu, just get it out of there. What you have left should look like a partial document. Save the file with a creative name like "menu.html".Now, in every file that requires the menu, in the place you want the menu to be, add this small PHP script:<?php include ('menu.html') ?>You'll also need to link that CSS file I mentioned, if it's not already linked. But yes. That's all the PHP you need to know to make this work.

Link to comment
Share on other sites

Thanks I have started working through this, I opened a new tab and just entered:<a href="index.htm">Main Menu</a>  <a href="worship.htm">Our Worship</a>  <a href="">Parish Eucharist</a>  <a href="">Who's Who</a>   <a href="">Discussion & Prayer Groups</a>  <a href="students.htm">Students</a>  <a href="sermons.htm">Sermon Themes</a>  <a href="choir.htm">Choir</a>  but it is refusing to save it as there is no head tag. Should I have stripped everything back or left the tags that are automatically there when I start a new page ie <header></header><body></body> etcThanks,SusanSorry, I am really new to anything other that WYSIWYG but I am keen to learn, CSS is going to be a new mystery to me!

Link to comment
Share on other sites

Hmm. First, Go back and grab those div tags that surround all the <a> tags. You need that for shape and style, the way the original is.Now, are you sure there's no tickbox that will override that saving problem? An override of some kind would help enormously. If not . . . I don't know Kompozer, so what I'm suggesting might not work.1. Select and copy the whole menu, with the div tags, as I said above. Paste it into a plain text editor. If you're on Windows, that's Notepad. Now, just save the file in plain text format, or HTML, whatever it likes.2. Upload that file from your hard drive to the server. I'm hoping Kompozer will let you do that without loading the file into its editor. If not, there are plenty of free FTP client programs out there. If you find one, the username and password should be the same ones Kompozer uses. (Your server doesn't care what software you use. FTP is FTP.) I believe FileZilla is popular: http://filezilla-project.org/ (I'm a Mac fellow, myself.)It's not more complicated than that.

Link to comment
Share on other sites

OK I have created the page in my text editor and uploaded it manually to my site, I then added to the PHP code you gave me, which turned pink. I then re-uploaded the page and refreshed it in the browser and now the menu is missing. You mentioned something about needing a CSS sheet. I didn't know what to do about this, is this why it is missing?It might help to see that the trial page looks like this:<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html><head> <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"> <title>Who's Who</title> <meta content="Susan Penter" name="author"></head><body style="width: 800px;"><br><h1 style="width: 800px; text-align: center; color: navy;"><font><font style="font-weight: bold;" size="+2"><span style="font-family: Arial;">Who's Who</span></font></font></h1><br><br><?php include ('menu.htm'); ?><br></body></html>Thanks in advance,Susan

Link to comment
Share on other sites

Indeed, you need to save the files as ".php".Alternately, you can make an entry in the .htaccess file to have a regular .html file parsed as php.Create a regular text file in the main (public_html folder) on your Hosting account named .htacces (yes, the dot is required).Add this to the first line:

AddType application/x-httpd-php .html

Save the file.On your pages, you can then "include" other html files using php syntax.

Link to comment
Share on other sites

Thanks Jerry, this is a bit out of my league as I'm not sure what an include is but I've looked on my cpanel and it says PHP Version 5.2.6 I've looked around Kompozer software and it doesn't mention PHP anywhere there so I'm not sure what the answer is!Hope you can make sense of this,Susan
Here is the skinny on it.Create a file in your editor. Give it a name of "menu.php". Don't put anything in it other than the word "menu" (just for testing). Upload it to your server just like any other web page you have.Open any web page you have and include the following in any place between the body tags. (Often you will also have an include in the header for things like the meta information that doesn't change.)Use this code:<?php include("menu.php"); ?> Upload that web page to your server and then view it in your browser. If you see the word "menu" then it worked. If you don't, let me know.If it worked, then copy out the menu from where ever you have it and put it in this one file and upload it to the server just as you do any other file. Add that snippet of code to any page that you want your menu to appear. Bingo. Done.You can now do the same for any constant that you want to appear like a footer or a logo.HTH.
Link to comment
Share on other sites

Thanks I have started working through this, I opened a new tab and just entered:<a href="index.htm">Main Menu</a>  <a href="worship.htm">Our Worship</a>  <a href="">Parish Eucharist</a>  <a href="">Who's Who</a>   <a href="">Discussion & Prayer Groups</a>  <a href="students.htm">Students</a>  <a href="sermons.htm">Sermon Themes</a>  <a href="choir.htm">Choir</a>  but it is refusing to save it as there is no head tag. Should I have stripped everything back or left the tags that are automatically there when I start a new page ie <header></header><body></body> etcThanks,SusanSorry, I am really new to anything other that WYSIWYG but I am keen to learn, CSS is going to be a new mystery to me!
That is exactly what you want to have. We can work on the spaces ( ) and a better way to lay it out after we get the include to work.Look in your editor for a File | Save As option. Worse case, just type it in Notepad.
Link to comment
Share on other sites

OK I have created the page in my text editor and uploaded it manually to my site, I then added to the PHP code you gave me, which turned pink. I then re-uploaded the page and refreshed it in the browser and now the menu is missing. You mentioned something about needing a CSS sheet. I didn't know what to do about this, is this why it is missing?It might help to see that the trial page looks like this:<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html><head> <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"> <title>Who's Who</title> <meta content="Susan Penter" name="author"></head><body style="width: 800px;"><br><h1 style="width: 800px; text-align: center; color: navy;"><font><font style="font-weight: bold;" size="+2"><span style="font-family: Arial;">Who's Who</span></font></font></h1><br><br><?php include ('menu.htm'); ?><br></body></html>Thanks in advance,Susan
For this part, you don't need the css and it will not affect how you include anything. Make sure of your names. Did you have "menu.htm" or "menu.htlm" for example? It can be either or neither as it is just a file name and has nothing to do with html directly. It should be in the same place as the rest of your web pages. Later, we can work on organization, but that isn't needed for this first step.One step at a time and we will get there.
Link to comment
Share on other sites

I've been trying to sort this out on my own and looking at this page:http://www.w3schools.com/php/php_includes.aspmy menu needs to be saved as menu.php and every page I use the include on needs to be saved as .php and the links need to be changed to say .phpDo I need to do all this now?I don't want to risk mucking up my whole site.Thanks
An aside: PHP is one way and ASP is another way. They follow the same function, but use a different syntax. You have PHP included on your site (most do) so stick to that.You can save it as a .php or a .htm or a .html or just as .fred. The important part is that the include statement match it - and case will matter. HTM does not equal htm.
Link to comment
Share on other sites

Indeed, you need to save the files as ".php".Alternately, you can make an entry in the .htaccess file to have a regular .html file parsed as php.Create a regular text file in the main (public_html folder) on your Hosting account named .htacces (yes, the dot is required).Add this to the first line:
AddType application/x-httpd-php .html

Save the file.On your pages, you can then "include" other html files using php syntax.

There is already a file there called .htaccess it has this content:AddHandler x-httpd-php .htmlAddHandler x-httpd-php .htmAddHandler server-parsed .htmAddHandler server-parsed .html
Link to comment
Share on other sites

For this part, you don't need the css and it will not affect how you include anything. Make sure of your names. Did you have "menu.htm" or "menu.htlm" for example? It can be either or neither as it is just a file name and has nothing to do with html directly. It should be in the same place as the rest of your web pages. Later, we can work on organization, but that isn't needed for this first step.One step at a time and we will get there.
I definitely used .htm as I have used that extension throughout the whole site.I don't know if it is important or not but I have a Linux system, Instead of note pad I used Gedit text editor which is used for coding. I then uploaded it straight through my cPanel X as Komposer is only happy working with standard web pages I think.I have tried saving it with just the word menu and it still didn't appear!
Link to comment
Share on other sites

I definitely used .htm as I have used that extension throughout the whole site.I don't know if it is important or not but I have a Linux system, Instead of note pad I used Gedit text editor which is used for coding. I then uploaded it straight through my cPanel X as Komposer is only happy working with standard web pages I think.I have tried saving it with just the word menu and it still didn't appear!
What is the URL? We won't (shouldn't) see the include as that happens at the server and not the local browser. If we do, then PHP isn't active and you need to tell the ISP to get on the stick. I suspect it is active as PHP is used pretty universally.Try naming it menu.php.
Link to comment
Share on other sites

What is the URL? We won't (shouldn't) see the include as that happens at the server and not the local browser. If we do, then PHP isn't active and you need to tell the ISP to get on the stick. I suspect it is active as PHP is used pretty universally.Try naming it menu.php.
The main page i am working with is at:http://www.st-michaels-headingley.org.uk/worship.htmto see the page I have tried to put the include on change worship.htm to people.htmThanks,Susan
Link to comment
Share on other sites

The main page i am working with is at:http://www.st-michaels-headingley.org.uk/worship.htmto see the page I have tried to put the include on change worship.htm to people.htmThanks,Susan
I had a look around on my panel and spotted an Apache handler that went to a screen like this:Extension(s) Handler A box with either .htm or .html A box where you can type something in User Defined Handlers.htm server-parsed.html server-parsedSystem Defined Handlers.cgi .pl .plx .ppl .perl cgi-script.shtml server-parsedCould this have anything to do with the problem?
Link to comment
Share on other sites

I have searched everywhere for a widget to mke sure it is turned on, where would you suggest looking?General account information:Hosting package Free HostingShared Ip Address 72.52.143.78Subdomains 0 / 5Parked Domains 0 / 0Addon Domains 0 / 0MySQL Databases 1 / 1Disk Space Usage 69.77 MegabytesMySQL Disk Space 3.25 MegabytesDisk space available 430.23 MegabytesBandwidth (this month) 16.98 MegabytesEmail Accounts 6 / 25Email Forwarders 5Auto-responders 0Mailing Lists 0 / unlimitedEmail Filters 2Ftp Accounts 1 / 1General server information:Operating system LinuxService Status Click to ViewKernel version 2.6.9-55.0.9.ELsmpMachine Type x86_64Apache version 2.2.9 (Unix)PERL version 5.8.8Path to PERL /usr/bin/perlPath to sendmail /usr/sbin/sendmailInstalled Perl Modules Click to ViewPHP version 5.2.6MySQL version 5.0.51a-communitycPanel Build 11.23.6-STABLE 27698Theme cPanel X v2.6.0Documentation Click to ViewcPanel Pro 1.0 (RC1) Mail Webmail Change Password Parked Domains Addon DomainsFTP Manager File Manager Disk Space Usage Backups Password Protect DirectoriesError pages Subdomain MySQL® Databases SSH/Shell Access RedirectsFrontPage® Extensions Web/FTP Stats Raw Access Logs Raw Log Manager Error logSubdomain Stats Chatroom PhpMyChat Bulletin Board CGI CenterScripts Library Agora Shopping Cart Cron jobs Network Tools MIME TypesApache Handlers Manage OpenPGP Keys HotLink Protection Leech Protection Index ManagerIP Deny Manager Change Language SSL Manager Statistics Software Configuration Image ManagerFantastico De Luxe Thanks!

Link to comment
Share on other sites

I had a look around on my panel and spotted an Apache handler that went to a screen like this:Extension(s) Handler A box with either .htm or .html A box where you can type something in User Defined Handlers.htm server-parsed.html server-parsedSystem Defined Handlers.cgi .pl .plx .ppl .perl cgi-script.shtml server-parsedCould this have anything to do with the problem?
Don't know about that. Change your include to have no spaces after the "include" (from:<?php include ('menu.php'); ?>to: <?php include('menu.php'); ?>)I shouldn't have seen the include statement in the source, it should have been converted before it came to me to whatever you have in menu.php. Try that.
Link to comment
Share on other sites

When you view the source of people.htm, you can clearly see the <?php> tag. This means PHP is not yet enabled on your site. That was job 1. :)
Yep. That's why I asked her for the URL; just to check that one thing.I'd contact the ISP however. It is set on the server even if she has access to that server to change it.
Link to comment
Share on other sites

I have searched everywhere for a widget to mke sure it is turned on, where would you suggest looking?Thanks!
Check with the ISP/host. And when you do, make sure MySQL is active for you. That's for FAR down the road, but it is a VERY powerful thing to have.
Link to comment
Share on other sites

<?phpphpinfo();?>

Create and save a file on your Hosting account with the above code. Name the file phpinfo.php.Then use your Browser to navigate to the URL for the file.Example: http://your_domain.com/phpinfo.php If php is enabled, you will get a full page of information.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...