Files we will edit for this are:
includes/functions.php
includes/sessions.php
First off, in functions.php is a function called "setup_style()" which is responsible for loading the desired template.
It gets the style ID when the user preferences are loaded.
What we simply do here is ignore the style_id that has been entered but we will first check if the url contains the style ID. If it doesn't then simply load the style it would normally load.
Open functions.php
Find:
- Code: Select all
function setup_style($style)
{
global $db, $board_config, $template, $images, $phpbb_root_path;
Replace with:
- Code: Select all
function setup_style($style)
{
global $db, $board_config, $template, $images, $phpbb_root_path, $HTTP_GET_VARS;
//
// Check if a style ID is added to the url, and make sure it is not emtpy.
//
if( isset($HTTP_GET_VARS['st']) && intval($HTTP_GET_VARS['st']) )
{
$style = intval($HTTP_GET_VARS['st']);
}
Now if we have added a style_id to the url( index.php?st=1 ) we see that style. But normal links on the board do not contain the style_id in the url.
To fix that we will modify the "append_sid()" function which is called with every url and adds a session ID. it will now add the style ID for us.
open sessions.php
Find:
- Code: Select all
function append_sid($url, $non_html_amp = false)
{
global $SID;
Replace with:
- Code: Select all
function append_sid($url, $non_html_amp = false)
{
global $SID, $HTTP_GET_VARS;
Find:
- Code: Select all
if ( !empty($SID) && !preg_match('#sid=#', $url) )
{
$url .= ( ( strpos($url, '?') !== false ) ? ( ( $non_html_amp ) ? '&' : '&' ) : '?' ) . $SID;
}
After add:
- Code: Select all
if ( !preg_match('#st=#', $url) )
{
$url .= ( ( strpos($url, '?') !== false ) ? ( ( $non_html_amp ) ? '&' : '&' ) : '?' ) . 'st=' . $HTTP_GET_VARS['st'];
}
Now the style ID is added to every url on the forum.
And your done with your basic style demo.





