Jump to content

If true, load this page.


TeddyKiller

Recommended Posts

If I have a variable.. eg:

$variable = 'on'

I do an if statement to see if $varible == 'on'

If true, I'd like to display a page within that page. So.. basically.. I don't want the actual page to load past this point, just want to load a page within the page being viewed instead? It'll be like a redirection to an error page.. only it doesn't redirect, it just displays that page instead?

 

Do you get me? How can this be done.

Link to comment
Share on other sites

//Random.php?page=abc
<?php
if ($_GET['page'] == 'abcde') {
  $variable = TRUE;
}

//...

if(!$variable) {
    print "Uh oh, Page is wrong!";
    exit();
}

//.. 

?>

 

Although by your wording, I have absolutely no clue what you're talking about. Are you wanting to display a page if it exists, and if it doesn't display an error dynamically or something?

Link to comment
Share on other sites

sounds like your looking for include()

if ($var == 'on'){
//whatever
}
else {
include("error.php");
}

D'oh. Simple solution ha. I'd put an exit; after it too probably? To make it stop loading the current page.

It's not actually like an error page, it's more or less like.. under construction.

I can't think of a better way to put it really.

 

As for oni-kun, I wanted to display a whole error page, rather than printing 1 line. So.. it'll be a big print to display a whole page :P

 

Thanks!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.