php Error Page Help

PHP coding talk.

Moderator: Moderators

php Error Page Help

Postby Disturbed One on Mon Jun 13, 2005 2:14 am

I'm making an error page with three parts.

I want it to be like:

page.php?error=error1
page.php?error=error2
page.php?error=error3

I want it all to go to the same .tpl file.

I believe the way to do this is using switches. So I want it to be like
<!-- BEGIN error1 -->
content
<!-- END error1 -->

How do I make this work? I've never worked in the page.php?error=error1 part before. And how do I make all of these seperate errors use a different part of the .tpl file?

Thank you. Also could you kindly tell me what this is called? I have a really nice php and mysql book, but I cannot find this function.
Anthony Coy, President/Owner
High Velocity Media - Accelerated Internet Solutions
http://hvmdesign.com | contact[at]hvmdesign[dot]com
User avatar
Disturbed One
Moderator
Moderator
 
Posts: 2106
Joined: Sat Oct 09, 2004 8:12 pm
Location: Right behind you...

Postby Thatbitextra on Mon Jun 13, 2005 2:48 am

Try this, I think it should work:

Code: Select all
$variable = $HTTP_GET_VARS['error'];
if ( $variable = 'error1' )
{
   $template->assign_block_vars('error1', array());
}
elseif ( $variable = 'error2' )
{
   $template->assign_block_vars('error2', array());
}
else
{
   $template->assign_block_vars('error3', array());
}
My MODs: [NEW] Choose Who to Accept PMs From (Prevents you from receiving unwanted PMs!) | Warn of Old Topic Before Posting Reply
Style: subBlack (Now updated to phpBB 2.0.22 and 5 new color schemes!)

Please note, I do NOT offer support via PM. It's a forum, so post your question, then everyone can help.
User avatar
Thatbitextra
Moderator
Moderator
 
Posts: 1821
Joined: Thu Mar 24, 2005 1:11 pm
Location: A place where something is or could be located; a site.

Postby baz-x on Mon Jun 13, 2005 9:20 am

too much code ... use the simply method:
Code: Select all
$variable = $HTTP_GET_VARS['error']; 
$template->assign_block_vars($variable, array());

so, whatever you add as ?error= you have to make a loop that's named to it.
Regards
baz-x [blog] [website]
current projects:
» [span style="color: darkgreen"]Mex[/span] [span style="color: darkred"][ 75% ][/span]
» Nickpage Mod 2.0.0 ME [span style="color: red"][ paused ][/span]
» Style Demo Mod 1.2.2 ME [span style="color: red"][ paused ][/span]
User avatar
baz-x
Moderator
Moderator
 
Posts: 706
Joined: Sun Aug 15, 2004 9:12 pm
Location: Cache Management of Mex


Return to PHP Programming

Who is online

Users browsing this forum: No registered users and 0 guests