model for file-template

Discussion of general topics related to the new version and its place in the world. Don't discuss new features, report bugs, ask for support, et cetera. Don't use this to spam for other boards or attack those boards!
Forum rules
Discussion of general topics related to the new release and its place in the world. Don't discuss new features, report bugs, ask for support, et cetera. Don't use this to spam for other boards or attack those boards!
Post Reply
Franklin
Registered User
Posts: 15
Joined: Wed Apr 12, 2006 12:19 pm

model for file-template

Post by Franklin »

I'm looking for the "standard phpBB-Code" [like this or roughly the same like this (in English)]

I tried this code, but there were lots of errors:

Code: Select all

<?php
/**
*
* @package MeinMOD
* @version $Id: neueseite.php,v 1.0 2006/04/15 20:45 Franklin Exp $
* @copyright (c) 2006 Franklin
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/


define('IN_PHPBB', true);
$phpbb_root_path = './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.'.$phpEx);

$user->session_begin();
$auth->acl($user->data);

page_header("Test-Sitename");

/**
*
* content
*
*/

page_footer();

?>
Does somebody know the correct standard code?
I'm German, so I can't speak English very well...
the letter j
Registered User
Posts: 6
Joined: Sun Mar 02, 2003 11:39 pm

Re: model for file-template

Post by the letter j »

If you have trouble understanding this, then I suggest you learn the new code sometime. But here is how I do it:

Code: Select all

<?php

define('IN_PHPBB', true);
$phpbb_root_path = './'; // Root to phpbb
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.'.$phpEx);

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

// Your main code

// Set your template variables
$template->assign_vars(array(
    'SOME_VAR' => 'whatever',
    )
);

// Output the page
page_header('Page title');

// Set the template name
$template->set_filenames(array(
    'body' => 'template.html')
);

page_footer();

?>
Franklin
Registered User
Posts: 15
Joined: Wed Apr 12, 2006 12:19 pm

Re: model for file-template

Post by Franklin »

Thanks, Now it works!
I'm German, so I can't speak English very well...
Post Reply