Proposal: child themes

Discussion corner for Developers of Serendipity.
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: Proposal: child themes

Post by yellowled »

Don Chambers wrote:That is my whole point - I would not want to provide duplicate smarty templates if they are identical to /default/
I'd be fine with a "if nothing else, fall back to default" option, too. Garvin?

YL
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: Proposal: child themes

Post by yellowled »

After some time & some testing, some more insight on this: We already found out that a config.inc.php, even using the new core navigation, as well as the corresponding lang files need to be present in the child theme's directory.

I'm fine with that, but just found something else which really bugs me.

I'm working with an engine template which uses some JS files. Those are referenced in the index.tpl like this (adapted from BP):

Code: Select all

<script src="{$serendipityHTTPPath}templates/{$template}/js/myscript.js">
But in a child theme which only has an info.txt and a style.css (like the mt-* themes), this does not fall back to the engine template's copy of the JS file, but expects the file to be present in the child theme directory, which is kind of a bummer.

Any way around this?

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

Re: Proposal: child themes

Post by Don Chambers »

And FYI, although we did it in BP, and I have done it in other templates, understand that the hard coded path 'templates' would be incorrect if anyone changed the default "relative template path" in their s9y configuration.
=Don=
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: Proposal: child themes

Post by yellowled »

Don Chambers wrote:And FYI, although we did it in BP, and I have done it in other templates, understand that the hard coded path 'templates' would be incorrect if anyone changed the default "relative template path" in their s9y configuration.
I'm assuming if somebody were to change that path (seems highly unlikely to me), he/she would know to edit 3rd party templates accordingly.

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

Re: Proposal: child themes

Post by garvinhicking »

Hi!

The js file simply needs to be fetched also with {serendipity_getFile}.

I assume I suggested to not do this to save some performance pennies.

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/
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: Proposal: child themes

Post by yellowled »

garvinhicking wrote:The js file simply needs to be fetched also with {serendipity_getFile}.
Oh. Yes, that might work. :)

I'll check it ASAP, meaning tomorrow. :wink: Thanks, Garvin.

YL

Edit: Perfect. Works. :)
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Proposal: child themes

Post by Timbalu »

I have a problem regarding the template engine thing.

I came up doing this since I wanted to get rid of #content { ... width: auto; }, knowing it can be easily overwritten in mytemplates css file, but I wanted to play around and tried with changing the default engine!

This is what I have done so far. I tried with templates/mytemplate/:
info.txt
...
engines: new_default

created a new template folder templates/new_default and did not forget to set its info.txt to
Name: new_default

copied all default stuff to new default and changed in style.css some #content values
I even created a config.inc.php.

But in mytemplate it always jumps in serendipity.css to default/style.css without taking notice of my new_default engine.

Also I tried to disable the css in default, but still no switch to new_default. I also found out we can't disable the admin folder without getting a smarty template error.

Now my questions.
Did I forget something?
Is that a behaviour which is intended or did I just didn't understand what the engine thing is all about...? ;-) What are your experiences so far?
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: Proposal: child themes

Post by yellowled »

Timbalu wrote:What are your experiences so far?
Haven't really worked with this in quite a while. Assuming you're using a recent dev snapshot, permissions are correct, cleaned out templates_c etc., i.e. the usual stuff:

* Have you tried setting "engine: new_default,default"?
* Do both mytemplate and new_default show up in the theme list?

YL
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Proposal: child themes

Post by Timbalu »

Thank you: yes, yes, yes!
But after some "hin und her", I just decided to submit my template style again.
And this did it finally, I think. ;-)

The fall back setting to whatever, however, seems extremly sticky.
I have not really found the point by now how to switch to disable being sticky by cutting down the new_default settings. I can still run it by having no config.inc, no lang. Time will say more about this...
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: Proposal: child themes

Post by yellowled »

Timbalu wrote:The fall back setting to whatever, however, seems extremly sticky.
I don't understand what you mean by that.
Timbalu wrote:I can still run it by having no config.inc, no lang.
If you use the navigation which is integrated in the s9y core, you need at least one theme option for it to work. This can be a dummy option. See the respective thread about core navigation.

YL
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Proposal: child themes

Post by Timbalu »

It just means I havent found by now the very minimum setting required to turn this on/off. ;-)

I did read the thread about the external navigation.
I still have the new_default/config.inc.php file, but I can rename/disable it without any problems. Maybe its meant to be the one in the parent 'myTemplate', which is relevant?
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: Proposal: child themes

Post by yellowled »

Timbalu wrote:It just means I havent found by now the very minimum setting required to turn this on/off. ;-)
Still not sure I get what you want to do or have issues with. However, since this is actually a rather old feature which everyone completely forgot about, I don't assume a config.inc.php is a necessary element of a child or engine theme. (Garvin should definitely comment on this after his vacation.)

As far I understand it, an engine template is supposed to have all files default has, which is why the recommendation to use default as the "ultimate" fallback engine is actually a good one for the time being. Helps keep the "actual" engine template tidy.

YL
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Proposal: child themes

Post by Timbalu »

yellowled wrote:As far I understand it, an engine template is supposed to have all files default has, which is why the recommendation to use default as the "ultimate" fallback engine is actually a good one for the time being. Helps keep the "actual" engine template tidy.
No, not true ...
I only have a info.txt and a style.css in new_default.
Images and smileys in entries and plugins fall back to default.

Be aware moving some url({TEMPLATE_PATH}img/background.png) rules inside style.css to your parents default style with the image to its img folder.

So now you can tidy up new_default/style.css to be modern, like avoiding #content { with: auto; } but not supporting images via css. I think, this is what Garvin meant creating a ~'serendipity2' folder as the default fallback for modern Serendipity 2.0 themes, without scratching old behaviour.
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Proposal: child themes

Post by Timbalu »

Some more ....

Code: Select all

$serendipity['defaultTemplate'] = 'bulletproof';
is set generally in serendipity_config.inc.php

$serendipity['template_engine'] is build by engine
( and I really think minus the defaultTemplate to avoid doubles )
my info.txt says

Code: Select all

engine: new_default,bulletproof,default
Even after submitting your parents template config again, the $serendipity['template_engine'] says:

Code: Select all

$serendipity['template_engine'] == new_default,default
I would still presume it follows (myTemplate) ->new_default ->bulletproof ->default on the way falling back, differing in which file searching for css - other files via path or getfile - {TEMPLATE_PATH} - and or other path building functions.
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: Proposal: child themes

Post by yellowled »

Timbalu wrote:I would still presume it follows (myTemplate) ->new_default ->bulletproof ->default on the way falling back, differing in which file searching for css - other files via path or getfile - {TEMPLATE_PATH} - and or other path building functions.
I guess we can assume a lot, we'll have to wait for Garvin to comment on this. :lol:

Personally, I think this would be, well, not ideal. We should be able to use just one engine template at some point without having to carry along BP and default for ages.

YL
Post Reply