1

Topic: [HOWTO] Creating blank page in PunBB

I'm linking to my blog

http://kushithemes.t15.org/blog/tutoria … -in-punbb/

Cause I'm not patient enough to transform it into BBcode tongue.

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: [HOWTO] Creating blank page in PunBB

thanks, although i already created mine, this one has many other features that i really like.

MyFootballCafe.com  is Now Online!

Re: [HOWTO] Creating blank page in PunBB

I have a question, Suppose i create that page, i also add the page link to the menu.

So when someone opens the page, i want it to show in the menu that the page is opened. like selected. is that possible.

MyFootballCafe.com  is Now Online!

Re: [HOWTO] Creating blank page in PunBB

i also played with the title, so the title and page id are seperated, ex:

define('FORUM_ALLOW_INDEX', 1);
define('FORUM_PAGE', 'football-news-feed');
 
// Setup breadcrumbs
$forum_page['crumbs'] = array(
    array($forum_config['o_board_title'], forum_link($forum_url['index'])),
    'Football News Feed' // Set up your page title here
);

did i do it correct? does this affect anything else.

MyFootballCafe.com  is Now Online!

5 (edited by Kushi 2012-10-16 08:35)

Re: [HOWTO] Creating blank page in PunBB

You have to create extension and in hook
fn_generate_navlinks_end
inject

    $mylink = '<li id="navtutorial"'.((FORUM_PAGE == 'tutorial') ? ' class="isactive"' : '').'><a href="tutorial.php">Tutorial</a></li>';
    array_splice( $links, 5, 0, $mylink );

Where:

$mylink = '<li id="navtutorial"'.((FORUM_PAGE == 'tutorial') ? ' class="isactive"' : '').'><a href="tutorial.php">Tutorial</a></li>';

navtutorial - should be remembered if you wish to style this element later
tutorial - is FORUM_PAGE which you've declared in your custom page.
tutorial.php - is custom page address.
and

array_splice( $links, 5, 0, $mylink );

5 - link position


Note that the proper and more valid way is to edit /include/url/your-link-scheme/forum_urls.php
( eg. I'm editing /include/url/Default/forum_urls.php )
and add at the end another value

    'tutorial'                        =>     'tutorial.php'

(watch out for commas! )

Plus create language array in your extension, so the link could look like this:

    $mylink = '<li id="navtutorial"'.((FORUM_PAGE == 'tutorial') ? ' class="isactive"' : '').'><a href="'.forum_link($forum_url['tutorial']).'">'.$lang_array['mylink'].'</a></li>';


edit.
You're playing very well with title, this will also affect lastcrumb title.

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.

6 (edited by SuperMAG 2012-10-16 08:54)

Re: [HOWTO] Creating blank page in PunBB

Ok that is might complicated, since i have no coding knowledge, i though there was some sort of easy code you put in the page and thats it lol. but its ok. big_smile.

Anyway thanks alot for the work you put in this. I also replaced some stuff of your code, here:

<?php
/**
 * Display my custom page :-)
 *
 * @copyright (C) 2008-2012 PunBB, partially based on code (C) 2008-2009 FluxBB.org
 * @license http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
 * @package PunBB
 */
 
if (!defined('FORUM_ROOT'))
    define('FORUM_ROOT', '../../../');
require FORUM_ROOT.'include/common.php';
 
define('FORUM_ALLOW_INDEX', 1);
define('FORUM_PAGE', 'football-formation-creator');
 
// Setup breadcrumbs
$forum_page['crumbs'] = array(
    array($forum_config['o_board_title'], forum_link($forum_url['index'])),
    'Football Formation Creator' // Set up your page title here
);
 
require FORUM_ROOT.'header.php';
 
// START SUBST - <!-- forum_main -->
ob_start();
 
?>    
<div class="main-head" style="margin-top: 1em">
        <h2 class="hn"><span>Football Formation Creator &mdash; This tool is brought to you by <a href="http://this11.com/">This11.com</a>.</span></h2>
    </div>        

    <div class="main-content main-frm">
<div style="padding: 15px;">

My page content.

</div>
    </div>
<?php
 
$tpl_temp = forum_trim(ob_get_contents());
$tpl_main = str_replace('<!-- forum_main -->', $tpl_temp, $tpl_main);
 
ob_end_clean();
// END SUBST - <!-- forum_main -->
 
require FORUM_ROOT.'footer.php';

I used main-frm instead of main-message cuz the last one has different margins or paddings for each side, where i added <div style="padding: 15px;"> so that each side has equal space.

since my page is located in /page/1/football-formation-creator/
i renamed the file to index.php.

so it serves as a whole link, http://www.myfootballcafe.com/page/2/fo … n-creator/

Incase someone makes an extension of custom pages in the future, that page/1/ will be keep the link same.

MyFootballCafe.com  is Now Online!

7 (edited by Kushi 2012-10-16 09:10)

Re: [HOWTO] Creating blank page in PunBB

I've only showed the basis, the rest is sea of possibilities smile.

If you're using folder based redirect I would recommend to put your page in main catalog and instead edit
\include\url\Folder_based_(fancy)\rewrite_rules.php
Something like

    '^page[\/_-]([0-9]+)[\/_-]football-formation-creator[\/_-]'                                                                                                                =>  'football-formation-creator.php'
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: [HOWTO] Creating blank page in PunBB

Ah, i didn't knew about that, thanks a lot, i guess i don't need to make all those folders lol.

MyFootballCafe.com  is Now Online!

Re: [HOWTO] Creating blank page in PunBB

hey kushi, if you are still there, can u give me an example of url code in the rewrite-rules.php

i added this:

    '/page/1/football-news-feed/'                                                                                            =>    'pages/football-news-feed.php'

doesn't work obviously, can u give me an example.

MyFootballCafe.com  is Now Online!

10 (edited by Kushi 2012-10-16 10:02)

Re: [HOWTO] Creating blank page in PunBB

    '^(pages)[\/_-]1[\/_-](football)[\/_-](news)[\/_-](feed)[\/_-]$'                                                                                            =>    'pages/football-news-feed.php'

Remember to put \ before special characters, such as / . - 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.

Re: [HOWTO] Creating blank page in PunBB

not working, it is showing me this error:

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' in /home/mfiehazy/public_html/include/url/Folder_based_(fancy)/rewrite_rules.php on line 64
MyFootballCafe.com  is Now Online!

12 (edited by Kushi 2012-10-16 14:42)

Re: [HOWTO] Creating blank page in PunBB

This may Be something with commas. Last value shouldn't have one at the end.

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.

13

Re: [HOWTO] Creating blank page in PunBB

Ho to give permission to all users for the search. What to change on the code:

if ($forum_user['g_read_board'] == '0' || $forum_user['is_guest'] || ($forum_user['g_id'] != '1' && $forum_user['g_id'] != '4'))
    message($lang_common['No view']);

Re: [HOWTO] Creating blank page in PunBB

@Kushi, Is there a way for the pages to be indexed, means shows up in search.

MyFootballCafe.com  is Now Online!

15

Re: [HOWTO] Creating blank page in PunBB

otf wrote:

Ho to give permission to all users for the search. What to change on the code:

if ($forum_user['g_read_board'] == '0' || $forum_user['is_guest'] || ($forum_user['g_id'] != '1' && $forum_user['g_id'] != '4'))
    message($lang_common['No view']);

Just delete this part

if ($forum_user['g_read_board'] == '0' || $forum_user['is_guest'] || ($forum_user['g_id'] != '1' && $forum_user['g_id'] != '4'))
    message($lang_common['No view']);

So that message No view wouldn't show anyhow.

SuperMAG wrote:

@Kushi, Is there a way for the pages to be indexed, means shows up in search.

You mean in forum search or Google ( etc ) search? Second one:

define('FORUM_ALLOW_INDEX', 1);
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: [HOWTO] Creating blank page in PunBB

i mean the forum search.

MyFootballCafe.com  is Now Online!

Re: [HOWTO] Creating blank page in PunBB

This work pretty well bro.
Thanks!

Re: [HOWTO] Creating blank page in PunBB

Thank you also have this well help me to solve my problem

Informations et guide sur d'Asnieres sur seine
Infogeti Société d'infogérance