Page 1 of 1

Templating depending on s9y version

Posted: Thu Dec 18, 2008 4:13 pm
by yellowled
Is there a proper way to have template features depending on the s9y version? I know there's {$head_version}, but I can't use that for something like this, right?

Code: Select all

{if $head_version >= 1.4} ... {else} ... {/if}
(Because it seems to emit the "full" version, including beta status, probably as text.)

I expect quite some trouble with some templates once 1.4 is released, and a statement like above would make it way easier to handle those. Fixing these for 1.4 might cause problems with smaller version numbers, so having a "greater-than-1.4"-stylesheet would be very helpful.

I realize it's short notice, but would it be possible to add something like that?

YL

Re: Templating depending on s9y version

Posted: Thu Dec 18, 2008 6:17 pm
by garvinhicking
Hi!

True, you cannot use that check. But you can use "version_compare" PHP function, put it inside config.inc.php of your template and set a s9y variable that you might need.

The version_compare logic is a bit strange, so you might want to read the PHP.net documentation and ESPECIALLY the user notices there for some example codes.
I expect quite some trouble with some templates once 1.4 is released, and a statement like above would make it way easier to handle those. Fixing these for 1.4 might cause problems with smaller version numbers, so having a "greater-than-1.4"-stylesheet would be very helpful.
Hm, that's very bad. Maybe there's a way to change 1.4 so that those problems are less likely to appear?

Which changes exactly cause the trouble? We must evaluate if the trouble that it introduces is worth the benefit the changes provide.

Regards,
Garvin

Re: Templating depending on s9y version

Posted: Thu Dec 18, 2008 8:48 pm
by yellowled
garvinhicking wrote:The version_compare logic is a bit strange, so you might want to read the PHP.net documentation and ESPECIALLY the user notices there for some example codes.
Expect a desperate cry for help if I'm unable to understand it :-)

BTW: Remember back in the day when we first started using the code for the customizable navbar? Some templates still have code like this, i.e. andreas09:

Code: Select all

{if $head_version < 1.1}
	<!-- ****** Change navbar links here ****** -->
    	<li><a href="#">About</a></li>
    	<li><a href="#">Photos</a></li>
    	<li><a href="#">Music</a></li>
    	<li><a href="#">Contact</a></li>
	{else}
        ...
So is there a good reason not to use this:

Code: Select all

{if $head_version < 1.4} ... {else} ... {/if}
other than "it wouldn't work with a beta version? (And please don't ask me why I didn't remember this earlier - I don't know :))
garvinhicking wrote:Maybe there's a way to change 1.4 so that those problems are less likely to appear?
Yes, there is, but we don't want to take that way. It would be to revert all the (necessary, long overdue!) changes I made to the emitted HTML code in the core plugins. You remember "operation havoc", right? When we decided to do those changes, we were aware of the issues it might cause with older templates (older templates meaning: everything created before the changes), which is why I went through all the core templates as well, adding changes to the style.css files.

However, there are a lot of templates which are not in the core and have not been adapted to these changes. Most of them are also much more sophisticated than the templates shipped with s9y, especially in terms of CSS.
garvinhicking wrote:Which changes exactly cause the trouble?
Well, the WP Premium thread in the German forum is a good example. WP Premium uses a lot of CSS wizardry to compensate for the fact that some of the core plugins emitted, let's just say it, HTML which wasn't semantically correct. Now that these plugins emit the correct HTML (in this case: an ul), the CSS doesn't produce the intended result.

Then again, WP Premium is a WP port, which in this particular example is kind of also the reason why the new code isn't working: The original's stylesheet wasn't created for an ul which also has the XML icon we use in the syndication or list of authors sidebar plugin. (My rambling must sound pretty confusing. Hang in.)

