Jump to content

What system for linking Navigation

Server side includes, snippets etc.

  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • This topic is locked

What system for linking Navigation Server side includes, snippets etc. Rate Topic: -----

#1 User is offline   Steven Gardner 

  • W.R. Corporal
  • Group: Members
  • Posts: 160
  • Joined: 17-September 07
  • Gender:Male
  • Location:Fife, Scotland

Posted 22 April 2008 - 06:39 AM

Hi guys,

I have a very basic but important question i need answered before i do any more sites.

When designing a site what xhtml system do you use for your navigational links. I have used server side includes when designing php sites and that works fine. Never used template design and snippets are to much work if i change something.

The reason i ask is i have worked for a long time really small sites just bundling my way through them updating links on every page when needed. I need to have a more efficiant way of updating nav links in my sites.

I now its a very basic question but i am a very simple person.

:confused1:
0

#2 User is offline   supasnail 

  • W.R. Corporal
  • Group: Members
  • Posts: 112
  • Joined: 19-September 07

Posted 22 April 2008 - 08:01 AM

I tend to use PHP - I have a general header which gets called by php include and that will incorporate the navigation. If I need to duplicate the navigation (i.e for a mobile website) then I separate the Navigation into its own file that I then call using an additional php include.
You can do the same with ASP or course.
0

#3 User is offline   Steven Gardner 

  • W.R. Corporal
  • Group: Members
  • Posts: 160
  • Joined: 17-September 07
  • Gender:Male
  • Location:Fife, Scotland

Posted 22 April 2008 - 08:06 AM

Does that work with .html files or only .php
0

#4 User is offline   supasnail 

  • W.R. Corporal
  • Group: Members
  • Posts: 112
  • Joined: 19-September 07

Posted 22 April 2008 - 08:12 AM

View PostSteven Gardner, on Apr 22 2008, 02:06 PM, said:

Does that work with .html files or only .php

You can include html files - but the file calling for the include-file must be PHP. There's probably a javascript method of calling external files - but I don't like to use javascript for such fundamental things. If javascript is turned off, the page breaks.
0

#5 User is offline   Steven Gardner 

  • W.R. Corporal
  • Group: Members
  • Posts: 160
  • Joined: 17-September 07
  • Gender:Male
  • Location:Fife, Scotland

Posted 22 April 2008 - 08:29 AM

Please post a code example!

I have read i think on the sitepoint website that i can use

<!--#include file="nav.txt" -->

but it doesnt work. answer i read maybe use "virtual" instead of "file" something to do with servers. tried this but still doesnt work.
0

#6 User is offline   marcamos 

  • W.R. General
  • Group: Administrators
  • Posts: 2,849
  • Joined: 04-April 06
  • Gender:Male
  • Location:Massachusetts - USA

Posted 22 April 2008 - 08:31 AM

You can also use nothing but html files, everywhere, and tell the server to parse all .html files as if they were .php. This often happens when an older site, whose files are only .html, has built up quite a bit of PR and doesn't want to change URL paths and/or file names, but needs to be converted to PHP.

Read more here: http://www.google.co...rse+html+as+php (The second and third results look nice)
0

#7 User is offline   supasnail 

  • W.R. Corporal
  • Group: Members
  • Posts: 112
  • Joined: 19-September 07

Posted 22 April 2008 - 08:32 AM

View PostSteven Gardner, on Apr 22 2008, 02:29 PM, said:

Please post a code example!

I have read i think on the sitepoint website that i can use

<!--#include file="nav.txt" -->

but it doesnt work. answer i read maybe use "virtual" instead of "file" something to do with servers. tried this but still doesnt work.


that code is for asp, in php it would read...

<?php include('nav.txt'); ?>

This post has been edited by supasnail: 22 April 2008 - 08:34 AM

0

#8 User is offline   Karl Buckland 

  • A.K.A. Sirkent
  • Group: Administrators
  • Posts: 2,145
  • Joined: 04-April 06
  • Gender:Male
  • Location:Kent, UK

Posted 22 April 2008 - 08:44 AM

View Postsupasnail, on Apr 22 2008, 02:32 PM, said:

that code is for asp, in php it would read...

<?php include('nav.txt'); ?>


No, I believe it's not ASP - it's straight SSI (server side includes). Unless I'm mistaken?
QUOTE(benbramz @ Aug 17 2007, 07:44 AM) Ive noticed that quite a few people are now adding quotes from the board into their signature. I think its started an new web-radiance craze.. :P
0

#9 User is offline   Steven Gardner 

  • W.R. Corporal
  • Group: Members
  • Posts: 160
  • Joined: 17-September 07
  • Gender:Male
  • Location:Fife, Scotland

Posted 22 April 2008 - 05:08 PM

Anyone got working info for how to activate SSI on apache for Mac Leopard I have tried a couple of things but no luck. I think Its not activated because i cannot get any ssi to work.

I will trawl through google results but any idvice would be great.

Cheers
0

#10 User is offline   supasnail 

  • W.R. Corporal
  • Group: Members
  • Posts: 112
  • Joined: 19-September 07

Posted 22 April 2008 - 05:09 PM

Do you not have php on your server?
0

#11 User is offline   Steven Gardner 

  • W.R. Corporal
  • Group: Members
  • Posts: 160
  • Joined: 17-September 07
  • Gender:Male
  • Location:Fife, Scotland

