5 Replies - 3388 Views - Last Post: 09 September 2006 - 06:47 PM Rate Topic: -----

#1 Mexochino  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 14-August 06

can someone help me with PHP include command for formatting and templa

Posted 04 September 2006 - 02:59 AM

Hello, I really need help with PHP. I am trying to use the include function on my html page. I heard the include() function is used alot so that I don't have to keep on making the same exact page over and over with just some content change. many sites use this to make a template with all the graphics and then end up putting the include() command where the content goes.

does anyone know the code and how to make the links? im in quite the pickle... please help

what i have so far is

<? php
include('content.php)
?>

I have this in my html code where my content is supposed to be, but for some reason it does not load the content.

This post has been edited by Mexochino: 04 September 2006 - 03:01 AM


Is This A Good Question/Topic? 0
  • +

Replies To: can someone help me with PHP include command for formatting and templa

#2 snoj  Icon User is offline

  • Married Life
  • member icon

Reputation: 84
  • View blog
  • Posts: 3,564
  • Joined: 31-March 03

Re: can someone help me with PHP include command for formatting and templa

Posted 04 September 2006 - 08:28 AM

You have it right expect for you're missing a ' and there should be a space between <? and php.
<?php
include('somefile.html');
?>

Was This Post Helpful? 1
  • +
  • -

#3 BetaWar  Icon User is offline

  • #include "soul.h"
  • member icon

Reputation: 1147
  • View blog
  • Posts: 7,134
  • Joined: 07-September 06

Re: can someone help me with PHP include command for formatting and templa

Posted 09 September 2006 - 10:20 AM

I am not sure if you have a tyo or not, but the include function (at least I believe) only works with .php or .txt files meaning that it won't work with a .html file.
Was This Post Helpful? 0
  • +
  • -

#4 max302  Icon User is offline

  • Proud supporter of the lulz
  • member icon

Reputation: 2
  • View blog
  • Posts: 1,281
  • Joined: 05-March 06

Re: can someone help me with PHP include command for formatting and templa

Posted 09 September 2006 - 10:57 AM

I understand what you are saying. Unlike ASP where you can just say to the engine "execute this file here", php is object oriented, so you have to make up a function to spit out stuff. Show us content.php and we'll be able to give you more help.
Was This Post Helpful? 0
  • +
  • -

#5 snoj  Icon User is offline

  • Married Life
  • member icon

Reputation: 84
  • View blog
  • Posts: 3,564
  • Joined: 31-March 03

Re: can someone help me with PHP include command for formatting and templa

Posted 09 September 2006 - 12:48 PM

include, include_once, require, and require_once work on any file....even html. Basically what it does is bring that file and treats it as if the contents of the included file were part of the calling file.

Also, php isn't "object oriented", it's procedural, with OO styles of coding.
Was This Post Helpful? 1
  • +
  • -

#6 max302  Icon User is offline

  • Proud supporter of the lulz
  • member icon

Reputation: 2
  • View blog
  • Posts: 1,281
  • Joined: 05-March 06

Re: can someone help me with PHP include command for formatting and templa

Posted 09 September 2006 - 06:47 PM

View Posthotsnoj, on 9 Sep, 2006 - 12:48 PM, said:

Also, php isn't "object oriented", it's procedural, with OO styles of coding.

Oops my bad, I guess that I'll read the wikipedia article on PHP.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1