Is it possible to identify the actual event plugin name from within a template file such as index.tpl or entries.tpl?
Basically my problem is that the hemingway template is quite different from any previous serendipity template and many of our plugins use different html output (static pages, guestbook, faq, contact form etc) and I want to make sure these remain compatible with hemingway.
So, how do I identify which particular event plugin has control of the page?
Can I identify event plugin in index.tpl
-
carl_galloway
- Regular
- Posts: 1331
- Joined: Sun Dec 04, 2005 5:43 pm
- Location: Andalucia, Spain
- Contact:
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: Can I identify event plugin in index.tpl
Hi!
I'm afraid but there is no real way to find this out without modiyfing each plugin.
The API itself cannot find out, which plugin "activates" anything. Only the plugin itself can tell that by setting specific variables. This means, the information is only available via push from a plugin, not via pull from the API.
It would revert quite a lot of logic, if we were to turn around that mechanism - and would lead to incompatibility, and IMHO also such a change would make plugins less flexible and contain more overhead.
Basically plugins have the opportunity to set the $serendipity['view'] parameter, but I think none of them currently deals with that.
What exactly are you trying to solve? Maybe instead of filtering on specific plugins you could whitelist all internal s9y "views". Then all the rest that is not a s9y specific view would be an external plugin and could get different output?
It all boils down to the problem, that no plugin has "control over a page". Plugins only have control over one specific event. So one plugin might use the event to push its content into the page, while another plugin uses a hook to push HTML meta tags into the head; both plugins will have controll over the page then, and you can'T really tell which plugin does what. Only by checking for variables like $staticpage_pagetitle that most of the plugins use.
HTH,
Garvin
I'm afraid but there is no real way to find this out without modiyfing each plugin.
The API itself cannot find out, which plugin "activates" anything. Only the plugin itself can tell that by setting specific variables. This means, the information is only available via push from a plugin, not via pull from the API.
It would revert quite a lot of logic, if we were to turn around that mechanism - and would lead to incompatibility, and IMHO also such a change would make plugins less flexible and contain more overhead.
Basically plugins have the opportunity to set the $serendipity['view'] parameter, but I think none of them currently deals with that.
What exactly are you trying to solve? Maybe instead of filtering on specific plugins you could whitelist all internal s9y "views". Then all the rest that is not a s9y specific view would be an external plugin and could get different output?
It all boils down to the problem, that no plugin has "control over a page". Plugins only have control over one specific event. So one plugin might use the event to push its content into the page, while another plugin uses a hook to push HTML meta tags into the head; both plugins will have controll over the page then, and you can'T really tell which plugin does what. Only by checking for variables like $staticpage_pagetitle that most of the plugins use.
HTH,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
-
carl_galloway
- Regular
- Posts: 1331
- Joined: Sun Dec 04, 2005 5:43 pm
- Location: Andalucia, Spain
- Contact:
The problem with $staticpage_pagetitle is that it isn't possible to define the event plugin from it because this variable can be set differently from the default by the user in the admin screen.
Let me tell you more about what I want to do. Hemingway pages are split into two, a left column and a right column/ The right column contains the body, and the left contains the footer info (author, number of search results). Any plugin that uses a .tpl file can be manipulated to work with this, but those that have their html hard coded such as the guestbook can't.
Usually I wouldn't bother trying to make guestbook/faq etc work properly because all other templates use the same css classes etc, but with hemingway I have to change almost everything. Its a really pimped up template that breaks almost every style convention currently known in Serendipity. Once the template is released I think there might be a case for getting rid of the html output that certain plugins use and actually just get them to output variables that template designers can style any way they like, but until then I have to make something work so you can see where the restrictions appear.
So, getting back to my original point, the left column contains the meta/footer info, which is fine for regular entries, overview pages, and static pages, but not so cool for the faq and guestbook because their layout is very different. What I need to do in my entries.tpl or index.tpl is identify if these plugins are in control so that I can add a left column just for them. Otheriwse I get a blank space.
Garvin, I know this might sound really whacky, and maybe you think I'm going too far, but the beauty of hemingway is how different it is and I'm trying to reproduce it rather than just make serendipity look vaguely like it.
Let me tell you more about what I want to do. Hemingway pages are split into two, a left column and a right column/ The right column contains the body, and the left contains the footer info (author, number of search results). Any plugin that uses a .tpl file can be manipulated to work with this, but those that have their html hard coded such as the guestbook can't.
Usually I wouldn't bother trying to make guestbook/faq etc work properly because all other templates use the same css classes etc, but with hemingway I have to change almost everything. Its a really pimped up template that breaks almost every style convention currently known in Serendipity. Once the template is released I think there might be a case for getting rid of the html output that certain plugins use and actually just get them to output variables that template designers can style any way they like, but until then I have to make something work so you can see where the restrictions appear.
So, getting back to my original point, the left column contains the meta/footer info, which is fine for regular entries, overview pages, and static pages, but not so cool for the faq and guestbook because their layout is very different. What I need to do in my entries.tpl or index.tpl is identify if these plugins are in control so that I can add a left column just for them. Otheriwse I get a blank space.
Garvin, I know this might sound really whacky, and maybe you think I'm going too far, but the beauty of hemingway is how different it is and I'm trying to reproduce it rather than just make serendipity look vaguely like it.
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
The only way to go is to modify existing plugins and make them set a smarty variable that you can query.
Thus I need a list of all event plugins you can think of (or anyone else) and I will make the changes. Of course this means all hemingway users will need to upgrade involved plugins. But there's technically no way to get this done in the API.
Best regards,
Garvin
The only way to go is to modify existing plugins and make them set a smarty variable that you can query.
Thus I need a list of all event plugins you can think of (or anyone else) and I will make the changes. Of course this means all hemingway users will need to upgrade involved plugins. But there's technically no way to get this done in the API.
Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
-
carl_galloway
- Regular
- Posts: 1331
- Joined: Sun Dec 04, 2005 5:43 pm
- Location: Andalucia, Spain
- Contact:
Garvin, I'll send you a preview of the template (incomplete, and still needing work, its about 80% at the moment) so you can see how the logic and code works. I think you'll agree that this template shows off a lot of the changes you've been making to Serendipity and should get you excited about what might be possible in the future.
I might be on the wrong track here, but from doing this template I really believe the event plugins should put ALL of their output into variables that can be called from a template .tpl file. A specific gripe would be the guestbook which has no .tpl file, so can't be styled, and which is why I want the ability to identify its name so I can put some wrapper div's around it. Problem is if I stick the wrapper around all event plugins then it screws up the layout, and so the circle turns.
I might be on the wrong track here, but from doing this template I really believe the event plugins should put ALL of their output into variables that can be called from a template .tpl file. A specific gripe would be the guestbook which has no .tpl file, so can't be styled, and which is why I want the ability to identify its name so I can put some wrapper div's around it. Problem is if I stick the wrapper around all event plugins then it screws up the layout, and so the circle turns.
-
carl_galloway
- Regular
- Posts: 1331
- Joined: Sun Dec 04, 2005 5:43 pm
- Location: Andalucia, Spain
- Contact:
Garvin, I'll send you a preview of the template (incomplete, and still needing work, its about 80% at the moment) so you can see how the logic and code works. I think you'll agree that this template shows off a lot of the changes you've been making to Serendipity and should get you excited about what might be possible in the future.
I might be on the wrong track here, but from doing this template I really believe the event plugins should put ALL of their output into variables that can be called from a template .tpl file. A specific gripe would be the guestbook which has no .tpl file, so can't be styled, and which is why I want the ability to identify its name so I can put some wrapper div's around it. Problem is if I stick the wrapper around all event plugins then it screws up the layout, and so the circle turns.
I might be on the wrong track here, but from doing this template I really believe the event plugins should put ALL of their output into variables that can be called from a template .tpl file. A specific gripe would be the guestbook which has no .tpl file, so can't be styled, and which is why I want the ability to identify its name so I can put some wrapper div's around it. Problem is if I stick the wrapper around all event plugins then it screws up the layout, and so the circle turns.
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
Yes, we will need to modify plugins then. We could start with a smaller plugin like maybe the contactform plugin to better integrate into your theme.
I'll try to do that after my holidays, which will begin at the end of next week until the beginning of october.
Best regards,
Garvin
Yes, we will need to modify plugins then. We could start with a smaller plugin like maybe the contactform plugin to better integrate into your theme.
I'll try to do that after my holidays, which will begin at the end of next week until the beginning of october.
Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
-
carl_galloway
- Regular
- Posts: 1331
- Joined: Sun Dec 04, 2005 5:43 pm
- Location: Andalucia, Spain
- Contact:
Luckily the contact form plugin has its own .tpl file and I've been able to recode it, and it looks fantastic! I think event plugins that cause the most problem are the ones like the guestbook that piggy back off the static page plugin (they use $staticpage_pagetitle) but don't allow further customization.
I guess the thing is that plugins like the guestbook, faq, forums etc aren't used by very many users, but this could be because of the relatively few Serendipity users and as time goes by I'm sure this will change.
I guess the thing is that plugins like the guestbook, faq, forums etc aren't used by very many users, but this could be because of the relatively few Serendipity users and as time goes by I'm sure this will change.
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
Yes, the guestbook plugins is one of the plugins that I personally disregard.
Timbalu worked on smartifying the plugin (version 2.0) but it has some bugs that prevent its execution. I've yet had no time to look into that, but I still have planned to do that. But my server currently has no second ethernet card, so I can't get it online.
But I'm quite sure that step by step we'll be able to upgrade the plugins to use better templating.
regards,
Garvin
Yes, the guestbook plugins is one of the plugins that I personally disregard.
Timbalu worked on smartifying the plugin (version 2.0) but it has some bugs that prevent its execution. I've yet had no time to look into that, but I still have planned to do that. But my server currently has no second ethernet card, so I can't get it online.
But I'm quite sure that step by step we'll be able to upgrade the plugins to use better templating.
regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
-
carl_galloway
- Regular
- Posts: 1331
- Joined: Sun Dec 04, 2005 5:43 pm
- Location: Andalucia, Spain
- Contact:
I've found a temporary fix for event plugins that use the static pages pagetile but not the static pages.tpl file, and this allows me to add extra wrapper divs around event plugins that have been causing me problems.
What I've done is place an assign inside each of the static pages .tpl files,
then in my entries file I've add an if statement to check the variable, and then add my wrapper
I know this is a bit of a hack but it works, and lets me continue styling the hemingway template to make all event plugins work (so far tested against guestbook, faq, download manager, media gallery)
I would still like to work on improvements to plugins and smartyfication, but at least I can now work on sidebar plugins and language support.
Carl
What I've done is place an assign inside each of the static pages .tpl files,
Code: Select all
{assign var="is_static_page" value="yes"}
Code: Select all
{if !$is_static_page =="yes"}
perform wrapper
{/if}
I would still like to work on improvements to plugins and smartyfication, but at least I can now work on sidebar plugins and language support.
Carl