1 (edited by Kushi 2011-12-03 22:46)

Topic: Check if index | viewtopic

Hello! I'm creating a new theme and I made some changes to the template which require including some files. Therefore I need to check if it is index.php. I figured it somehow

$adress  = $_SERVER["REQUEST_URI"]; //checking current adress
$part= explode("?", $adress  ); //exploding string into 2 parts, divided by a '?' sign -
 if ($part[0] == '/index.php' || $part[0] == '/') {
echo('
    <div id="brd-visit" class="gen-content">
        <!-- forum_visit -->
    </div>
');

and the same thing with viewtopic.php

<?
$adres  = $_SERVER["REQUEST_URI"];
$czesc = explode("?", $adres); 
 if ($czesc[0] == '/viewtopic.php') {
echo('<div class="main-head"><h2 class="hn"><span class="item-info">'.$lang_topic['Quick post'].'</span></div>');
}
?>

however it would only work with default URL scheme :<. And since my server doesn't support redirecting I cannot check names of this files in other schemes. Perhaps You could help me or tell some better method to check it. Please.

If any of my dropbox link fails with 404 error, change dl.dropbox.com/u/56038890/punbb/*.zip in address to 82283017.

Currently working on rPlus - responsive theme for developers to create their own themes basing on this one.

Re: Check if index | viewtopic

Use 'FORUM_PAGE' constant for current page detecting.

FORUM_PAGE

    The name of the forum page which is currently running. This constant is defined on every forum page. If you create a new forum page, you should define it manually.
    Example: define('FORUM_PAGE', 'viewtopic');

3

Re: Check if index | viewtopic

Hell yeah, thank You smile!

If any of my dropbox link fails with 404 error, change dl.dropbox.com/u/56038890/punbb/*.zip in address to 82283017.

Currently working on rPlus - responsive theme for developers to create their own themes basing on this one.