Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Nermal

Moderator
Original poster
Staff member
Dec 7, 2002
20,640
4,039
New Zealand
PLEASE NOTE: I have solved the problem listed in this post, but have another problem later in the thread, post number 7.

Hi

I'd like each page of my site to have a "header", with links to various pages throughout the site (just like the tabs at the top of the forums here). How can I do this? I've created a file, header.html, that contains everything I want, so how can I add this to the top of each page?

I thought about using a frame, but then it'll still be "stuck" at the top of the screen even if the user scrolls down (unless there's a framing feature that I don't know about).

In the past I've used the PHP "include" function, but I can't use that in this case, as the server does not have PHP.

What can I do?

Thanks :)
 

Mitthrawnuruodo

Moderator emeritus
Mar 10, 2004
14,424
1,065
Bergen, Norway
Which tool do you use for web development?

In DreamWeaver (and alike) you can use templates that in many ways works similar to php includes (though I didn't get it to work properly in Nvu).

If you use TextWrangler or another of the more powerful text editors, there are quite good, but somewhat complicated find/replace/insert functions...
 

dubbz

macrumors 68020
Sep 3, 2003
2,284
0
Alta, Norway
Isn't there a HTML function that allow you to embed one page (or whatever) into another page?

I had a look at it when I was in a similar situation, but I can't seem to remember what it was....

Edit: Right, it was the OBJECT and IFRAME elements.

I never got around to using them, so I'm not sure how it actually works. I've heard some bad things about IFRAME, but it might be worth a shot.

I don't know if they can be used in your situation.
 

kgarner

macrumors 68000
Jan 28, 2004
1,512
0
Utah
If you can't use PHP, do you have the ability to use Server-Side-Includes. I can't remember the proper syntax for it, but I know that they are fairly simple to use and would, IMHO, be a better solution than IFRAMES and such.
 

Mike Teezie

macrumors 68020
Nov 20, 2002
2,205
1
What's wrong with using iframes?

I'm asking because I've never had any problems using them, and am curious to learn.
 

Nermal

Moderator
Original poster
Staff member
Dec 7, 2002
20,640
4,039
New Zealand
The iframe tag worked perfectly :)

Now I've run into another problem :(
I have three photos, which I want to display side-by-side, spanning the width of the browser window. I currently have the following code:

Code:
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td valign="top"><img border="0" src="images/thumbnails/whaleislandthumb.jpg" width="100%" height="100%" alt="Whale Island" /></td>
    <td width="40" valign="top" />
    <td valign="top"><img border="0" src="images/thumbnails/playgroundthumb.jpg" width="100%" height="100%" alt="Playground" /></td>
    <td width="40" valign="top" />
    <td valign="top"><img border="0" src="images/thumbnails/eastendthumb.jpg" width="100%" height="100%" alt="East End" /></td>
  </tr>
</table>

This works in IE/Win and Camino, but not in Safari or Firefox/Win (haven't tried Mac). In IE and Camino, the photos appear, and they resize dynamically when you resize the browser window. In FF they don't appear at all, until you press Reload, at which point they work fine. In Safari they never appear at all, although they're listed as being loaded in the Activity window :confused:

Help! :)

Edit: I've isolated the code into its own HTML file with no CSS or anything getting in the way. I still get the same results. I ran the code through the W3C validation tool, and it's happy with it.
 

Mitthrawnuruodo

Moderator emeritus
Mar 10, 2004
14,424
1,065
Bergen, Norway
What if you give the images width=33% and height=33% instead of 100%. According to the html specification image sizes in percent are based on available space and not the images sizes, and with 3 images they should take 1/3 each and not all... shouldn't they...?
 

Nermal

Moderator
Original poster
Staff member
Dec 7, 2002
20,640
4,039
New Zealand
Mitthrawnuruodo said:
What if you give the images width=33% and height=33% instead of 100%.

Already tried that :)

The percentage seems to be based on the cell, not the window. Using 33% just makes the photos take up 1/3 of the space of the cell. Here's a pic with borders enabled, so you can see what I mean (this was taken from in Camino, where it usually works).
 

Attachments

  • Picture 1.png
    Picture 1.png
    37.1 KB · Views: 298

Nermal

Moderator
Original poster
Staff member
Dec 7, 2002
20,640
4,039
New Zealand
I was just thinking about that, I'm in the middle of trying it now :)

Edit: It didn't have the desired effect. They're all thin!

Edit 2: Aha! I took them out of the table completely, and now it's working perfectly :D

Thanks for all your help :)
 

Attachments

  • Picture 3.png
    Picture 3.png
    9.9 KB · Views: 289

kgarner

macrumors 68000
Jan 28, 2004
1,512
0
Utah
Mike Teezie said:
What's wrong with using iframes?

I'm asking because I've never had any problems using them, and am curious to learn.
Frames are tricky things to use. They are really clever and can be used for very good reasons, but they do introduce problems too. For one thing they make it difficult to print a page as you can only print the active frame. Bookmarking the page can be odd as well for the same reason

They work well for adding in small pieces and such (Amazon uses them for sponsored ads for example) but I, personally, don't like to use them for page layout. Not saying they are bad, you just have to weigh the good and bad aspects based on your design.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.