Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Strange behavior of standard theme function
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Ali B.  
View profile  
 More options Jan 22 2008, 8:48 pm
From: "Ali B." <dmond...@gmail.com>
Date: Wed, 23 Jan 2008 03:48:20 +0200
Local: Tues, Jan 22 2008 8:48 pm
Subject: Strange behavior of standard theme function

Hi all,

I have noticed something I thought rather strange when working with
$theme->header() and $theme->footer(). I am not sure if this is an expected
and/or accepted behavior or not, so please correct me if I am wrong. I am
using the header() function as an example, but this is applicable for
footer() as well, the sidebar() works fine.

for the $theme->header call not to give up on you and gives you a white
page, at least one filter_theme_call_header(...) definition need to be
included within the theme.php or any of the activated plugins. If only the
theme_header(...) is invoked in the process, you will be presented with a
nice white page for anything below the function call within your theme.

At the least, you would need to use the filter_theme_call_* in the simplest
way possible (normally within theme.php of your theme:

function filter_theme_call_header( $return ) {
return $return;

}

Does this make sense?

PS: sorry if my English is bad. Obviously it's not my "mother tongue" :)
--
Ali B.

"No one can make you feel inferior without your consent."
--  Eleanor Roosevelt


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Michael C. Harris  
View profile  
 More options Jan 23 2008, 10:19 pm
From: "Michael C. Harris" <michael.twof...@gmail.com>
Date: Thu, 24 Jan 2008 14:19:51 +1100
Local: Wed, Jan 23 2008 10:19 pm
Subject: Re: [habari-dev] Strange behavior of standard theme function
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


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ali B.  
View profile  
 More options Jan 24 2008, 7:49 pm
From: "Ali B." <dmond...@gmail.com>
Date: Fri, 25 Jan 2008 02:49:35 +0200
Local: Thurs, Jan 24 2008 7:49 pm
Subject: Re: [habari-dev] Re: Strange behavior of standard theme function

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:

--
Ali B.

"No one can make you feel inferior without your consent."
--  Eleanor Roosevelt


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »