Jump to content

I need your help, all ye people who know interwebs design!


Dirkmetal

Recommended Posts

My website has a side bar that's on almost every page. It contains links to navigate the site and stuff.

Every time I edit this side bar I have to go through and add the changes to very single page, which is annoying, and takes a long time.

 

Does anyone know how I can make it so that if I edit the side bar on one page, it will have the same changes on every other page?

 

Do I need to use PHP for this, or does it work with HTML, or XTML? Is it a script? I don't know anything about javascript or PHP, but I do know how to copy, and paste code. :P

 

 

Like lets say I have this as a side bar:

<!--SIDE BAR START-->
<tr>
<td valign="top" bgcolor="silver">
<font size="5"><strong>Text</strong></font>
<br/><hr>
<font size="4"><strong>Text</strong></font>
<font size="2">
<br/><br/>
Text <br/><a href="URL">Link text</a>
<br/><br/>
</font>
<img src="./pics/spacer.gif" width="1" height="100%">
</td>
<!--SIDE BAR END-->

 

If I want to change it, like by adding a link, or fixing a spelling error etc, but not have to go and edit each page manually to add the changes.

Prism_Swords.png
Link to comment
Share on other sites

Its easy in php as you can just use require() or include().

If you don't have php its possible using javascript, but that would lead to anyone with javascript disabled unable to use the navigation.

 

Anyway this is the php way of doing it.

Main page

<html>
<head></head>
<body>
<!--SIDE BAR START-->
  <?php
     include('nav.htm');
  ?>
<!--SIDE BAR END-->
</body>
</html>

Navigation page

<table>
<tr>
<td valign="top" bgcolor="silver">
<font size="5"><strong>Text</strong></font>
<br/><hr>
<font size="4"><strong>Text</strong></font>
<font size="2">
<br/><br/>
Text <br/><a href="URL">Link text</a>
<br/><br/>
</font>
<img src="./pics/spacer.gif" width="1" height="100%">
</td>
</table>

 

I would highly advise you don't use tables in that way though as CSS is a lot better and will allow for much easier coding in the long term.

[hide=Drops]

  • Dragon Axe x11
    Berserker Ring x9
    Warrior Ring x8
    Seercull
    Dragon Med
    Dragon Boots x4 - all less then 30 kc
    Godsword Shard (bandos)
    Granite Maul x 3

Solo only - doesn't include barrows[/hide][hide=Stats]

joe_da_studd.png[/hide]

Link to comment
Share on other sites

Yeah, I'm not to good with CSS's. I need to read up on them some more.

 

Thanks a lot for the help though. :)

 

*edit*

It's not loading the "nav.htm". I have already checked and made sure that it's not a typo or something like a capital letter.

 

I'm thinking something is wrong, because when I click "viewscource" in Firefox what i see is:

<!--SIDE BAR START-->
<?php include("nav.htm"); ?>
<!--SIDE BAR END-->

Which I know is not right, because your not even supposed to be able to see php code when you view the source.

I have even googled your example code, and found a couple of tutorials. I have copy/pasted all the code from those tutorials, and still it won't work.

 

Do I have to compile php or something?

Prism_Swords.png
Link to comment
Share on other sites

Why not simply use an external css file instead? Or maybe I'm misunderstanding something here.

CSS's can't add new lines (text, links, images, etc) to the page, can it? I thought it could only modify (color, size, etc) what was already there.

 

*edit*

Not even the

<?php
echo "Text";
?>

is working, do I have to download a PHP plugin?

Prism_Swords.png
Link to comment
Share on other sites

You need to actually save it as .php not .html.

 

I suggest you read up on some basic tutorials on php. Sure, you could just "copy/paste" but that isn't exactly going to help you in the long run, now is it? We can't hold your hand that much, some of the stuff you'll have to figure out on your own.

Link to comment
Share on other sites

Why not simply use an external css file instead? Or maybe I'm misunderstanding something here.

CSS's can't add new lines (text, links, images, etc) to the page, can it? I thought it could only modify (color, size, etc) what was already there.

 

