Board index Plugins $view not to working with serendipity_event_customarchive

Creating and modifying plugins.
Christine
Regular
 
Posts: 42
Joined: Thu Mar 26, 2009 12:50 am

Postby Christine » Tue Jul 11, 2017 7:11 pm

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.

User avatar
garvinhicking
Core Developer
 
Posts: 29959
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany

Postby garvinhicking » Wed Jul 12, 2017 4:02 pm

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: 42
Joined: Thu Mar 26, 2009 12:50 am

Postby Christine » Thu Jul 13, 2017 2:40 am

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: 8
Joined: Mon Jul 03, 2017 10:34 am

Postby zarzanola » Mon Jul 17, 2017 9:17 am

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?

User avatar
garvinhicking
Core Developer
 
Posts: 29959
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany

Postby garvinhicking » Wed Jul 26, 2017 11:42 am

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/



Return to Plugins

Who is online

Users browsing this forum: No registered users and 1 guest

cron