Closed Thread Icon

Topic awaiting preservation: SSI questions (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=24292" title="Pages that link to Topic awaiting preservation: SSI questions (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: SSI questions <span class="small">(Page 1 of 1)</span>\

 
redroy
Nervous Wreck (II) Inmate

From: 1393
Insane since: Dec 2003

posted posted 12-04-2004 08:27

Hi, just a couple silly questions if you've got the time. I was just wondering what the differnce is between <?php include("page.php"); ?> and <?php require("page.php"); ?>. Also, when using an include is it OK to put it anywhere on the page? For example, I want to use an include to define the <link> tag... So on all my pages I'll have something like <?php include("styleSheet.php"); ?> just below the <title> tags and then styleSheet.php would have one line <link href="style.css" rel="stylesheet" type="text/css">. That way I can build multiple layouts and then change them out when I want to (as opposed to user selection). Thanks!

edit: sorry, just realized I'm on the wrong board...



(Edited by redroy on 12-04-2004 08:28)

Ramasax
Paranoid (IV) Inmate

From: PA, US
Insane since: Feb 2002

posted posted 12-04-2004 09:16

You're on the wrong board err forum!!

I am hardly a PHP pro in any sense of the word, but I'll give this one a go. Yes you can use php includes in any part of a page. I usually have a metatag include which includes everything in the header, minus the title.

A quick search answered your other question. Google is your friend.

quote:
require() and include() are identical in every way except how they handle failure. include() produces a Warning while require() results in a Fatal Error. In other words, don't hesitate to use require() if you want a missing file to halt processing of the page. include() does not behave this way, the script will continue regardless. Be sure to have an appropriate include_path setting as well. source



Ramasax

redroy
Nervous Wreck (II) Inmate

From: 1393
Insane since: Dec 2003

posted posted 12-04-2004 09:21

Thanks Ramasax!

Tyberius Prime
Paranoid (IV) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

posted posted 12-04-2004 11:44

though a lot of includes are going to be slow - the server has to locate each and every file every time.

Hebedee
Paranoid (IV) Inmate

From: Maryland, USA
Insane since: Jan 2001

posted posted 12-05-2004 20:55

A better idea would be to define a function that outputs the segment you want to display when you include that section. Then you only need one require_once or require function.

redroy
Nervous Wreck (II) Inmate

From: 1393
Insane since: Dec 2003

posted posted 12-10-2004 04:17

^^ a php function?

Hebedee
Paranoid (IV) Inmate

From: Maryland, USA
Insane since: Jan 2001

posted posted 12-11-2004 05:01

Yes.

Skaarjj
Maniac (V) Mad Scientist

From: :morF
Insane since: May 2000

posted posted 12-11-2004 12:06

well, considering that the title of this thread is SSI questions, should it not be changed; it is, after all, about PHP, not SSI...


Justice 4 Pat Richard

redroy
Bipolar (III) Inmate

From: 1393
Insane since: Dec 2003

posted posted 12-11-2004 17:20

Hebedee, mind giving me an example? Skaarjj, I thought SSI was "Server Side Include" for whatever you're using to control the include. Is "SSI" generic to only one language?

Steve
Maniac (V) Inmate

From: Boston, MA, USA
Insane since: Apr 2000

posted posted 12-11-2004 22:12

SSI does in fact stand for Server Side Include.
PHP and SSI can do some of the same things, but they are different. PHP is far more comprehensive in it's capabilities and in fact really is a scripting language. SSI can be very handy, and I think pre-dated PHP, but they aren't the same thing and can't be referred to interchangeably.

DL-44
Maniac (V) Inmate

From: under the bed
Insane since: Feb 2000

posted posted 12-12-2004 00:31

I don't know anything about the technicalities involved....but, "SSI", from my understanding is a specific reference to Apache's "Server Side Includes", BUT, the generic phrase 'server side includes' is still very appropriate in this case - it is a server side language being used for the purpose of includes...it's just not specifically "SSI".

If that makes sense....

« BackwardsOnwards »

Show Forum Drop Down Menu