|
#1
|
|||
|
|||
|
Add error page
Pixelpost displays the image_template.html file if the user tries to go to any page not on the site (by going to http://www.site.com/index.php?x=foo for example).
I've modified pixelpost so now if a user tries to go to an unknown url an error page can be displayed. This hack applies to pixelpost 1.4.1. Change this code: Code:
// You can now add any template you want by just adding the template and a link to it. For example,
// ?x=about will load the template about_template.html
if( $_GET['x'] == "ref" )
{
// Maintain backwards compatibility with the referer template
$_GET['x'] = "referer";
}
if( file_exists( "templates/".$cfgrow['template']."/".$_GET['x']."_template.html" ) )
{
$tpl = file_get_contents("templates/".$cfgrow['template']."/".$_GET['x']."_template.html");
}
else
{
if (!file_exists("templates/".$cfgrow['template']."/image_template.html"))
{
echo '<b>Error:</b><br />No template folder exists by the name of <b>"' .$cfgrow['template'] .'"</b> or the file <b>image_template.html</b> is missing in that folder.<br />Make sure that you have uploaded all necessary files with the exact same names as mentioned here.';
exit;
}
$tpl = file_get_contents("templates/".$cfgrow['template']."/image_template.html");
}
if($_GET['popup'] == "comment")
{
$tpl = file_get_contents("templates/".$cfgrow['template']."/comment_template.html");
}
// Added ability to use header and footers for templates. They are not needed but used if included in the template
$tpl = $header . $tpl . $footer;
Code:
// You can now add any template you want by just adding the template and a link to it. For example,
// ?x=about will load the template about_template.html
if( $_GET['x'] == "ref" )
{
// Maintain backwards compatibility with the referer template
$_GET['x'] = "referer";
}
if (isset($_GET['x']))
{
$filename = "templates/".$cfgrow['template']."/".$_GET['x']."_template.html";
if (!file_exists($filename))
{
$error_filename = "templates/".$cfgrow['template']."/error_template.html";
if (file_exists($error_filename))
{
$filename = $error_filename;
}
}
}
if (!isset($filename))
{
$filename = "templates/".$cfgrow['template']."/image_template.html";
if (!file_exists($filename))
{
echo '<b>Error:</b><br />No template folder exists by the name of <b>"' .$cfgrow['template'] .'"</b> or the file <b>image_template.html</b> is missing in that folder.<br />Make sure that you have uploaded all necessary files with the exact same names as mentioned here.';
exit;
}
}
if($_GET['popup'] == "comment") {
$filename = "templates/".$cfgrow['template']."/comment_template.html";
}
$tpl = file_get_contents($filename);
// Added ability to use header and footers for templates. They are not needed but used if included in the template
$tpl = $header . $tpl . $footer;
|
| Post Reply |
| Thread Tools | |
|
|