[wikka-community] Page forward (was Site forward)
Krzysztof Trybowski
trybowski
Sun Feb 3 17:12:07 GMT 2008
Dnia 1 lutego 2008 mahefa randimbisoa napisal(a):
> Create a file redirect.php in actions/ folder and add put in it the
> following code:
> <?php
> @ob_end_clean();
> header('Location: '.$this->Href('', $page));
> die();
> ?>
> Now, use just the following code inside the page bestofbeer:
> {{redirect page="beer"}}
Let's better add some basic checks to the code:
-if $page is set and non-empty
-if we don't redirect to the same page
It doesn't check if we didn't make a loop of more pages, but this
would require some more coding. For now the simple solution would be
like this:
<?php
if (isset($page) and $page != '' and $this->GetPageTag() != $page) {
@ob_end_clean();
header('Location: '.$this->Href('', $page));
die();
} else {
echo('Redirect error!');
}
?>
Regards, KT
--
Krzysztof Trybowski
Gadu-Gadu: 1458144 --- Skype: trybowski
AQQ: 141062 --- ICQ: 4350719 --- gpg key-id: 0xC937B0F2
More information about the community
mailing list