Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Closed Thread
Old 10-15-2004, 07:16 PM   #1 (permalink)
 
Super Techie

Join Date: Sep 2003

Posts: 386

chesman

Send a message via ICQ to chesman Send a message via Yahoo to chesman
Default the PHP tag 'Include'

i have come across this one in my research, and i was just wondering how it logiclly works.

So you setup a page with tables or frames and just put that tag in there to call another html or php page?

can anyone give me some sort of example? because well, you can't view the sorce of pages with this going since it only shows you what it is in html.

:/

thanks!

__________________
WinXP Pro
P4 2.5 Ghz/socket 478/400FSB/512L2
512 megs PC800 Rambus
ABIT TH7II-Raid mobo
128MB Nvidia FX 5200 Home Theatre w/TV out and Remote
80 Gig Western Digital/8mb Cache/7200 RPM\'s
20 gig Fujitsu/2mb Cache/5400 RPM\'s
48x40x48/16X Dvd/CD-Burner
chesman is offline  
Old 10-18-2004, 05:50 PM   #2 (permalink)
 
Super Techie

Join Date: Apr 2004

Posts: 316

BlazingWolf

Default

Viewing the source will always only give you the raw HTML after any PHP, ASP, or any other code has been executed.

The include works just as one would think it does. It includes another php page wherever you put the include call in the page.

EX: http://dojo.motionless-continuum.com/ All the stuff in the lower right hand box, and the news, and other content is all being include from other files. When you press a different button it includes a different page in that box.

The actual code just goes like this(granted this code would not work)

<mytable>

<myrow>
blah
</myrow>
<myotherrow>
<?php include('myotherpage.php');
</otherrow>
</mytable>

The Inlcuded page would show up in the second row of the table.
__________________
BlazingWolf
<font color=\'red\'>
<b>
<a href=\'http://www.gaming-forums.org\'>
Gaming-Forums.org
<a/>
</b>
</font>
BlazingWolf is offline  
Old 10-18-2004, 06:07 PM   #3 (permalink)
 
Monster Techie

Join Date: May 2004

Location: Tucson, AZ, USA

Posts: 1,183

Vormund

Send a message via AIM to Vormund Send a message via MSN to Vormund Send a message via Yahoo to Vormund
Default

Yeah, what he said

And it does not have to be just a .php extension--it can be virtually any, but yeah--PHP, TXT, HTML etc. are the most frequently used (probably in that order). There are also three other closely related terms:
include_once - will only include it if it has not been previously included in the document
require - the page/script will literally die if the page to be "included" is not there
require_once - will oly include it if it has not been previously included in the document AND it exists -- else as require, it will die.

PHP.net about the include function:
http://us2.php.net/manual/en/function.include.php

a simple example:

item.php
<?php
$fruit = "apple";
?>

show.php
<?php
include "item.php";
echo $fruit;
?>

Running "show.php" would output simply output:
Apple

Basically reiterated what he just said, but yeah, I'm bored: )
__________________
Vormund is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On