You don't have to do anything, the link is for a proposal to remove the feature that allows you to place php in templates. It's been controversial since it was included in 3.0 back in 2007. It's a shortcut with potential security issues.
Ideally you would put php in the php files. For edits that are typically larger and not specific to one page I use a custom included file simply for convenience.
Open common.php and find:
Code: Select all
require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx);
After add:
Code: Select all
// halil16 Mod - require custom include
require($phpbb_root_path . 'includes/functions_halil16.' . $phpEx);
The
// halil16 Mod
bit is so you can easily identify or search for custom edits. It can be anything as long as it's consistent. Add a quick note for future reference.
Create a new file called functions_halil16.php, use Notepad++ or similar editor. Save the following code in that file and upload to includes folder. To add new quotes just add them to the array, nothing more to do. Note the comma after each array element except last one.
Code: Select all
<?php
function halil16_get_quote()
{
$quotes = array
(
'quote1',
'quote2',
'quote3'
);
$key = rand(0, (count($quotes) - 1));
return $quotes[$key];
}
?>
Open includes/functions.php and around line 4450 find:
Code: Select all
// The following assigns all _common_ variables that may be used at any point in a template.
$template->assign_vars(array(
'SITENAME' => $config['sitename'],
replace with:
Code: Select all
// The following assigns all _common_ variables that may be used at any point in a template.
$template->assign_vars(array(
// halil16 Mod - Placeholder for quote
'HALIL16_QUOTE' => halil16_get_quote(),
'SITENAME' => $config['sitename'],
Anywhere in template you can now use
{HALIL16_QUOTE}
to display the quote.
In the futurre if you want to create another custom function just add it to
functions_halil16.php
Try and be consistent with prefixes and comments when editing core files. This makes things a whole lot easier for updating phpBB and maintain them. This also helps insure there will be no conflicts.
“Results! Why, man, I have gotten a lot of results! I have found several thousand things that won’t work.”
Attributed - Thomas Edison