473,380 Members | 1,362 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,380 software developers and data experts.

PHP - Can I nest includes?

Ok. Can I include a PHP file from a file that has been included.
From the example below, I have a start PHP page with an include to a
type of template page, and from page 2, I include a 3rd page. The
first include works, but the page 3 is brought in as standard text.
Is this a PHP limitation, or do I need to make a change to the PHP
config. file?

Thanks


(Page1)

<? include("page2.php"); ?>

(Page2)

<html>

<head>
<title>Sans Titre</title>
<meta http-equiv="content-type" content="text/html;
charset=iso-8859-1" />
<meta name="generator" content="HAPedit 3.1">
</head>
<body bgcolor="#FFFFFF">
<?
// Your code here
echo "<hr />\n".
"HAPedit 3.1.11.111 (September 2005 7:03:30 PM)<p>";
?>
requires("page3.php");
</body>

</html>
(Page3)

<?
$x = 100;
echo $x." This is a test";
?>

Sep 13 '05 #1
1 2096
NC
David wrote:

Can I include a PHP file from a file that has been included.
Yes.
From the example below, I have a start PHP page with an include to a
type of template page, and from page 2, I include a 3rd page. The
first include works, but the page 3 is brought in as standard text.
Well, I am surprised anything is including at all... Take a look:
(Page2)
<html>
<head>
<title>Sans Titre</title>
<meta http-equiv="content-type" content="text/html;
charset=iso-8859-1" />
<meta name="generator" content="HAPedit 3.1">
</head>
<body bgcolor="#FFFFFF">
<?
// Your code here
echo "<hr />\n".
"HAPedit 3.1.11.111 (September 2005 7:03:30 PM)<p>";
?>
requires("page3.php");
</body>
</html>


First of all, it it not requires(), but require(). Second, your
require() statements is outside of any PHP block and inside an
HTML block; it shouldn't have been executed at all...

Cheers,
NC

Sep 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: terry | last post by:
Hi, Is it legal or formal to nest tag names? My code is in the following. The <name> is nested. I used java to read the xml file but it seems to not know the nested structure. I need to write...
1
by: darrel | last post by:
I know you CAN'T nest templates, so what would be the logic to use otherwise? Here's what I am doing: I have a template set to match a specific node based on one of it's elements. If it...
1
by: Chad | last post by:
I want to nest a grid within a MS Treeview ASP Web Control. It seems that I cannot add controls to a nodes Controls collection, however, I can put HTMLText in the Node.Text property of a Node...
1
by: edu | last post by:
there some way to nest transactions with bd destination sql server? thank you
4
by: Dave | last post by:
If so, what is wrong with this code in APS 3.0? I open a recordset with order info. Each record contains the order header info plus a line item from the order detail. So the recordset looks...
4
by: Tim Streater | last post by:
Not sure is this is quite the right NG, but anyway: I have rows in a table which I want to have represent nested data, which I want to show and hide. I can hide a row easily enough by doing: ...
3
by: Steven Nagy | last post by:
Hi all, ASP.NET : Framework 2.0 - C# A recent addition to my code generater will create GridView's and ObjectDataSource's in a control (ASCX). So the code gen creates an ascx, ascx.cs,...
10
by: Al | last post by:
Hi all, (Apologies if this is in a FAQ somewhere, I couldn't find anything). Almost every time I do any significant amount of coding in C or C++, I end up wishing C-style comments would nest....
4
by: sathishc58 | last post by:
Hi All I am new to this group. Please explain the following program. I ran this program under Sun OS. Here is the program. typedef struct emp {
2
kmartinenko
by: kmartinenko | last post by:
Hi, I am very new to Python and I would like to know if it is possible to nest 'for' statements? The question precipitates from a certain problem I am having with running a simple calculation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.