static page help

Discussion forum for MOD Writers regarding MOD Development.
Locked
jaylam13
Registered User
Posts: 194
Joined: Wed Sep 29, 2010 5:58 pm
Contact:

static page help

Post by jaylam13 »

Hi,

Does anyone know if it is possible to have a static page without having to have a template file?
For example I want to create a subfolder under my forum directory called test for example and in that text folder I would like to create a index.php file with some static content but I want it to have the forum header and footer.

Obviously the below code will not work but just so you can see what im trying to get at:

Code: Select all

<?php
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : '../forums/';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();

page_header('Title Here');
?>

<!-- INCLUDE overall_header.html -->

<h2>Title Here</h2>

<div class="panel">
   <div class="inner"><span class="corners-top"><span></span></span>

   <div class="content">
      <p>
         Content in here.
      </p>
   </div>

   <span class="corners-bottom"><span></span></span></div>
</div>

<!-- INCLUDE jumpbox.html -->
<!-- INCLUDE overall_footer.html -->

<?php
make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx"));
page_footer();
?>
Last edited by marian0810 on Fri Nov 23, 2012 1:26 pm, edited 1 time in total.
Reason: moved to Support
User avatar
Mick
Support Team Member
Support Team Member
Posts: 22764
Joined: Fri Aug 29, 2008 9:49 am
Location: Watching cricket probably.

Re: static page help

Post by Mick »

There's Add a New Custom Page to phpBB and also this MOD [ABD] Frontpage and folders. Please note the second one is marked [ABD] which means it's abandonded and shouldn't be used, there is also no support for it, but it may give you a few pointers.
"The more connected we get the more alone we become" - Kyle Broflovski©
jaylam13
Registered User
Posts: 194
Joined: Wed Sep 29, 2010 5:58 pm
Contact:

Re: static page help

Post by jaylam13 »

Mick wrote:There's Add a New Custom Page to phpBB and also this MOD [ABD] Frontpage and folders. Please note the second one is marked [ABD] which means it's abandonded and shouldn't be used, there is also no support for it, but it may give you a few pointers.
Thanks but the first one means using a template, the problem I have is the page I wish to sandwich between the phpbb header and footer has links to the same page but with a ?ID=123 at the end of it which loads different content from the database. I cant do this with the template version.
User avatar
Mick
Support Team Member
Support Team Member
Posts: 22764
Joined: Fri Aug 29, 2008 9:49 am
Location: Watching cricket probably.

Re: static page help

Post by Mick »

What exactly are you calling a template file? Templates are generally HMTL files, it's not clear what you mean by "I cant do this with the template version".
"The more connected we get the more alone we become" - Kyle Broflovski©
jaylam13
Registered User
Posts: 194
Joined: Wed Sep 29, 2010 5:58 pm
Contact:

Re: static page help

Post by jaylam13 »

Mick wrote:What exactly are you calling a template file? Templates are generally HMTL files, it's not clear what you mean by "I cant do this with the template version".
yes sorry the html file, so in that link before it says you have to have a file in styles/prosilver/template so instead of it pointing to this file I just want the file in the test folder to have the header and footer then my content sandwiched between them.
User avatar
Dugi
Registered User
Posts: 1386
Joined: Sun May 25, 2008 5:36 pm

Re: static page help

Post by Dugi »

Let's say we have a main php file named page.php. You could do something like this in that file:

Code: Select all

    <?php
    define('IN_PHPBB', true);
    $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
    $phpEx = substr(strrchr(__FILE__, '.'), 1);
    include($phpbb_root_path . 'common.' . $phpEx);

    // Start session management
    $user->session_begin();
    $auth->acl($user->data);
    $user->setup();

    // Variables
    $id = request_var('id', 0);

    page_header('Title Here');
    
    $template->set_filenames(array(
        'body' => (!empty($id) && $id == 123) ? 'yourpage_body.html' : 'myotherpage_body.html',
    ));

    make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx"));
    page_footer();
    ?>
With this method you'd be able to load different .HTML files depending on the URL, so if the URL contains ?id=123 your .HTML file wouldn't be the same as without that URL parameter.
PM me for custom extension pricing / My validated MODs / My MODs in development
jaylam13
Registered User
Posts: 194
Joined: Wed Sep 29, 2010 5:58 pm
Contact:

Re: static page help

Post by jaylam13 »

Dugi wrote:Let's say we have a main php file named page.php. You could do something like this in that file:

Code: Select all

    <?php
    define('IN_PHPBB', true);
    $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
    $phpEx = substr(strrchr(__FILE__, '.'), 1);
    include($phpbb_root_path . 'common.' . $phpEx);

    // Start session management
    $user->session_begin();
    $auth->acl($user->data);
    $user->setup();

    // Variables
    $id = request_var('id', 0);

    page_header('Title Here');
    
    $template->set_filenames(array(
        'body' => (!empty($id) && $id == 123) ? 'yourpage_body.html' : 'myotherpage_body.html',
    ));

    make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx"));
    page_footer();
    ?>
With this method you'd be able to load different .HTML files depending on the URL, so if the URL contains ?id=123 your .HTML file wouldn't be the same as without that URL parameter.
Thanks for the reply I kind of understand what you mean but I think this is above my knowledge so will have to consider writing a static page to look like the forum.
Locked

Return to “[3.0.x] MOD Writers Discussion”

cron