-
2012-10-05
yndesai
I wanted to use the scanlines template in my new installation and it threw me the following error:
Quote:
Fatal error: Cannot redeclare tpl_sidebar() (previously declared in C:\xampp\htdocs\swapan\inc\template.php:1490) in C:\xampp\htdocs\swapan\lib\tpl\scanlines\tpl_functions.php on line 66
: Unquote
I think this has come because the new default template also has sidebar (I may be wrong).
I am not aware if this is a bug.
Thought this might hamper the portability of old template.
YNDESAI
-
2012-10-05
ach
This is a bug in the Scanlines template. A function called tpl_sidebar() has been added to the template functions and therefore all template which have the same function are broken.
It is generally bad practice to a) name a function in a way that can overlap with existing functions (that's why it's encouraged to start template functions with an underscore, e.g. "_tpl_sidebar()") and b) not test if such a function already exists (with "if (!function_exists('tpl_sidebar')) {}").
-
2012-10-05
ach
I wonder if we should do something about this anyway, just because so many people have problems with this. Although this is simply bad coding in some templates (and they are a few really popular templates), renaming the core function would "solve" all this.
-
2012-10-05
yndesai
Its now a chicken and egg story.
tpl_sidebar() was used in the templates
before it got created in core.
Renaming this function in all the template files is
big task and will cause problem to anyone upgrading
without knowing this problem.
Hence changing the name in the core would affect very less
number of users, even if it is not the best to do this.
Just a thought.
-
2012-10-06
ach