473,396 Members | 2,050 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,396 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 2098
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...
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: 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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.