Page 1 of 1

$view not working with serendipity_event_customarchive

Posted: Tue Jul 11, 2017 7:11 pm
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.

Re: $view not to working with serendipity_event_customarchiv

Posted: Wed Jul 12, 2017 4:02 pm
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

Re: $view not to working with serendipity_event_customarchiv

Posted: Thu Jul 13, 2017 2:40 am
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?

Re: $view not to working with serendipity_event_customarchiv

Posted: Mon Jul 17, 2017 9:17 am
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?

Re: $view not to working with serendipity_event_customarchiv

Posted: Wed Jul 26, 2017 11:42 am
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...

Re: $view not to working with serendipity_event_customarchiv

Posted: Wed Aug 02, 2017 11:47 am
by zarzanola
So no versions before 2.0 would be suitable?

Re: $view not to working with serendipity_event_customarchiv

Posted: Wed Aug 02, 2017 1:27 pm
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 ;)