Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Site Structure

Featured Replies

Hi,

 

I'm trying to find the best way to structure my pages so that I do not have to repeat the same info over and over again.

 

This applies to menus, formating, etc.

 

First I've used simple HTML, then the layout was done with tables. Still had to update the main menu on every single page.

 

Recently I found out about <i frame> :

<iframe src="title.htm" width="100%" height="120" scrolling="no" frameborder="0"> </iframe>

<iframe src="menu.htm" width="100%" height="60" scrolling="no" frameborder="0"> </iframe>

<iframe name="main" src="main.htm" width="100%" height="2000" scrolling="no" frameborder="0"> </iframe>

 

But apparently the best way to layout your pages is with CSS.

 

How do I use CSS to layout pages without having to repeat the menu and sidebars on every page?

 

Or do I have to use a server side tecnology to incorporate various "content" pages?

 

Thanx

You can't do that using CSS.

 

The easiest way would be to use PHP includes. Then you can have a seperate file for your menu etc.

  • Author

I'm still to learn about PHP. But could I layout the pages using PHP as you do with CSS?

 

(Something like the attached image: header plus 3 column layout and footer)

post-6380-1217071681_thumb.gif

You use HTML to create the content of your webpages, you use CSS to create the layout and style of your pages, and you can use PHP includes to avoid redundancy of code such as headers, navigation menus, footers etc. (which your right, makes updating those sections far easier as you only have to update one file).

 

If you don't want to use PHP you can also use SSI (server side include statements) which most servers have installed.

  • Author

I think I'd better start learning PHP.

 

I'm sure it will come in handy in the future.

 

Many Thanks for your help!

I would recommend making sure you know the fundamentals of HTML and CSS before you learn PHP though!

 

also the PHP includes statements could be used before any real programming is learnt, there are plenty of simple tutorials online.

Hello :hi: Rui Carvalho

 

I was wanting to do the same thing in one of my previous projects. I don't know PHP, but this include function is very simple! Here is how you can do it.

 

Once you have created your menu, for example

 

<a href="http://www.example.com/index.php">Home</a>
<a href="http://www.example.com/about.php">About Us</a>
<a href="http://www.example.com/links.php">Links</a>
<a href="http://www.example.com/contact.php">Contact Us</a> <br />

 

You would save that code into your empty PHP file. (menu.php)

 

Add this small PHP code into your main page where you want your menu to be.

 

<?php include("menu.php"); ?>

 

This will echo the content of the menu.php which will be your menu, I hope this helps you!

  • Author

Fantastic! It does work!

 

However all the other pages have the extension .htm and not .php.

 

So the links go nowhere.

 

Can I just change the extension on the other html files to .php?

 

Do I have to do that throughout the site?

 

This is the (very basic) site url by the way (english version comming soon):

 

http://kenpo.home.sapo.pt/

However all the other pages have the extension .htm and not .php.

 

So the links go nowhere.

 

Can I just change the extension on the other html files to .php?

 

Do I have to do that throughout the site?

 

Yes, All the pages you add the include function will need to have a .php extention so simply change them, Remember you will need to update the links extentions in menu.php. :good:

 

Nice site btw.

Edited by dav

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.