SitePoint Sponsor |
|
User Tag List
Results 1 to 3 of 3
Thread: Help Me With Includes
-
Jun 20, 2007, 23:21 #1
- Join Date
- Feb 2006
- Posts
- 299
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Help Me With Includes
Hello everyone,
I have a problem with includes. Iam using php includes in the applications Iam devloping. The problem is that one include is bring it's page in the main page and that makes the page to be too long.
How can I use this include with out it bringing all its content in the main page.
1. This is the Main page
-This is the page that is calling tree.php file, but I want just to use menu on tree.php and lot allowing the tree.php to display the it content on the main page and make it long. I mean source code in the browser.
table class= menutable width="195" border="1" align="left" cellpadding="0" cellspacing="0" bordercolor="#1F1E58">
<tr>
<td width="191" bgcolor="#181C5A"><span class="style1">
<?php require_once"tree.php"; ?></span></td>
</tr>
</table>
2. Include Page
<html>
<head>
<title>Webtestcon</title>
<link rel='stylesheet' href='tree.css'>
<script language="javascript" src="tree.js"></script>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table border=0 cellpadding='10' cellspacing=0><tr><td>
<table border=0 cellpadding='1' cellspacing=1><tr><td width='16'><a id="xproducts" href="javascript:Toggle('products');"><img src='folder.gif' width='16' height='16' hspace='0' vspace='0' border='0'></a></td><td><b>Menu</b></table>
<div id="products" style="display: none; margin-left: 2em;">
<table border=0 cellpadding='1' cellspacing=1><tr><td width='16'><img src='text.gif' width='16' height='16' hspace='0' vspace='0' border='0'></td><td><a href="index.php" target="master">Home</a></td></tr></table>
<table border=0 cellpadding='1' cellspacing=1><tr><td width='16'><img src='text.gif' width='16' height='16' hspace='0' vspace='0' border='0'></td><td><a href="tender.php" target="master">Tender</a></td></tr></table>
<table border=0 cellpadding='1' cellspacing=1><tr><td width='16'><a id="xspecs" href="javascript:Toggle('specs');"><img src='folder.gif' width='16' height='16' hspace='0' vspace='0' border='0'></a></td><td><b>Structure</b></table>
<div id="specs" style="display: none; margin-left: 2em;">
<table border=0 cellpadding='1' cellspacing=1><tr><td width='16'><img src='text.gif' width='16' height='16' hspace='0' vspace='0' border='0'></td><td><a href="commissionergen.php" target="master">Directors</a></td></tr></table>
<table border=0 cellpadding='1' cellspacing=1><tr><td width='16'><img src='text.gif' width='16' height='16' hspace='0' vspace='0' border='0'></td><td><a href="corporateservices.php" target="master">Corporate Services</a></td></tr></table>
<table border=0 cellpadding='1' cellspacing=1><tr><td width='16'><img src='text.gif' width='16' height='16' hspace='0' vspace='0' border='0'></td><td><a href="domesticproducts.php" target="master">Domesticproducts</a></td></tr></table>
<table border=0 cellpadding='1' cellspacing=1><tr><td width='16'><img src='text.gif' width='16' height='16' hspace='0' vspace='0' border='0'></td><td><a href="customers.php" target="master">Customers</a></td></tr></table>
</div>
<table border=0 cellpadding='1' cellspacing=1><tr><td width='16'><img src='text.gif' width='16' height='16' hspace='0' vspace='0' border='0'></td><td><a href="jobs.php" target="master"> Jobs</a></td></tr></table>
</div>
<table border=0 cellpadding='1' cellspacing=1><tr><td width='16'><a id="xsupport" href="javascript:Toggle('support');"><img src='folder.gif' width='16' height='16' hspace='0' vspace='0' border='0'></a></td><td><b>Other Links</b></table>
<div id="support" style="display: none; margin-left: 2em;">
<table border=0 cellpadding='1' cellspacing=1><tr><td width='16'><img src='text.gif' width='16' height='16' hspace='0' vspace='0' border='0'></td><td><a href="http://www.bbc.com" target="master">BBC</a></td></tr></table>
<table border=0 cellpadding='1' cellspacing=1><tr><td width='16'><img src='text.gif' width='16' height='16' hspace='0' vspace='0' border='0'></td><td><a href="http://www.zi.com" target="_blank">Comde</a></td></tr></table>
<table border=0 cellpadding='1' cellspacing=1><tr><td width='16'><img src='text.gif' width='16' height='16' hspace='0' vspace='0' border='0'></td><td><a href="http://www.mitts.com" target="_top">Mitts</a></td></tr></table>
</div>
<table border=0 cellpadding='1' cellspacing=1><tr><td width='16'><a id="xcontact" href="javascript:Toggle('contact');"><img src='folder.gif' width='16' height='16' hspace='0' vspace='0' border='0'></a></td><td><b>Contact Us</table>
<div id="contact" style="display: none; margin-left: 2em;">
<table border=0 cellpadding='1' cellspacing=1><tr><td width='16'><img src='text.gif' width='16' height='16' hspace='0' vspace='0' border='0'></td><td><a href="suggestion.php">Suggestion</a></td></tr></table>
<table border=0 cellpadding='1' cellspacing=1><tr><td width='16'><img src='text.gif' width='16' height='16' hspace='0' vspace='0' border='0'></td><td><a href="complaint.php">Complaint</a></td></tr></table>
</div>
<p><a href="javascript:Expand();">Expand All - </a><a href="javascript:Collapse();">Collapse All</a>
</td></tr></table>
</body>
</html>
Your help will be highly appreciatedLast edited by zamzam; Jun 21, 2007 at 02:07.
-
Jun 20, 2007, 23:41 #2
- Join Date
- Aug 2000
- Location
- Philadephia, PA
- Posts
- 20,578
- Mentioned
- 1 Post(s)
- Tagged
- 0 Thread(s)
You should refactor so that the file you're including only contains the logic you want to reuse, not output you don't.
If you must, use output buffering to prevent the include()'d file from sending anything to output. Look up the ob* functions.Try Improvely, your online marketing dashboard.
→ Conversion tracking, click fraud detection, A/B testing and more
-
Jun 20, 2007, 23:41 #3
- Join Date
- Oct 2006
- Location
- Kathmandu, Nepal
- Posts
- 4,013
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
What you mean? When you include a page its main purpose is to include that file to the includer page. But you can control in the including page with some values like if you are not on the main page then do not show some part of including page with simple if ... else statements.
It would be more easier to say if you he more descriptive.Mistakes are proof that you are trying.....
------------------------------------------------------------------------
PSD to HTML - SlicingArt.com | Personal Blog | ZCE - PHP 5
Bookmarks