Page 1 of 1

Staticpage backend templates not working

Posted: Thu Jan 29, 2015 5:56 am
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.

Re: Staticpage backend templates not working

Posted: Thu Jan 29, 2015 10:09 am
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

Re: Staticpage backend templates not working

Posted: Thu Jan 29, 2015 10:35 am
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.

Re: Staticpage backend templates not working

Posted: Thu Jan 29, 2015 3:50 pm
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/?

Re: Staticpage backend templates not working

Posted: Thu Jan 29, 2015 3:59 pm
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.

Re: Staticpage backend templates not working

Posted: Thu Jan 29, 2015 4:13 pm
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

Re: Staticpage backend templates not working

Posted: Thu Jan 29, 2015 4:38 pm
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:

Re: Staticpage backend templates not working

Posted: Thu Jan 29, 2015 6:08 pm
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.

Re: Staticpage backend templates not working

Posted: Fri Jan 30, 2015 2:36 pm
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/

Re: Staticpage backend templates not working

Posted: Fri Jan 30, 2015 5:39 pm
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

Re: Staticpage backend templates not working

Posted: Sat Jan 31, 2015 12:08 pm
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.

Re: Staticpage backend templates not working

Posted: Sat Jan 31, 2015 4:34 pm
by Don Chambers
Awesome. Thanks! I'll check it out.

Re: Staticpage backend templates not working

Posted: Sun Feb 01, 2015 7:14 pm
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.