Topic: Modifying templates?

Hello

(Since my other thread of customizing the homepage is being read but people don't seem to have the answer, I'll make it more general to increase the odds, so tet's forget about the Daris Portal extension smile)

There is little documentation in the wiki about how to customize the way PunBB displays pages.

It seems like pages are displayed based on templates (*.tpl) located in ./include/template).

My goal is to have a simpler layout in the homepage than in the forum proper: Should I just modify main.tpl somehow with "if homepage/else" blocks, or is there a better way?

Thank you.

Re: Modifying templates?

It looks like to change the upper and lower parts, I only need to modify /header.php and /footer.php, respectively.

But first, I need to know if I'm in the homepage or the forum itself.

Does someone know if PunBB provides a way to know this?

/header.php

// Load the main template
if (substr(FORUM_PAGE, 0, 5) == 'admin')
{
[...]
}
else if (FORUM_PAGE == 'help')
{
[...]
}
else
{
    if (file_exists(FORUM_ROOT.'style/'.$forum_user['style'].'/main.tpl'))
      $tpl_path = FORUM_ROOT.'style/'.$forum_user['style'].'/main.tpl';
    else
        //How to display a simpler UI for homepage, and full UI for the other pages?
    $tpl_path = FORUM_ROOT.'include/template/main.tpl';
}

Thanks.

Re: Modifying templates?

All I'd have to do to customize the homepage, is to be able to tell if we are currently in the homepage or in the forum page, and then, I could simply edit header.php like this:

if (substr(FORUM_PAGE, 0, 5) == 'admin')
...
} else //homepage + forum
    if (homepage)
        //don't include navlink
    else if (forum):
        // Main Navigation
        $gen_elements['<!-- forum_navlinks -->'] = '<ul>'."\n\t\t".generate_navlinks()."\n\t".'</ul>';
// START SUBST OF COMMON ELEMENTS
// Main Navigation
// How to exclude in homepage?
$gen_elements['<!-- forum_navlinks -->'] = '<ul>'."\n\t\t".generate_navlinks()."\n\t".'</ul>';
// START SUBST VISIT ELEMENTS
// How to exclude this line in homepage?
if ($forum_user['is_guest'])
        $visit_elements['<!-- forum_welcome -->'] = '<p id="welcome"><span>'.$lang_common['Not l$
else
        $visit_elements['<!-- forum_welcome -->'] = '<p id="welcome"><span>'.sprintf($lang_commo$

etc.

Unfortunately...
1. the homepage and forum page are lumped together as "FORUM_PAGE='index'", so I can't use this
2. $forum_user[] only includes the referer/previous URL
3. $forum_page[] doesn't include this relevant information

Any idea how to know whether we're on the homepage or forum page?

Thank you.