UseBB Community

The official board for UseBB help and discussion

UseBB Community » Resources & Customization » I'm trying to make a new page with the UseBB style

I'm trying to make a new page with the UseBB style

Moderators: Gaia.

Page: 1

Author Post
Member
Registered: Mar 2008
Posts: 3
I'm trying to make a new page with the UseBB style (headers, navbar, footers, etc) but I can't get the "template->" functions to do anything.
This is the code I'm using:
<?php
define('INCLUDED', false);
define('ROOT_PATH', './');
require(ROOT_PATH.'sources/common.php');

$session->update('CustomForums');
require(ROOT_PATH.'sources/page_head.php');
$template->set_page_title($lang['ForumIndex']);

$poster_id = $session->sess_info['user_id'];
$result = $db->query("SELECT name FROM ".TABLE_PREFIX."members WHERE id = '".$poster_id."'");
$userdata = $db->fetch_result($result);

if($poster_id === 0){
$template->parse('msgbox', 'global', array(
'box_title' => 'Not logged in',
'content' => 'You mus be logged in to do this.'
));
}elseif(!$_POST && !$_GET){
echo "<a href='?act=new'>New Custom Forum</a><br />";
}elseif(!empty($_POST['CFName']) && !empty($_POST['CFDesc'])){
$name = $_POST['CFName'];
$descr = $_POST['CFDesc'] ." [Forum by: " . $userdata['name'] . "]";
mysql_query("INSERT INTO forums (name, cat_id, descr, status, auto_lock, increase_post_count, hide_mods_list) VALUES ('$name', '2', '$descr', '1', '0', '1', '1')") or die(mysql_error());
}elseif($_GET['act'] == 'new'){
echo "<form method='POST'>
Name: <input type='text' name='CFName' /><br />
Description: <input type='text' name='CFDesc' /><br />
<input type='submit' value='Submit' />";
}

I took most of the first stuff from index.php.
Any help would be appreciated. Thanks in advance.
Developer
Registered: Apr 2004
Posts: 2178
Location: Belgium
You are not generating any output... include sources/page_head.php.
_______________
--Dietrich (developer)
UseBB roadmap, dev mailing list & weblog
Member
Registered: Mar 2008
Posts: 3
Dietrich wrote
You are not generating any output... include sources/page_head.php.
What do you mean, I'm not generating output?
And by the way, I have included sources/page_head.php.
...
$session->update('CustomForums');
require(ROOT_PATH.'sources/page_head.php');
$template->set_page_title($lang['ForumIndex']);
...
Developer
Registered: Apr 2004
Posts: 2178
Location: Belgium
Oops, I meant including include sources/page_foot.php at the end.
_______________
--Dietrich (developer)
UseBB roadmap, dev mailing list & weblog
Moderator
Registered: Oct 2005
Posts: 424
Location: canada
Also, using 'echo' isn't going to work.

You will want to use $template->add_raw_content() instead.
Member
Registered: Mar 2008
Posts: 3
Thanks for the help guys. It works perfectly now. :mrgreen:
Member
Registered: Nov 2007
Posts: 28
Give code please ?

Page: 1

UseBB Community » Resources & Customization » I'm trying to make a new page with the UseBB style

UseBB Community is powered by UseBB 1 Forum Software