Help using active style on session integrated external pages

Discussion forum for MOD Writers regarding MOD Development.
Locked
schwim
Registered User
Posts: 120
Joined: Sat Jun 04, 2005 8:03 am

Help using active style on session integrated external pages

Post by schwim » Fri Apr 19, 2013 2:45 am

Hi there everyone!

I've been using pages that use phpBB's session system thanks to the tutorial found on this site. To date, I've used my own templating files, which requires I make alterations in two spots when I change something to the template. I thought I might try to build my pages in a manner that utilizes phpBB3's method of calling the styles...

So my genius effort is the following:

Code: Select all

define('IN_PHPBB', true);
$root_path = '/home/schw/public_html/';
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : '/home/schw/public_html/yakety-yak/';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/bbcode.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);

// Database Configuration (Where your phpBB config.php file is located)
include $phpbb_root_path.'/config.php';
$link = mysql_connect("$dbhost", "$dbuser", "$dbpasswd") or die("Could not connect");
mysql_select_db("$dbname") or die("Could not select database");

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

// Output page
page_header($user->lang['INDEX']);

$template->set_filenames(array(
	'body' => 'index_body.html')
);

page_footer();
Clearly I'm missing something... The resulting page is the forum index minus cats and forums, but without any style elements at all.

Could someone help me figure out what I need to do to use the /forum/'s active style in root's directory? I've read this tutorial, but I need it in a parent directory.

Thanks for your time!

User avatar
Lumpy Burgertushie
Registered User
Posts: 66905
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: Help using active style on session integrated external p

Post by Lumpy Burgertushie » Fri Apr 19, 2013 3:12 am

go back and read the aritcle again.

you have way too much stuff in your file.

this is all you need:

Code: Select all

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);
/home/schw/public_html/ is not your root path.

it would just be the simple ./ like it shows in the article


the include common.php already includes all the info needed to access the database and the styles etc.



robert
I'm baaaaaccckkkk. still doing work on donation basis. PM your needs.

Premium phpBB 3.2 Styles by PlanetStyles.net

If a tree falls in the forest and nobody is there, does it make a sound?

schwim
Registered User
Posts: 120
Joined: Sat Jun 04, 2005 8:03 am

Re: Help using active style on session integrated external p

Post by schwim » Fri Apr 19, 2013 2:26 pm

Hi there Robert,

Copying his files and placing the .html file in my style's template directory and the aboutus.php in the direcotry above the forum (where I need them) results in the same errors.

User avatar
Brf
Support Team Member
Support Team Member
Posts: 51889
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: Help using active style on session integrated external p

Post by Brf » Fri Apr 19, 2013 2:35 pm

schwim wrote: the aboutus.php in the direcotry above the forum
If your aboutus.php is in /public_html/ and your phpBB is installed in /public_html/yakety-yak/ then your root path should be ./yakety-yak

schwim
Registered User
Posts: 120
Joined: Sat Jun 04, 2005 8:03 am

Re: Help using active style on session integrated external p

Post by schwim » Fri Apr 19, 2013 5:18 pm

That worked fantastically and thank you both for your help. It leaves me with a new question, however.

I see many IF statements in the header and wonder if I can tailor these to only show header or footer elements when:

1) only on a particular external page(for instance, aboutus.php)
2) Only when in the forum directory
3) Only when a variable is passed on the external page($show_element_1 is set in aboutus.php)

Thank you very much for all your help.

User avatar
Brf
Support Team Member
Support Team Member
Posts: 51889
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: Help using active style on session integrated external p

Post by Brf » Fri Apr 19, 2013 5:33 pm

You can use

Code: Select all

<!-- IF SCRIPT_NAME eq 'aboutus' -->
to only show something on that one page.

Tutorial.Template_syntax will show you how to define your own variables to pass into the templates from the PHP.

Locked

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