PDA

View Full Version : Output templates


HeavyEddie
01-17-2006, 03:14 PM
OK, so I've been reading several of the posts and it seems many questions are asked about changing the appearnce of a plugin. Sure, we have skins that change the general look, but people who aren't comfortable with tinkering inside a PHP script are pretty much stuck with the plugin designers look & feel.

Why not create a global function (spib's blog made me think of this) that reads an html file from the plugin directory, replaces keywords with variables and use that for the output?
This would allow the average user to tinker with the html and not screw up the script.
This would allow skinners to extend their skins to popular plugins.
The function call could be something like this.
output($template, $keyword, $var_to_replace_with)

Robert_J_Ellis
01-17-2006, 03:37 PM
<div class='quotetop'>QUOTE(HeavyEddie &#064; Jan 17 2006, 11&#58;14 AM) 3104</div>
OK, so I&#39;ve been reading several of the posts and it seems many questions are asked about changing the appearnce of a plugin. Sure, we have skins that change the general look, but people who aren&#39;t comfortable with tinkering inside a PHP script are pretty much stuck with the plugin designers look & feel.

Why not create a global function (spib&#39;s blog made me think of this) that reads an html file from the plugin directory, replaces keywords with variables and use that for the output?

This would allow the average user to tinker with the html and not screw up the script.

This would allow skinners to extend their skins to popular plugins.

The function call could be something like this.
output(&#036;template, &#036;keyword, &#036;var_to_replace_with)
[/b]

Two words, smarty templates :). Used in many php programs.

spib
01-17-2006, 03:38 PM
Yes this is broadly how templating systems such as http://smarty.php.net work. We recognise that the skinning functionality isn&#39;t perfect as it is but we have backwards compatibility to contend with as well as a hundred or so plugins which would all need to be revisited.

Robert_J_Ellis
01-17-2006, 03:41 PM
<div class='quotetop'>QUOTE(spib &#064; Jan 17 2006, 11&#58;38 AM) 3109</div>
Yes this is broadly how templating systems such as http://smarty.php.net work. We recognise that the skinning functionality isn&#39;t perfect as it is but we have backwards compatibility to contend with as well as a hundred or so plugins which would all need to be revisited.
[/b]

Well, I think with everything considered you guys are doing a great job of keeping things fresh. These things will come in time, and it&#39;ll be worth the wait.

HeavyEddie
01-17-2006, 04:18 PM
<div class='quotetop'>QUOTE(spib &#064; Jan 17 2006, 11&#58;38 AM) 3109</div>We recognise that the skinning functionality isn&#39;t perfect as it is but we have backwards compatibility to contend with as well as a hundred or so plugins which would all need to be revisited. [/b]

No doubt it is easier to come up with the idea than to implement it :) Maybe 3.0, since people come to expect such changes on major releases.

Although... I don&#39;t understand how it would create a backwards compatibility issue though. If starting at 2.3 or 3.0 :), this function was available older plugins should still would work fine. All the formating is hardcoded into the plugin. The difficult part would be explaining to folks that some of the newer plugins would not work unless you are using 2.3.

<div class='quotetop'>QUOTE(Robert_J_Ellis &#064; Jan 17 2006, 11&#58;41 AM) 3111</div>
Well, I think with everything considered you guys are doing a great job of keeping things fresh. These things will come in time, and it&#39;ll be worth the wait. [/b]

No doubt in my mind. I&#39;ve only been using the product a couple of weeks and haven&#39;t enjoyed myself this much in a long time.



Hmmmmm.... I looked at smarty a little bit. Wow&#33; That is powerful. Something like that in 3.0 would be amazing&#33;

IGGY
01-17-2006, 04:55 PM
I&#39;m not sure if this what were talking about, but maybe following some standards could be very useful.

For one I have noticed that some plugins don&#39;t follow W3C standards, which is also the reason why SD is not XHTML valid.

If we can have a standard system when creating plugins that display an out put to the page, I think that would fix many problems. It would only be a matter of changing some css to acheive the change that you wanted.

spib
01-17-2006, 05:04 PM
Yes that&#39;s what we&#39;re discussing. Also, Subdreamer 2.3 is valid xhtml 1.0 transitional (including all the core plugins)

abcohen
01-17-2006, 05:14 PM
I think the best system is some code that looks for a plugin/skin type variable so it knows how to handle it...

ie. in the install.php &#036;skintype=classic would handle it the current way or you cah have &#036;skintype=smarty and it would handle it a totally different way...

I think that works for plugins too...

Robert_J_Ellis
01-17-2006, 05:31 PM
<div class='quotetop'>QUOTE(abcohen &#064; Jan 17 2006, 01&#58;14 PM) 3115</div>
I think the best system is some code that looks for a plugin/skin type variable so it knows how to handle it...

ie. in the install.php &#036;skintype=classic would handle it the current way or you cah have &#036;skintype=smarty and it would handle it a totally different way...

I think that works for plugins too...
[/b]

Very good point Abc. That would kill two birds with one stone :).

spib
01-17-2006, 05:58 PM
It&#39;s an interesting idea but for something like the download manager it wouldn&#39;t be practical because of the amount of html generated in there. We&#39;ll come up with something :)

IGGY
01-17-2006, 06:27 PM
<div class='quotetop'>QUOTE(abcohen &#064; Jan 17 2006, 10&#58;14 AM) 3115</div>
I think the best system is some code that looks for a plugin/skin type variable so it knows how to handle it...

ie. in the install.php &#036;skintype=classic would handle it the current way or you cah have &#036;skintype=smarty and it would handle it a totally different way...

I think that works for plugins too...
[/b]


This is very simalar to the way the hover menu works. It has specific tags that you can load in the categories.php or from an external CSS file.

An alternative is the way phpBB has it in their template system.

they have variables like {td toprow} that you put in the class tags. Then from the ACP you can change the color.

We could have a similar setting like this in the SD ACP similar to the language control but for plugin colors instead.

HeavyEddie
01-18-2006, 11:13 PM
<div class='quotetop'>QUOTE(abcohen &#064; Jan 17 2006, 01&#58;14 PM) 3115</div> I think the best system is some code that looks for a plugin/skin type variable so it knows how to handle it...

ie. in the install.php &#036;skintype=classic would handle it the current way or you cah have &#036;skintype=smarty and it would handle it a totally different way...

I think that works for plugins too... [/b]

I think this makes perfect sense for when subdreamer implements this, if they use smarty or something similar as an engine... woe baby&#33; Hold on&#33;

I&#39;ve gone through a few scripts that do a simple template process and it appears it is really nothing more than string replacements. Nothing is stopping a current plugin designer from doing this already. Am I over simplifying this? Read template into the &#036;HTML variable
Calculate code and simply store the results in other Variables... Var1, Var2 & Var3
perform a string replace and insert Var1,2 &3 into &#036;HTML
output &#036;HTML

Robert_J_Ellis
01-19-2006, 12:05 AM
Nope you&#39;re not over simplifying things, someone *cough may be planning to use this soon ^^. Will most likely take some time though.

HeavyEddie
02-01-2006, 02:46 PM
I&#39;m not sure if anyone noticed... but I&#39;ve been playing with this a little already. I&#39;m using a simple template to generate the event planner plugin.

I&#39;ve been thinking of a way to get repeated output without having to create a seperate template for it. While doing some lame end of month work, I think I have it :)