enanospr Posted February 18, 2007 Share Posted February 18, 2007 Hi!! Im new at this php thing but i have a problem with my template.php i have the <?php $content = "djtiesto.html"; include("../../template.php"); ?> con djtiesto.php but when displayed on the internet it doesnt show any image in the template.php Quote Link to comment Share on other sites More sharing options...
simcoweb Posted February 18, 2007 Share Posted February 18, 2007 Do us a favor and use the 'code' insertion icons for pasting your code in the posts. And, please paste all your code for this 'template.php' file. Quote Link to comment Share on other sites More sharing options...
enanospr Posted February 18, 2007 Author Share Posted February 18, 2007 SORRY...  Here ya go... template.php code  ---------------------- --------------------- <style type="text/css"> <!-- body { margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; background-image:url(images/bg.jpg); } --> </style> <link href="style.css" rel="stylesheet" type="text/css"> <style type="text/css"> <!-- .style9 {color: #CCCCCC} --> </style> <table width="599" border="0" align="center" cellpadding="0" cellspacing="0">  <tr>   <td><table width="800" height="588" border="0" align="center" cellpadding="0" cellspacing="0" id="Table_01">    <tr>     <td height="258" colspan="2" valign="top" bgcolor="#000000"><?php include("top.php")?></td>    </tr>    <tr>     <td width="201" height="330" rowspan="2" valign="top" bgcolor="#2B2B2B"><?php include("menu.php")?></td>     <td width="599" height="155" valign="top" bgcolor="#000000"><?php include("bannerad.php")?></td>    </tr>    <tr>     <td valign="top" bgcolor="#000000"><p>       <?php include($content); ?>      </p>       <p> </p>      <p> </p></td>    </tr>   </table></td>  </tr>  <tr>   <td><?php include("footer.php")?></td>  </tr> </table> -------------------- --------------------  anything else..?? Quote Link to comment Share on other sites More sharing options...
simcoweb Posted February 18, 2007 Share Posted February 18, 2007 The problem is you are including a variable but there's no place on that page where the variable value/content is set. I'm not sure why you don't just include the file like you did the footer.php: Â <?php include("nameofthetemplate.php") ?> Quote Link to comment Share on other sites More sharing options...
desithugg Posted February 18, 2007 Share Posted February 18, 2007 The problem is you are including a variable but there's no place on that page where the variable value/content is set. I'm not sure why you don't just include the file like you did the footer.php: Â <?php include("nameofthetemplate.php") ?> The problem is you are including a variable but there's no place on that page where the variable value/content is set. I'm not sure why you don't just include the file like you did the footer.php: Â <?php include("nameofthetemplate.php") ?> umm i think he wants to include different files depending on the get variables in the url try this <style type="text/css"> <!-- body { Â margin-left: 0px; Â margin-top: 0px; Â margin-right: 0px; Â margin-bottom: 0px; Â background-image:url(images/bg.jpg); } --> </style> <link href="style.css" rel="stylesheet" type="text/css"> <style type="text/css"> <!-- .style9 {color: #CCCCCC} --> </style> <table width="599" border="0" align="center" cellpadding="0" cellspacing="0"> Â <tr> Â Â <td><table width="800" height="588" border="0" align="center" cellpadding="0" cellspacing="0" id="Table_01"> Â Â Â <tr> Â Â Â Â <td height="258" colspan="2" valign="top" bgcolor="#000000"><?php include("top.php")?></td> Â Â Â </tr> Â Â Â <tr> Â Â Â Â <td width="201" height="330" rowspan="2" valign="top" bgcolor="#2B2B2B"><?php include("menu.php")?></td> Â Â Â Â <td width="599" height="155" valign="top" bgcolor="#000000"><?php include("bannerad.php")?></td> Â Â Â </tr> Â Â Â <tr> Â Â Â Â <td valign="top" bgcolor="#000000"><p> <?php $file = $_GET['content']; if($file == "") { $file = "main"; } $content = "$file.php" if (file_exists($content)) { include($content); } else { echo"The file your looking for doesn't exist."; } ?> Â Â Â Â Â </p> Â Â Â Â Â Â <p>Â </p> Â Â Â Â Â <p>Â </p></td> Â Â Â </tr> Â Â </table></td> Â </tr> Â <tr> Â Â <td><?php include("footer.php")?></td> Â </tr> </table> Â soo what this will do is when you go to the url content.php?content=whatever it will include "whatever.php" where it says include("$content"); if they enter something that doesnt exist like content.php?content=afsd8y87f78yccv it will give the error "The page you are looking for doesn't exist." Quote Link to comment Share on other sites More sharing options...
simcoweb Posted February 18, 2007 Share Posted February 18, 2007 I don't see any $_GET call setting anything. Quote Link to comment Share on other sites More sharing options...
desithugg Posted February 19, 2007 Share Posted February 19, 2007 I don't see any $_GET call setting anything. yea but the only reason i think he has include("$content"); is because he wants to use the url and include something accordingly <?php $file = $_GET['content']; if($file == "") { $file = "main"; } $content = "$file.php" if (file_exists($content)) { include($content); } else { echo"The file your looking for doesn't exist."; } ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.