*edit*

Not even the

<?php
echo "Text";
?>

is working, do I have to download a PHP plugin?

I didn't see you wanted to do that, sorry, didn't quite read what was in the code quotes.

Link to comment
Share on other sites

I have figured it out. I have to down load a plug-in for php to work, but there is no point in me doing that.

Also php code is not working online for me, because my web host (freewebs aka webs.com) does not support php unless your a paying member. :(

 

@sbrideau2000: I was just showing that even the most basic of hp was not working for me.

Prism_Swords.png
Link to comment
Share on other sites

I have figured it out. I have to down load a plug-in for php to work, but there is no point in me doing that.

Also php code is not working online for me, because my web host (freewebs aka webs.com) does not support php unless your a paying member. :(

 

@sbrideau2000: I was just showing that even the most basic of hp was not working for me.

 

I'm guessing by plug-in you're probably talking about a CMS like wordpress, right? They generally use PHP for the layout so it is easy to dynamically edit them.

Link to comment
Share on other sites

If you're just going to have static content and your server it running Apache or lighthttpd you could use SSI(Server Side Includes). Provided your host supports it and with free hosting beggars can't be choosers. With PHP your going to need PHP installed along with some type of web server such as Apache, lighthttpd, IIS, etc. You could do it all on the client side via JavaScript without any server requirements; unfortunately, that means you will need to make sure your user's browser supports JavaScript. Most browsers support JavaScript, however, there are a few that don't such as mobile phones.

Link to comment
Share on other sites

If you're just going to have static content and your server it running Apache or lighthttpd you could use SSI(Server Side Includes). Provided your host supports it and with free hosting beggars can't be choosers. With PHP your going to need PHP installed along with some type of web server such as Apache, lighthttpd, IIS, etc. You could do it all on the client side via JavaScript without any server requirements; unfortunately, that means you will need to make sure your user's browser supports JavaScript. Most browsers support JavaScript, however, there are a few that don't such as mobile phones.

Plus the fact people disable scripts for security.

Prism_Swords.png
Link to comment
Share on other sites

It's possible to do this without any PHP/CSS at all:

<!--#include file="navbar.html" -->

 

However, for this to work, you must save every single page you use this on as shtml. That basically means changing the extension from html to shtml. Pretty easy.

 

Your navbar code should work with this without any problems.

 

By the way, if you want a good free host, I suggest this one. Much better than Webs.

Link to comment
Share on other sites

It's possible to do this without any PHP/CSS at all:

<!--#include file="navbar.html" -->

 

However, for this to work, you must save every single page you use this on as shtml. That basically means changing the extension from html to shtml. Pretty easy.

 

Your navbar code should work with this without any problems.

Wait, isn't

<!--text-->

code for a commenting things out?

 

By the way, if you want a good free host, I suggest this one. Much better than Webs.

Looks to good to be true. What's the catch? Do they eat kittens? Fund terrorism? Work for Google?

 

 

*edit*

Does anyone know how to add those icons that are next to the URL in the navigation toolbar, and are on the tabs?

 

Also, stop pronouncing the topic title as " All yee people", the word "Ye" is pronounced as "Th"

Edited by Dirkmetal
Prism_Swords.png
Link to comment
Share on other sites

Wait, isn't
<!--text-->

code for a commenting things out?

 

In this case, nope.

 

Looks to good to be true. What's the catch? Do they eat kittens? Fund terrorism? Work for Google?

 

The only problem I've noticed is that sometimes the control panel works slowly. That's pretty rare though.

 

Does anyone know how to add those icons that are next to the URL in the navigation toolbar, and are on the tabs?

 

They're called favicons. Add this code somewhere on the pages:

 

<link rel="icon" href="/favicon.gif" type="image/gif">

 

The favicon should be 32x32 pixels. PNG or GIF files can be used (remember to change GIF to PNG in the code if you use that). Upload it in the same folder as the pages.

Link to comment
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
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.