Jump to content
xisto Community
Sign in to follow this  
DJM

Can A Perminant List Or Table Be Displayed On Your Site By Placing It In The Css Stylesheet? Without the use of frames.

Recommended Posts

If you look at my site HERE you'll see a list on the side that says: Home, Reviews, Links, Staff & Contact.

If I wanted to change that or add another link I would have to change every page on the site which is obviously very time consuming and annoying. I know a way to get around it would be to use frames. But I was wondering if it was possible to put it in the CSS stylesheet somewhere so you only have to make a change to the CSS stylesheet instead. Is that even remotely possible at all, or am I dreaming of something that isn't going to happen?

Share this post


Link to post
Share on other sites

No.But you can achieve that by using PHP code and INCLUDE command.PHP INCLUDE is a very nice function. You can include the same static HTML code to any page by simply,

include ('file_name.ext');

But you must use .php extension to the page being included, for example, home.php, reviews.php, etc.You can use .html or .htm and still use this PHP INCLUDE command. You will need to modify htaccess in that directory.

RemoveHandler .html .htmAddType application/x-httpd-php .php .htm .html  

Make this your .htaccess file and in your regular .html or .htm file insert the code

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

Your regular .html or .htm file can now parse PHP commands.There is another method to include within regular HTML file. That is to use OBJECT to include another .html or .htm file. But I believe this make your webpage load slower.You can also use iframe to include another page but it may not be good for certain SEO.

Share this post


Link to post
Share on other sites

just like buffelohelp said, you can do this by using the "include" function in PHP, or iframe or object.

but i do believe that using INCLUDE function is the easier way, you can only rename your index.html to be index.php, cut the part of menu part and paste it in a separate file and name it something like list.php, then add this to your index.php.

include ('list.php');

Share this post


Link to post
Share on other sites

You are probably looking for a content management system such as Drupal or WordPress. You can get a custom theme and have the menus managed by the content management system. A content management system does a whole lot more, such as enabling users to post comments on your pages, provide a contact form for the website to email you messages, and a whole lot more.If you aren't willing to go all the way, a server-side include is all it takes. Alternatively, you can use the standard PHP include that web_designer has posted above.

Share this post


Link to post
Share on other sites

Thanks for your help guys. Those options sound ideal, I did try it but it didn't work due to me doing something dreadfully wrong no doubt.Even though all the above-mentioned is over my head, and I have NEVER dealt with PHP before, I will have another play and see if I can get it to work, thanks again.

Share this post


Link to post
Share on other sites

yes. buffalohelp is correct. it is very simple. first you want to add what he said to add in your .htaccess file. if you don't have one yet, create one since your site right now is in html format. this code will allow you to use php in your html document.....

RemoveHandler .html .htmAddType application/x-httpd-php .php .htm .html

then what you want to do is figure out what you want to put in a seperate file. some people like to seperat a lot of things like the header,footer,menus, etc..... since we are only talking about your menu, then you would cut out...

<div id="left"><h2>Golden Age Gaming</h2><ul><li><a href="home.html">Home</a></li><li><a href="reviews.html">Reviews</a></li><li><a href="links.html">Links</a></li><li><a href="staff.html">Staff & Contact</a></li><br><br><img src="images/1.bmp" width="100" height="100" alt="Space Invader" /></ul></div>

in your html document and make a seperate file "menu.php" for that part of the code you just cut out from your main html document and save it. if you are going to make more than one include file, you might want to create a new directory to store them for organization sake.

now all you have to do is insert the code...

<?php include 'menu.php'?>
where you originally cut the code from you html document and you're all set. that should be the right step by step instructions there for you. it's really not that hard. so whenever you want to edit the menu now, you don't have to change each page. you just have to change your "menu.php" file. i hope this helped since you were having trouble. i know it can be confusing at first but we are a patient bunch. just list any troubles your having or tell us exactly what you did so we can help you figure out the errors
Edited by anwiii (see edit history)

Share this post


Link to post
Share on other sites

First you want to add what he said to add in your .htaccess file. if you don't have one yet, create one since your site right now is in html format. this code will allow you to use php in your html document.....

RemoveHandler .html .htmAddType application/x-httpd-php .php .htm .html
Hi, thanks VERY much for that, you made it seem very simple. I feel confident in doing that now but have one question first. How do I create a ".htaccess" file. Do I add the code you mentioned above into a document and save it as ".htaccess" on the end of what the file is called? & if so what do I name the file? Thanks very much.

Share this post


Link to post
Share on other sites

RemoveHandler .html .htmAddType application/x-httpd-php .php .htm .html
Oh, I just saw somewhere how to make a .htaccess file. So now I just add that code above to that .htaccess file?

Share this post


Link to post
Share on other sites

you need to check to see if you have an .htaccess file first. if you do, ad the code to that file and save it by the same name .htaccess. if you DONT have the file, you will have to open up notepad, insert the code, SAVE AS ".htaccess" WITH the quotes or it will automatically save it as .htaccess.txtthen upload that file where your main domain directory is at. did i confuse you yet? :) i hope not....i have a bad time explaining sometimes....

Share this post


Link to post
Share on other sites

Oh, I just saw somewhere how to make a .htaccess file. So now I just add that code above to that .htaccess file?


yeah, DJM.

just do it, save it in .htaccess and follow anwiii's directions. he gave you a very detailed instructions, just follow them and everything gonna be alright. if you have any problem just post here and we will try to help you, good luck.

Share this post


Link to post
Share on other sites

Add what he said to add in your .htaccess file. if you don't have one yet, create one since your site right now is in html format.

Ok guys, I tried creating a .htaccess file from a tutorial I saw but it didn't work. I pasted the appropriate code you told me to into notepad, then I selected "all files", and called it ".htaccess". But after I saved it the icon for it was the icon that shows when your computer doesn't recognize the file. I did every thing else so the only thing I need to know is how to properly create a .htaccess file. I found a few tutorials but they weren't very clear, thanks guys.

Share this post


Link to post
Share on other sites

no no no. you don't select all files. just paste the 2 line code in notepad, and save as ".htaccess" WITH the quotes. the proper format would be a text document so don't select all files. if i wanted you to select all files, i would have told you to originally :) if you run in to any more problems, please post!

Share this post


Link to post
Share on other sites

No no no. You don't select all files, just paste the 2 line code in notepad, and save as ".htaccess" WITH the quotes. The proper format would be a text document so don't select all files.

I pasted the 2 line code into notepad and saved it as ".htaccess" WITH the quotation marks included and it did not work. The icon for the file once again is the icon the computer displays when it doesn't recognize the file.& when I open the website's page there is nothing displayed where the menu should be and the code <?php include 'menu.php'?> is. I am doing this on my computer as oppose to uploading it to the internet server. That wouldn't have anything to do with it would it?

Share this post


Link to post
Share on other sites

Actually the htaccess file I created is not called anything (ie. when you look at the icon in the folder it is an icon with no name). It will not let me call it .htaccess? Sorry guys I should just give up because I am a total armature and this will probably get to frustrating for you all because I am hopeless at this level.

Share this post


Link to post
Share on other sites

DJM, i made you the file, uploaded it to you and send you the link, i send it to you as (.rar file). just download it, extract the file, a folder named "yr file" will appear, your .htaccess file will be in it. copy it to your cpanal and see what will happen good luck.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.