Posted 22 April 2008 - 05:27 PM

View Postsupasnail, on Apr 22 2008, 11:09 PM, said:

Do you not have php on your server?


Yeah i have downloaded the MAMP server kit

using PHP Version 4.4.7

I have read that that i may have to manually activate SSI when using Leopard.

PHP includes work if i save my files as .PHP but i want to use .HTML files and i cant get SSI to work anyhow.

This post has been edited by Steven Gardner: 22 April 2008 - 05:32 PM

0

#12 User is offline   supasnail 

  • W.R. Corporal
  • Group: Members
  • Posts: 112
  • Joined: 19-September 07

Posted 22 April 2008 - 05:32 PM

are you using

<?php include('myfile.html'); ?>


to call your file?

That should work out of the box with MAMP I would have thought.
0

#13 User is offline   Steven Gardner 

  • W.R. Corporal
  • Group: Members
  • Posts: 160
  • Joined: 17-September 07
  • Gender:Male
  • Location:Fife, Scotland

Posted 22 April 2008 - 05:53 PM

View Postsupasnail, on Apr 22 2008, 11:32 PM, said:

are you using

<?php include('myfile.html'); ?>


to call your file?

That should work out of the box with MAMP I would have thought.



Yeah but nothing happens until i save my file to .php from .html
0

#14 User is offline   supasnail 

  • W.R. Corporal
  • Group: Members
  • Posts: 112
  • Joined: 19-September 07

Posted 22 April 2008 - 05:58 PM

View PostSteven Gardner, on Apr 22 2008, 11:53 PM, said:

Yeah but nothing happens until i save my file to .php from .html

Yes - that's what I said with my first reply this morning lol. You can call an html file - but the file calling the include must be .php (unless, as herkalees mentioned, the server was set up to allow .html to be read as .php).

Is there a reason you need to name your files .html?

This post has been edited by supasnail: 23 April 2008 - 02:08 AM

0

#15 User is offline   Steven Gardner 

  • W.R. Corporal
  • Group: Members
  • Posts: 160
  • Joined: 17-September 07
  • Gender:Male
  • Location:Fife, Scotland

Posted 22 April 2008 - 06:11 PM

Thanks supasnail. I guess i didnt quite understand your first post. I understand now. I know how to use SSI Php style its the .HTML SSI thats the problem.
Is .html not the best file format for search engines and is the standard format?

It doesnt have to be HTML. I guess i will continue building php pages. I just wanted to start all new sites as XHTML strict as possible and thought all pages with no scripts should be .html
0

#16 User is offline   supasnail 

  • W.R. Corporal
  • Group: Members
  • Posts: 112
  • Joined: 19-September 07

Posted 22 April 2008 - 06:19 PM

The file extension doesn't make any difference to search engines as far as I'm aware. All of the scripts in a php file are run on the server, so all that's delivered to the webpage is an flat (x)html file - albeit with a php extension. As long as your xhtml is valid and the files you are calling as includes are valid - then there's no problem. You'll find that many of the highest ranking websites on the web are blogs - all written in php ;). Don't worry.
0

#17 User is offline   haku 

  • 日本語 Ninja
  • Group: Members
  • Posts: 652
  • Joined: 21-September 07
  • Gender:Male
  • Location:Yokohama, Japan

Posted 22 April 2008 - 08:48 PM

Or if you are really determined to have your files end in an .html extension, you can use the method that Herkalees posted a link for. This tells the server to parste .html files as php. In doing this you can add php commands to an html file and the server will process them. Apparently you take a slight hit on speed by doing this though, as the script has to be run through the parser instead of being sent straight to the browser as is.

I use the technique that Herkalees posted, but not to parse my .html files as php, but rather just to hide that I am using php. Its a slight security move. I parse my personal files using my first name (which is 3 letters) as the file extension. At work, I use an abbreviation of our company name. You cannot tell that either of them are php, but they both are.
<a href="http://www.jaypan.com" target="_blank">Jaypan</a>
<a href="http://www.dudes-japan.com" target="_blank">Dudes Japan</a>
0

#18 User is offline   Karl Buckland 

  • A.K.A. Sirkent
  • Group: Administrators
  • Posts: 2,145
  • Joined: 04-April 06
  • Gender:Male
  • Location:Kent, UK

Posted 23 April 2008 - 02:53 AM

It's been some time since I did this, but an online tutorial suggests creating a .htaccess file in the top directory where you want .html files to be processed for SSI.

The .htaccess file should contain:
		Options +Includes
		AddType text/html .html
		AddHandler server-parsed .html

QUOTE(benbramz @ Aug 17 2007, 07:44 AM) Ive noticed that quite a few people are now adding quotes from the board into their signature. I think its started an new web-radiance craze.. :P
0

#19 User is offline   Steven Gardner 

  • W.R. Corporal
  • Group: Members
  • Posts: 160
  • Joined: 17-September 07
  • Gender:Male
  • Location:Fife, Scotland

Posted 23 April 2008 - 08:03 AM

I have decided to stick to what i know and develop pages using .php format so i can use php ssi.

Cheers for the help and guidence
0

#20 User is offline   cool sam 

  • W.R. Private
  • Group: Members
  • Posts: 10
  • Joined: 19-September 08

Posted 19 September 2008 - 01:33 AM

Hi
PHP is the answer from my side.
0

Share this topic:


  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • This topic is locked

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users