There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
black screen blue screen boot bsod computer connection crash css dell display driver drivers email error explorer firefox firefox 3 hard drive internet internet explorer itunes laptop lcd malware monitor network networking nvidia outlook outlook 2003 outlook express password printer problem problems ram router security slow software sound sprtcmd.exe trojan usb video virus vista windows windows xp wireless
Web Design & Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Internet & Networking > Web Design & Development >
Simple Question about PHP


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

Closed Thread
 
Thread Tools
techy689's Avatar
Computer Specs
Senior Member with 598 posts.
 
Join Date: Jan 2007
Location: OH, USA
09-Jan-2008, 11:12 PM #1
Simple Question about PHP
I am trying to redo my site using PHP (a complete beginner).

I have created a template.php file, an index.php file, and a footer.php file. The index.php file will simply refer to the template and footer and consist of the main body only.

This is what I have set up for a typical page:

Quote:

<?
include("./template.php");
head();
?>

content here....

<?
tail();
?>
how would i integrate a footer.php into this (where do i put it?)
__________________
Experience is a hard teacher because she gives the test first, the lesson afterward.
techy689's Avatar
Computer Specs
Senior Member with 598 posts.
 
Join Date: Jan 2007
Location: OH, USA
09-Jan-2008, 11:20 PM #2
Maybe I should just start over and someone can help me with this.

I want one template.php which is blank but contains the layout and size. It has a php include for the header, footer, left side, and right side.

Then I will have to do the php for the header, footer, left menu, right menu, and index.php will end up being where i place the content for that page in...
__________________
Experience is a hard teacher because she gives the test first, the lesson afterward.
MMJ's Avatar
MMJ MMJ is offline
Distinguished Member with 3,252 posts.
 
Join Date: Oct 2006
10-Jan-2008, 05:17 AM #3
I really don't understand the problem.
MaidenFan's Avatar
Computer Specs
Member with 67 posts.
 
Join Date: Oct 2006
Location: Wales, UK
Experience: Intermediate
10-Jan-2008, 09:06 AM #4
This is what I find is the easiest way to skin a site with PHP - it may not be the best, but it's the way that makes most sense to me .

I start off by creating a static XHTML "skin" page - i.e. a page which has the basic design and no main content at all and includes all sidebars and navigation panes.

I then split this off into two include files (I use the extension .inc but you can use anything) and place them in a directory (I call it includes) - page-footer.inc and page-header.inc. You can just snip the code at the point where the content will start and finish.

You can then include them into your PHP code by doing this:

Quote:
<php require('includes/page-header.inc'); ?>

<!-- Your main page content -->

<php require('includes/page-footer.inc'); ?>
Using the require function means that if you accidentally try to include the headers somewhere else, you'll only end up with one call.
__________________
Up the 'Kin Irons!

Personal Site - www.cwatson.org
Freelance Web Design - www.sonicadesign.com
techy689's Avatar
Computer Specs
Senior Member with 598 posts.
 
Join Date: Jan 2007
Location: OH, USA
11-Jan-2008, 11:41 PM #5
I figured out what I wanted to do, thanks

This is what I have as an page using the include feature:

<?php
include 'http://www.example.com/includes/header.php';
?>

However, I have noticed that it only works when I do it like tbe above. If I make it local like below, it does not work:

<?php
include '/includes/header.php';
?>

anyone know why this is?
__________________
Experience is a hard teacher because she gives the test first, the lesson afterward.
MMJ's Avatar
MMJ MMJ is offline
Distinguished Member with 3,252 posts.
 
Join Date: Oct 2006
12-Jan-2008, 01:14 AM #6
If you use the first method than any PHP code in header.php will be executed before-hand.

Do you get any errors? What do you have in header.php?
Closed Thread

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who help people like you solve computer problems. See our Welcome Guide to get started.



Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 11:05 AM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.