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 Link to comment https://forums.phpfreaks.com/topic/39071-help-with-basic-php-with-templatephp/ 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. Link to comment https://forums.phpfreaks.com/topic/39071-help-with-basic-php-with-templatephp/#findComment-188179 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..?? Link to comment https://forums.phpfreaks.com/topic/39071-help-with-basic-php-with-templatephp/#findComment-188182 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") ?> Link to comment https://forums.phpfreaks.com/topic/39071-help-with-basic-php-with-templatephp/#findComment-188192 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." Link to comment https://forums.phpfreaks.com/topic/39071-help-with-basic-php-with-templatephp/#findComment-188219 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. Link to comment https://forums.phpfreaks.com/topic/39071-help-with-basic-php-with-templatephp/#findComment-188254 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."; } ?> Link to comment https://forums.phpfreaks.com/topic/39071-help-with-basic-php-with-templatephp/#findComment-188266 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.