So maybe I'm being a little too careful here. A lot of templates will work just fine with some minor changes to the style.css. The number of templates where issues like in WP Premium will surface is probably rather small. It will also probably be almost only WP ports.
garvinhicking wrote: We must evaluate if the trouble that it introduces is worth the benefit the changes provide.
By any means, yes, it is worth the benefit! Having plugins which emit strange, non-semantic HTML is not the way to go! We have to follow that road of editing the HTML code s9y emits to semantically sound HTML by any means, even if it means that some templates will look funny until we provide fixes for them!

(Which is why I was actually suggesting the version-dependant CSS files: So we can ensure backwards compatibility for those users who can't choose to switch to the latest version, but do have access to the latest version of a template.)

Actually, I have one or two things in mind to change in the HTML the core emits, for example the code for inserting images from the media db. But that can and will have to wait until after the 1.4 release :)

YL

Posted: Thu Dec 18, 2008 11:14 pm
by Don Chambers
I think version specific stylesheets are asking for trouble.... it is already a PITA to deal with little quirks of IE5, IE6, IE7, etc....

Release 1.4, see what "hits the fan", and fix templates as necessary. You already provided a good example of fixing most sidebar plugins with the css added to the bottom of the bp stylesheet..... that same code will probably solve a decent percentage of most templates that encounter problems, and if not, those who do not know how to fix it themselves can ask for assistance here.

Just my 2 cents. :wink:

Posted: Thu Dec 18, 2008 11:28 pm
by yellowled
Don Chambers wrote:I think version specific stylesheets are asking for trouble.... it is already a PITA to deal with little quirks of IE5, IE6, IE7, etc....
True. And to support the point I was making earlier even further: It sure can't hurt to have semantically sound HTML to handle those quirks better. (Although support for IE5 really shouldn't be an issue any longer. User numbers for that are way below 1% now.)
Don Chambers wrote:Release 1.4, see what "hits the fan", and fix templates as necessary.
See, there's one little problem with that: Releasing a new version and adding fixes after that release is not exactly desirable. Then again, we had to take this step sooner or later, and we simply don't have the manpower to test and fix all the templates and/or plugins.

It's just a pity that this may result in a rather quick point release for 1.4 since we may have to edit some of the core plugins/templates ...

YL

Posted: Thu Dec 18, 2008 11:41 pm
by Don Chambers
Why would you suspect a quick point release? I thought you went through all the core plugins, cleaned up their emitted html, then went through the core templates and added styles to deal with the plugin changes... no?

I do agree that the plugins should emit semantically correct html, and more importantly, not hard code things that should be controlled by css (such as forced break lines).

Maybe I'm still not getting your point, which is entirely possible given how my day has gone today!! :wink:

Posted: Thu Dec 18, 2008 11:48 pm
by yellowled
Don Chambers wrote:I thought you went through all the core plugins, cleaned up their emitted html, then went through the core templates and added styles to deal with the plugin changes... no?
Yes, I did. For the core templates. Almost nobody uses those, BP being the only exception. And as far as I can see, almost no additional template in spartacus has been fixed.

Maybe I'm just getting antsy because nobody really checked what I did in the code :lol:

YL

Posted: Fri Dec 19, 2008 9:39 am
by u1amo01
Hmm, looks like we need template beta testers ;-)

IMHO it's impossible to test all plugins with all templates. Maybe we could try to test all templates delivered by spartacus with the, hm, "default" templates?

That's still a lot of work I think; you'll need two installations, one with s9y stable and one with a beta 1.4, a dozen of browsers for testing ... uh. :(

Posted: Fri Dec 19, 2008 3:47 pm
by yellowled
yellowled wrote:Maybe I'm just getting antsy because nobody really checked what I did in the code :lol:
I guess that's really it. I just now checked some more sophisticated templates like Mimbo or i3theme, and both work just fine in 1.4.

It's still possible we're gonna experience some issues with templates in 1.4, but those will most likely be WP ports. It's rather unlikely we'll find serious issues with pure s9y templates.

Sorry for making such a wave here :oops:

YL

Posted: Fri Dec 19, 2008 4:26 pm
by u1amo01
No problem. Just go and port someting nice as compensation :P