$view not working with serendipity_event_customarchive

Creating and modifying plugins.
Post Reply
Christine
Regular
Posts: 54
Joined: Wed Mar 25, 2009 11:50 pm

$view not working with serendipity_event_customarchive

Post by Christine »

I was trying to add {if $view == 'entry'} to a template and not getting the results I expected. After looking at this thread, I decided to test if it might be a plugin and found the culprit was serendipity_event_customarchive.

How can I possibly remedy this without disabling this plugin? I tried adding 'return true;' after 'case 'genpage':' as suggested at the thread above but it made no difference here.
Last edited by Christine on Mon Aug 07, 2017 6:36 pm, edited 1 time in total.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: $view not to working with serendipity_event_customarchiv

Post by garvinhicking »

Which Serendipity version are you using?

Did you actually try to disable the customarchive plugin and does your template check on $view then work? Because actually inserting the "return true" in the genpage hook of the plugin file should really bypass any other assignment of the serendipity viewtype.

To test this, could you add a:

Code: Select all

die('init1');
after serendipity_smarty_init in serendipity_event_customarchive for the first occurence, and a

Code: Select all

die('init2');
after the second one? Then also add that "return true" statement in the genpage hook. Then open the page and check if you get any of the init1/2 output statements?

When you print {$view} in your template file, do you get an empty string or is it set to "default"?

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/
Christine
Regular
Posts: 54
Joined: Wed Mar 25, 2009 11:50 pm

Re: $view not to working with serendipity_event_customarchiv

Post by Christine »

garvinhicking wrote:Did you actually try to disable the customarchive plugin and does your template check on $view then work?
Yes, I did a fresh install (2.1.1) of Serendipity and added the plugins once at a time until the problem occurred. Then I disabled all but customarchive. Then I disabled and reenabled customarchive and yes, $view would only work when it was disabled. I then went to my active blog (2.0.3) and disabled it and same deal - $view only working when customarchive disabled. (By the way, $category was working fine).
Because actually inserting the "return true" in the genpage hook of the plugin file should really bypass any other assignment of the serendipity viewtype.
I don't know what's happened, but it's working now. I tested it repeatedly in both versions, hard refresh, clearing cache etc., but it did nothing. My site was down this morning and my hosting has just restarted the server, maybe that did it? I have no idea, but there's nothing else that changed.

Is it OK to leave the 'return true' in the genpage hook if it's working, or would it affect something else?
zarzanola
Regular
Posts: 15
Joined: Mon Jul 03, 2017 10:34 am

Re: $view not to working with serendipity_event_customarchiv

Post by zarzanola »

garvinhicking wrote:Which Serendipity version are you using?

Did you actually try to disable the customarchive plugin and does your template check on $view then work? Because actually inserting the "return true" in the genpage hook of the plugin file should really bypass any other assignment of the serendipity viewtype.

To test this, could you add a:

Code: Select all

die('init1');
after serendipity_smarty_init in serendipity_event_customarchive for the first occurence, and a

Code: Select all

die('init2');
after the second one? Then also add that "return true" statement in the genpage hook. Then open the page and check if you get any of the init1/2 output statements?

When you print {$view} in your template file, do you get an empty string or is it set to "default"?

Regards,
Garvin
For which versions of serendipity would this work?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: $view not to working with serendipity_event_customarchiv

Post by garvinhicking »

Hi!

It would work for any s9y version after 2.0 - where we upgraded to Smarty 3, which required us to change some init things around.

@Christine: The additional smarty init is there for the case that the archive plugin is called on pages or embedded blogs, where the smarty object has not yet been initiated. In normal operation it should exist, but this duplicate call will then instantiate a fresh smarty object without the assigned global variables. I will need to think of a way to not perform this step, but I would need to gather all the circumstancial variables to not break things on another end. For the time being I'd suggest to use this workaround...
# 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/
zarzanola
Regular
Posts: 15
Joined: Mon Jul 03, 2017 10:34 am

Re: $view not to working with serendipity_event_customarchiv

Post by zarzanola »

So no versions before 2.0 would be suitable?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: $view not to working with serendipity_event_customarchiv

Post by garvinhicking »

zarzanola wrote:So no versions before 2.0 would be suitable?
I don't remember, but you shouldn't run those older versions of serendipity anymore anyways ;)
# 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/
Post Reply