Jump to content



Welcome to KnowledgeSutra - Dear Guest , Please Register here to get Your own website. - Ask a Question / Express Opinion / Reply w/o Sign-Up!
* * * * * 1 votes

Can A Perminant List Or Table Be Displayed On Your Site By Placing It In The Css Stylesheet?


34 replies to this topic

#1 DJM

    Newbie [Level 2]

  • Kontributors
  • PipPip
  • 25 posts

Posted 18 June 2010 - 11:59 PM

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?

#2 BuffaloHelp

    Sterling Archer

  • Kontributors
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 4,088 posts
  • Gender:Male
  • myCENT:50.18

Posted 19 June 2010 - 03:54 AM

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 .htm
AddType 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.

#3 web_designer

    "french rose sparkle under moonlight"...do you believe in the magic of moonlight??!!...

  • Kontributors
  • PipPipPipPipPipPipPipPipPipPipPip
  • 1,385 posts
  • Gender:Female
  • Location:US, CA
  • Interests:internet and the web
    reading books
    sport
    watching tv series
    drawings and art
  • myCENT:12.10
  • Spam Patrol

Posted 19 June 2010 - 06:18 AM

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');













#4 k_nitin_r

    Grand Imperial Poobah

  • Kontributors
  • PipPipPipPipPipPipPipPipPipPipPip
  • 1,114 posts
  • Gender:Male
  • Location:Dubai
  • myCENT:50.55

Posted 19 June 2010 - 12:50 PM

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.

#5 DJM

    Newbie [Level 2]

  • Kontributors
  • PipPip
  • 25 posts

Posted 20 June 2010 - 12:07 AM

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.

#6 anwiii

    I wont bite...unless you WANT me too

  • Kontributors
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 2,704 posts
  • Gender:Male
  • Location:Chilhowee, MO
  • Interests:watching grass grow....
  • myCENT:62.06
  • Spam Patrol

Posted 20 June 2010 - 02:31 AM

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 .htm
AddType 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 &amp; 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, 20 June 2010 - 02:30 AM.


#7 DJM

    Newbie [Level 2]

  • Kontributors
  • PipPip
  • 25 posts

Posted 20 June 2010 - 03:05 AM

View Postanwiii, on 20 June 2010 - 02:31 AM, said:

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 .htm
AddType 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.

#8 DJM

    Newbie [Level 2]

  • Kontributors
  • PipPip
  • 25 posts

Posted 20 June 2010 - 03:14 AM

View Postanwiii, on 20 June 2010 - 02:31 AM, said:

RemoveHandler .html .htm
AddType 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?

#9 anwiii

    I wont bite...unless you WANT me too

  • Kontributors
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 2,704 posts
  • Gender:Male
  • Location:Chilhowee, MO
  • Interests:watching grass grow....
  • myCENT:62.06
  • Spam Patrol

Posted 20 June 2010 - 03:20 AM

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.txt

then 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....

#10 web_designer

    "french rose sparkle under moonlight"...do you believe in the magic of moonlight??!!...

  • Kontributors
  • PipPipPipPipPipPipPipPipPipPipPip
  • 1,385 posts
  • Gender:Female
  • Location:US, CA
  • Interests:internet and the web
    reading books
    sport
    watching tv series
    drawings and art
  • myCENT:12.10
  • Spam Patrol

Posted 20 June 2010 - 05:21 AM

Quote


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.






Reply to this topic


This post will need approval from a moderator before this post is shown.

  


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users