Since I have installed a couple of complex bbcodes for phpBBXS, i've noticed that the forum is slower, although the code is inside an "if/else" block and it is suposed not to be parsed everytime...
But the fact is that I have noticed a slow down when reading posts or entering the home page.
So I've had an idea which I don't know if it is possible. I've tried myself without result.
I wanted to take all the code for bbcodes outside the bbcode.php and make independent files for each one, ie:
a file called "/includes/bbcodes/hr.php" with the following code:
- <?php
- if ( !defined('IN_PHPBB') )
- {
- die("Hacking attempt");
- }
- $extras = $this->allow_styling ? array('style', 'class') : array();
- if(isset($item['params']['param']))
- {
- $color = $item['params']['param'];
- }
- elseif(isset($item['params']['color']))
- {
- $color = $item['params']['color'];
- }
- $color = $this->valid_color($color);
- if($color === false)
- {
- $html = '<' . $tag . ' />';
- }
- else
- {
- $html = '<' . $tag . ' color="' . $color . '" />';
- }
- return array(
- 'valid' => true,
- 'html' => $html
- );
- ?>
And modify the bbcode.php in order to include that file when de hr bbcode is invoked. Something like this.
- // Single tags: HR
- if($tag === 'hr')
- {
- include_once ('./includes/bbcodes/hr.php');
- }
I've tried this way with the hr bbcode but it's not parsed :(
I've tried also by making $html global but no way.
I've thought this could be a good idea because in one modification you'll save more than 2000 codelines in my case or more than 1500 in a standard bbcode.php
Could this be a good idea or is it only another lost of time made in Xusqui ;)
Thnx!!