Smartyfication of existing plugins mini-HowTo, pls

Discussion corner for Developers of Serendipity.
Post Reply
LazyBadger
Regular
Posts: 176
Joined: Mon Aug 25, 2008 12:25 pm
Location: Russia
Contact:

Smartyfication of existing plugins mini-HowTo, pls

Post by LazyBadger »

Using part of serendipity_smarty_init() from serendipity_event_relatedlinks (or any other templated plugin) as live example
Quis custodiet ipsos custodes?
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Smartyfication of existing plugins mini-HowTo, pls

Post by Timbalu »

Dear LazyBadger

I can't follow you!
You are posting/talking like the Delphi Oracle... is it spam, is it a question, is it a reminder for yourself, is it ... :?:
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
LazyBadger
Regular
Posts: 176
Joined: Mon Aug 25, 2008 12:25 pm
Location: Russia
Contact:

Re: Smartyfication of existing plugins mini-HowTo, pls

Post by LazyBadger »

It's easy
I
- ask
- some hints
- in the area of converting hardcoded front-end output of plugin into templated output, as it was done with serendipity_event_relatedlinks
- for existing plugin (namely - event_freetag)
Quis custodiet ipsos custodes?
onli
Regular
Posts: 2825
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: Smartyfication of existing plugins mini-HowTo, pls

Post by onli »

event_freetag is already smartified. Or: which area of it?
LazyBadger
Regular
Posts: 176
Joined: Mon Aug 25, 2008 12:25 pm
Location: Russia
Contact:

Re: Smartyfication of existing plugins mini-HowTo, pls

Post by LazyBadger »

onli wrote:event_freetag is already smartified.
Less than wanted. This part drive me nuts

Code: Select all

    function displayTagCloud($tag)
    {
        $tags = $this->getTagCloudTags($tag);

        echo '<div class="serendipity_Entry_Date freetag_cloud">';
        echo '<h2 class="serendipity_date">';
        $tagTitle = is_array($this->displayTag) ? implode(' + ',$this->displayTag) : $this->displayTag;
        printf (PLUGIN_EVENT_FREETAG_USING, htmlspecialchars($tagTitle));
        echo '</h2>';
        echo '<div class="serendipity_freetag_taglist">';
        echo '<p class="serendipity_freetag_taglist_related">' . PLUGIN_EVENT_FREETAG_RELATED_TAGS . '</p>' . "\n";
In real life it's on top of all /plugin/tag/* pages before first entry
Quis custodiet ipsos custodes?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Smartyfication of existing plugins mini-HowTo, pls

Post by garvinhicking »

Hi!

We really appreciate your input and feedback, and work on Serendipity. But it's really, really hard to understand your postings. You seem to have a good english vocabulary, but you really need to write longer sentences that better explain what you are thinking/talking about.

As for the code of your related tags - there's a configuration option in the plugin that toggle if the cloud should be displayed or not. So if you want to remove that part from the html output of your bloig, you can disable the option...

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/
LazyBadger
Regular
Posts: 176
Joined: Mon Aug 25, 2008 12:25 pm
Location: Russia
Contact:

Re: Smartyfication of existing plugins mini-HowTo, pls

Post by LazyBadger »

garvinhicking wrote:if you want to remove that part from the html output of your bloig, you can disable the option...
I'll try to make my English better - I haven't live practice rather long and here I have to fight with English-German mix in my head on writing. About output of related tags - no, I don't want suppress it totally, I just think about easy implementation of different design solutions (which now can be done only by editing code, it's uncommon solution for s9y)
Quis custodiet ipsos custodes?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Smartyfication of existing plugins mini-HowTo, pls

Post by garvinhicking »

Hi!

If you prefer german, feel free to head over to the german section of this forums. But if you prefer to brush up on your english, that's fine as well. :-)

I think I understand what you want. Even though adding smarty output to that section is not really that hard, the performance impact of doing that would be a huge overhead. Do you have any specific modifications in mind? Because much can be solved with CSS.

The first step would be to simply edit the plugin file and use $serendipity['smarty']->assign to pass through the variables needed in that HTML to simply the core of s9y, without rendering a .tpl file. Instead, editing your base index.tpl template would then make it possible to use those variables. The overhead of this would be neglectible...?

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/
LazyBadger
Regular
Posts: 176
Joined: Mon Aug 25, 2008 12:25 pm
Location: Russia
Contact:

Re: Smartyfication of existing plugins mini-HowTo, pls

Post by LazyBadger »

garvinhicking wrote: If you prefer german, feel free to head over to the german section of this forums.
Ich wähle Englisch, weil mein gebrochenes Deutsch-Russischen (wie ich sie verstehe) noch schrecklich ruinen des Englischen
[/quote]I think I understand what you want. Even though adding smarty output to that section is not really that hard, the performance impact of doing that would be a huge overhead. Do you have any specific modifications in mind? Because much can be solved with CSS.[/quote]
Well, sometimes I see as a must a modification in a logic too. Just an example of my small changes (pure for aesthetic purposes)
/* echo '<h2 class="serendipity_date">';
...
echo '</h2>'; */
(only because a/ topic title are h4 b/ if theme have {$head_subtitle|@default:$blogDescription}

Code: Select all

printf (PLUGIN_EVENT_FREETAG_USING
duplicates the same text) plus some classes replacements, but latter is personal. But - I can suggest my changes as universal: b/ case is uncommon and themes can differ

The first step would be to simply edit the plugin file and use $serendipity['smarty']->assign to pass through the variables needed in that HTML to simply the core of s9y, without rendering a .tpl file.
And every changer have to repeat this step, yes? I can't see big difference this editing pure HTML and, also, these changes will stay a targets of future plugin updates, that I want to eliminate but give a possibility of flexible output
Instead, editing your base index.tpl template would then make it possible to use those variables. The overhead of this would be neglectible...?
If it possible, repeat this part in detail, please, for the "slowpoke-rhino" - I see nothing, that I do in index.tpl (checked default theme, saw one big

Code: Select all

<td id="content" valign="top">{$CONTENT}</td>
only)
Quis custodiet ipsos custodes?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Smartyfication of existing plugins mini-HowTo, pls

Post by garvinhicking »

Hi!

First I wanted to add an option to use a smarty template file to the plugni as an example, but I found out the plugin already has way too many options.

So I decided to add the smarty template by default, and simply hope everyone can take the small performance penalty. Version 3.20 now contains that change, you can get it via CVS and see how I implemented it. Hope that helps!

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/
LazyBadger
Regular
Posts: 176
Joined: Mon Aug 25, 2008 12:25 pm
Location: Russia
Contact:

Re: Smartyfication of existing plugins mini-HowTo, pls

Post by LazyBadger »

garvinhicking wrote:I decided to add the smarty template by default, and simply hope everyone can take the small performance penalty.
Thanks! It's excellent solution - and I hope to learn something new from comparing old and new code
Quis custodiet ipsos custodes?
Post Reply