Staticpage backend templates not working

Found a bug? Tell us!!
Post Reply
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Staticpage backend templates not working

Post by Don Chambers »

In the past, a theme could customize static page backends, thereby offering unique staticpage variables.

The way I think we did this was for a theme folder to have a /backends_templates/ folder, and then to provide the actual smarty template "default_staticpage_backend.tpl" within that folder.

This definitely works < s9y 2.0. Does not work in s9y 2.0

Plus, the js doesn't look the same as everything else in 2.0. ie, Toggle/Expand all.
=Don=
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: Staticpage backend templates not working

Post by yellowled »

I don't know about the static page templates, but if so, that's definitively a bug. Then again, Ian has put a lot of work into a a rewrite of the static pages plugin, which is supposed to replace the one in additional plugins.

In general, quite a lot of the additional plugins are not adapted for 2.0 yet, meaning the backend section they create (CSS/JS) is not fully adapted to the new backend. We decided that this should not be a release blocker for 2.0 as long as the basic functionality of the important, most used plugins works.

YL
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Staticpage backend templates not working

Post by garvinhicking »

Possibly the new "backend" vs. "frontend" theme distinction is catching here.

Did you try to put the backend_templates directory into the "admin/" subdirectory of a theme directory? And if you have a different frontend theme than backend theme, did you try to put this directory into both the frontend and backend theme directory? Could be a mixup there.
# 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/
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Re: Staticpage backend templates not working

Post by Don Chambers »

garvinhicking wrote:Did you try to put the backend_templates directory into the "admin/" subdirectory of a theme directory? And if you have a different frontend theme than backend theme, did you try to put this directory into both the frontend and backend theme directory? Could be a mixup there.
I am working with a theme that does not provide a custom /admin/ theme. Are you suggesting I create that folder just for the backend_templates? ie, /templates/mytemplatefolder/admin/backend_templates/?
=Don=
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Re: Staticpage backend templates not working

Post by Don Chambers »

yellowled wrote:I don't know about the static page templates, but if so, that's definitively a bug. Then again, Ian has put a lot of work into a a rewrite of the static pages plugin, which is supposed to replace the one in additional plugins.

In general, quite a lot of the additional plugins are not adapted for 2.0 yet, meaning the backend section they create (CSS/JS) is not fully adapted to the new backend. We decided that this should not be a release blocker for 2.0 as long as the basic functionality of the important, most used plugins works.

YL
So this new version on gitub is still a development version, and is not the same as what I am using? Does it support a theme-specific backend smarty template? I have a few themes that I am converting/writing to work with s9y2.0, and they are dependent on having custom staticpage backend and frontend smarty templates as they create fields the plugin does not have.
=Don=
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: Staticpage backend templates not working

Post by yellowled »

Don Chambers wrote:So this new version on gitub is still a development version, and is not the same as what I am using?
Yes, it is still in development. It is a fork of the version on Spartacus, so it's based on the same code, not a completely new static pages plugin.
Don Chambers wrote:Does it support a theme-specific backend smarty template?
Yes, of course.

YL
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Re: Staticpage backend templates not working

Post by Don Chambers »

Don Chambers wrote:Are you suggesting I create that folder just for the backend_templates? ie, /templates/mytemplatefolder/admin/backend_templates/?
This did not work either.
Don Chambers wrote:Does it support a theme-specific backend smarty template?
yellowled wrote:Yes, of course.
If it is very close to being the official replacement, I can give it a try. Otherwise, I will need to beg for assistance in trying to solve the problem with the existing plugin. :wink:
=Don=
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Re: Staticpage backend templates not working

Post by Don Chambers »

OK, I downloaded the developmental version .... I cannot edit any existing staticpage, nor create any new static pages... I simply get a blank white screen if I try.

I don't think the issue of /backend_templates/ not working was related to the staticpage plugin. I had the same version of the plugin on three different sites. It works fine on sites running 1.6.2 and 1.7.8. IT does not work on a site running s9y 2.0.
=Don=
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Staticpage backend templates not working

Post by garvinhicking »

Hi!

Try to put the file inside any of these directories and see if any of it works:

/templates/mytemplatefolder/admin/backend_templates/
/templates/mytemplatefolder/backend_templates/
/templates/2k11/admin/backend_templates/
/templates/2k11/backend_templates/
/templates/default/admin/backend_templates/
/templates/default/backend_templates/
# 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/
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Re: Staticpage backend templates not working

Post by Don Chambers »

/templates/mytemplatefolder/admin/backend_templates/ - No.
/templates/mytemplatefolder/backend_templates/ - No
/templates/2k11/admin/backend_templates/ - No
/templates/2k11/backend_templates/ YES!
/templates/default/admin/backend_templates/ No.
/templates/default/backend_templates/ - Also YES
=Don=
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Staticpage backend templates not working

Post by Timbalu »

Yeah, this is a bug. Good you found that!
This is a matter of the changed API function serendipity_getTemplateFile(). It was a plain straight and simple template fallback chaining with pre 2.0 installations before. Since this new backend "mode", it was made "somehow" more complicated for the preview file and to allow the new backend only, but do not use older /admin/ template structures. Thus the usual (old) template fallback was only allowed for frontend calls. While developing we found one case where this broke something and defined a force fallback command for it, eg

Code: Select all

serendipity_getTemplateFile('useInBackend.tpl', 'serendipityPath', true)
But, and this is actually the problem, forgot to add this new property to every call, which is not related to the new backend, but also happens in the backend. Staticpage is one of this (rare) cases. To fix this currently in plugins (and maybe other places) just add a " , true " as a third parameter to the serendipity_getTemplateFile() call. In example for staticpages

Code: Select all

            if ($serendipity['version'][0] < 2) {
                $tfile = serendipity_getTemplateFile('backend_templates/' . $filename, 'serendipityPath'); // old API
            } else {
                $tfile = serendipity_getTemplateFile('backend_templates/' . $filename, 'serendipityPath', true); // force fallback
            }
This is somehow bad, since we do not really know, if there are Plugins out in the wild, which do not use Spartacus and await the old API to use the "old" chaining. I am not sure if that is a staticpage only issue, but I fixed this already for Spartacus tomorrow.
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Re: Staticpage backend templates not working

Post by Don Chambers »

Awesome. Thanks! I'll check it out.
=Don=
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Re: Staticpage backend templates not working

Post by Don Chambers »

It does seem to be working correctly again. Thanks Ian!

This is not new, but check the plugin's configuration page. There are three empty <div>'s being emitted after "Show Childpages" option.
=Don=
Post Reply