Thanks for the response Michael.
I think this is related to the invocation process of the theme_header(..)
and the filter_theme_call_header(..) function. see "How to Reorder Theme
Function Results" section in
http://wiki.habariproject.org/en/Theme_Functions
I found out that you would need at least a definition for the
filter_theme_call_header(..) function down in the process if any
theme_header(..) definition occur _with_ or _before_ it within the process.
Considering that theme methods are invoked after those in plugins, I am
using the K2 system theme and a plugin (preferable that does not contain a
definition to any of those 2 functions) to duplicate the issue in a couple
of cases below
Case1: No calls to the filter_theme_call_header() method in the whole
process.
1) Deactivate all the plugins.
2) Assume that we don't need to include the jquery in K2's theme.php so we
completely delete the definition for filter_theme_call_header
3) At this point, no definition to any of those 2 function occur in the
process, so the home page displays fine.
4) Activate your plugin of choice and add a definition of theme_header() and
make sure that it has no filter_theme_call_header() defined, like so:
public function theme_header($theme){
echo "Hello from the plugin";
}
5) You now see a white page with only the Hello message printed at the top
when accessing the home page
Case2: Calls in the "wrong" order.
1) Repeat step1 and step2 in Case1 above
2) Add a definition to theme_header() within K2's theme.php, something like
so:
public function theme_header($theme){
echo "Hello from the K2's theme.php";
}
3) You would also see a white page with only the Hello message printed at
the top when accessing the home page.
4) Now define filter_theme_call_header within the plugin used in testing and
activate it. we can use a simple definition like so:
public function filter_call_theme_header($return, $theme){
echo "Hello from filter_call_theme_header in the plugin";
return $return;
}
5) Same issue and strangely enough, it would not display the second echo
text, rather it echos the one in step 2 above.
This makes me think that first all theme_header() methods are invoked, and
then it searches for the filter_theme_call_header() methods down the ladder
only, and when it can't find it, it crashes.
What concerns me that if a custom theme is used, one that does not redefine
filter_theme_call_header() method. And you use a plugin that uses
theme_header to insert some code into your header. You would end up with a
blank page. Which is one of the many scenarios that may be encountered
Cheers,
Ali
On Jan 24, 2008 5:19 AM, Michael C. Harris <michael.twof...@gmail.com>
wrote:
> I don't really follow what's going on. Perhaps you could post the code
> that works and the code that doesn't work.
> If there is a syntax error in your php you'll get a blank page. Check
> that's not the case by using the -l (that's a little ell) on the
> command line.
> php -l theme.php (or whatever file you're checking)
> cheers, Michael
> --
> Michael C. Harris, School of CS&IT, RMIT University
> http://twofishcreative.com/michael/blog
--
Ali B.
"No one can make you feel inferior without your consent."
-- Eleanor Roosevelt