Page 1 of 2

plugin request : post entry to del.icio.us, digg etc

Posted: Wed Mar 08, 2006 1:03 pm
by Chris
Hi !

Just wondering if it is possible to develop a plugin that will allow visitors to easily bookmark an entry to del.icio.us or post an entry to digg ? An example is this blog :

http://www.maxpower.ca/free-icons/2006/03/05/

Notice the row of small icons at the end of his entry ?

BTW this entry has a good list of websites with icons released under GPL license.

thanks !

Chris

Re: plugin request : post entry to del.icio.us, digg etc

Posted: Wed Mar 08, 2006 1:47 pm
by garvinhicking
Those snippets are just simple javascript or HTML codes which you can already easily insert into your entries.tpl template file!

A plugin could also be created for that, but IMHO this is more a template matter than a plugin.

I just committed a plugin "serendipity_event_findmore" ("Show links to services like Digg, Technorati, del.icio.us etc related to your entry.") to the CVS where you can fetch it in about 24 hours from Spartacus. It contains some images plus template files so I could not just paste the code here.

Best regards,
Garvin

Posted: Wed Mar 08, 2006 1:52 pm
by Chris
Hi Garvin,

That's awesome - thanks for that. I'll check it out once they hit Spartacus.

regards,

Chris

Posted: Wed Mar 08, 2006 1:55 pm
by garvinhicking
I could send it via E-Mail to you, if you'd like it earlier?

Regards,
Garvin

Posted: Wed Mar 08, 2006 1:57 pm
by Chris
Garvin,

You're a legend ! My email address is christopher.sh.chan@gmail.com.

thanks again !

Chris

Posted: Fri Mar 10, 2006 3:12 am
by Chris
Thanks Garvin - this works perfectly !

I would like to experiment to see if I can integrate your plugin into entries.tpl. Would you be able to give me a point as to where I should insert this into entries.pl ? Don't won't to mess up that file !

Ideally, I would like the icons to show up after the body of the entry and above the line that says :
Posted by Chris in Technology at 09:34 | Comments (0) | Trackbacks (0) | Edit entry
Here's where I think it should go but just want to double-check :

Code: Select all

<div class="entrytext">
                <p>
                {$entry.body}
                {if $is_single_entry}
                <a id="extended"></a>{$entry.extended}
                {/if}
                </p>

                {if $entry.has_extended and not $is_single_entry and not $entry.is_extended}
                <br /><a href="{$entry.link}#extended">{$CONST.VIEW_EXTENDED_ENTRY|@sprintf:$entry.title}</a><br /><br />
                {/if}

>>>> INSERT FEED MORE CODE HERE <<<<

            <p class="postmetadata{if $is_single_entry} graybox{/if}">
thanks,

Chris

Posted: Fri Mar 10, 2006 10:45 am
by garvinhicking
Hi Chris!

Yes, you can just have a go at inserting your code there, but you need to replace some variables of the plugin_findmore.tpl variables so that they work in the context of the entries.tpl

You should replace "$entrydata.url" with "$entry.rdf_ident" and "$entrydata.title" with "$entry.title". And last but not least you need to replace "$path" with the HTTP path to where your images for the services are stored.

You cannot make things very wrong in your template, so just experiment a bit with it where you need to place the code :)

Regards,
Garvin

Posted: Fri Mar 10, 2006 12:10 pm
by Chris
Thanks for the tips Garvin ! I'll give it a go.

BTW, there is a small typo in plugin_findmore.tpl :

<a href="http://del.icio.us/post?url={$entrydata ... ][u]atitle[/u][/b]={$entrydata.title|escape:url}" title="Bookmark {$entrydata.title|escape} at del.icio.us"><img src="{$entrydata.path}delicious.png" class="socialbkmark" alt="Bookmark {$entrydata.title|escape} at del.icio.us"/></a>
The second parameter in the URL should be "title" and not "atitle". :)

thanks,

Chris

Posted: Fri Mar 10, 2006 12:27 pm
by Chris
Hi Garvin,

Works perfectly ! Have embedded the code inside entries.tpl. Thanks again for your all help with this.

regards,

Chris

Posted: Fri Mar 10, 2006 12:30 pm
by garvinhicking
You're welcome! And thanks for the 'atitle' bug, I also committed the fix!

Regards,
Garvin

How to save grandma's performance pennies?

Posted: Wed Apr 26, 2006 11:59 am
by Josh
This is another useful plugin! Thank you!

I would like to follow your advice "to save grandma's performance pennies" by not installing the plugin and modifying the entries.tpl instead, but I don't understand what to do exactly.

This is what I have tried on my test blog http://germany-usa.atlanticreview.org :

1. I have entered a code in the footer of the entries.tpl file and the links were displayed, but without picking up the URL of my blog post:

Code: Select all

 <div class='serendipity_entryFooter'>
           
<a href="http://del.icio.us/post?url={$entrydata.url|escape:url}&title={$entrydata.title|escape:url}" title="Bookmark {$entrydata.title|escape}  at del.icio.us"><img src="{$entrydata.path}delicious.png" class="socialbkmark" alt="Bookmark {$entrydata.title|escape}  at del.icio.us"/></a>

<a href="http://digg.com/submit?phase=2&url={$entrydata.url|escape:url}" title="Digg {$entrydata.title|escape} "><img src="{$entrydata.path}diggman.png" class="socialbkmark" alt="Digg {$entrydata.title|escape} "/></a>

              {if $entry.has_comments}

                    {if $use_popups}

                        <a href="{$entry.link_popup_comments}...
2. I have saved the logos of del.ici.us etc in /templates/carl_blue/img/ and alternatively in templates/carl_blue, but I did not get them displayed.

What should I do?

Ideally I would like to have the links to comments and trackbacks in the same line as the links to the tags. So far they are in two different lines: http://atlanticreview.org/ Any idea how to change that?
Below the links to comments, trackbacks, and tags, I would like to have a line for the logos for posting to del.icio.us etc.

I would very much appreciate your help.

This is my entries.tpl file:

Code: Select all

<!-- ENTRIES START -->
    {serendipity_hookPlugin hook="entries_header" addData="$entry_id"}

    {foreach from=$entries item="dategroup"}
    <div class="serendipity_entry_date">
        {if $dategroup.is_sticky}
        
        {else}
        
        {/if}

        {foreach from=$dategroup.entries item="entry"}
        <h4 class="serendipity_title"><a href="{$entry.link}">{$entry.title}</a></h4>

        <div class="serendipity_entry serendipity_entry_author_{$entry.author|@makeFilename} {if $entry.is_entry_owner}serendipity_entry_author_self{/if}">
            <p class="posttime">{$CONST.POSTED_BY} <a href="{$entry.link_author}">{$entry.author}</a> {$CONST.IN}
{foreach from=$entry.categories item="category" name="categories"}<a href="{$category.category_link}">{$category.category_name|@escape}</a>{if not $smarty.foreach.categories.last}, {/if}{/foreach} {$CONST.ON}

{$entry.timestamp|@formatTime:DATE_FORMAT_ENTRY} 


            <div class="serendipity_entry_body">
                {$entry.body}
            </div>

            {if $entry.is_extended}
            <div class="serendipity_entry_extended"><a id="extended"></a>{$entry.extended}</div>
            {/if}

            {if $entry.has_extended and not $is_single_entry and not $entry.is_extended}
            <br /><a href="{$entry.link}#extended">{$CONST.VIEW_EXTENDED_ENTRY|@sprintf:$entry.title}</a>
            {/if}

            <div class='serendipity_entryFooter'>
                 {if $entry.has_comments}
                    {if $use_popups}
                        <a href="{$entry.link_popup_comments}" onclick="window.open(this.href, 'comments', 'width=480,height=480,scrollbars=yes'); return false;">{$entry.label_comments} ({$entry.comments})</a>
                    {else}
                        <a href="{$entry.link}#comments">{$entry.label_comments} ({$entry.comments})</a>
                    {/if}
                {/if}

                {if $entry.has_trackbacks}
                    {if $use_popups}
                        - <a href="{$entry.link_popup_trackbacks}" onclick="window.open(this.href, 'comments', 'width=480,height=480,scrollbars=yes'); return false;">{$entry.label_trackbacks} ({$entry.trackbacks})</a>
                    {else}
                        - <a href="{$entry.link}#trackbacks">{$entry.label_trackbacks} ({$entry.trackbacks})</a>
                    {/if}
                {/if}

                {if $entry.is_entry_owner and not $is_preview}
                        - <a href="{$entry.link_edit}">{$CONST.EDIT_ENTRY}</a>
                {/if}

                {$entry.add_footer}
            </div>
        </div>
        <!--
        <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
                 xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/"
                 xmlns:dc="http://purl.org/dc/elements/1.1/">
        <rdf:Description
                 rdf:about="{$entry.link_rdf}"
                 trackback:ping="{$entry.link_trackback}"
                 dc:title="{$entry.title}"
                 dc:identifier="{$entry.rdf_ident}" />
        </rdf:RDF>
        -->
        {$entry.plugin_display_dat}

        {if $is_single_entry and not $use_popups and not $is_preview}
            {if $CONST.DATA_UNSUBSCRIBED}
                <br /><div class="serendipity_center serendipity_msg_notice">{$CONST.DATA_UNSUBSCRIBED|@sprintf:$CONST.UNSUBSCRIBE_OK}</div><br />
            {/if}

            {if $CONST.DATA_TRACKBACK_DELETED}
                <br /><div class="serendipity_center serendipity_msg_notice">{$CONST.DATA_TRACKBACK_DELETED|@sprintf:$CONST.TRACKBACK_DELETED}</div><br />
            {/if}

            {if $CONST.DATA_TRACKBACK_APPROVED}
                <br /><div class="serendipity_center serendipity_msg_notice">{$CONST.DATA_TRACKBACK_APPROVED|@sprintf:$CONST.TRACKBACK_APPROVED}</div><br />
            {/if}

            {if $CONST.DATA_COMMENT_DELETED}
                <br /><div class="serendipity_center serendipity_msg_notice">{$CONST.DATA_COMMENT_DELETED|@sprintf:$CONST.COMMENT_DELETED}</div><br />
            {/if}

            {if $CONST.DATA_COMMENT_APPROVED}
                <br /><div class="serendipity_center serendipity_msg_notice">{$CONST.DATA_COMMENT_APPROVED|@sprintf:$CONST.COMMENT_APPROVED}</div><br />
            {/if}

            <div class="serendipity_comments">
                <br />
                <a id="trackbacks"></a>
                <div class="serendipity_commentsTitle">{$CONST.TRACKBACKS}</div>
                    <div class="serendipity_center">
                        <a rel="nofollow" style="font-weight: normal" href="{$entry.link_trackback}" onclick="alert('{$CONST.TRACKBACK_SPECIFIC_ON_CLICK|@escape:htmlall}'); return false;" title="{$CONST.TRACKBACK_SPECIFIC_ON_CLICK|@escape}">{$CONST.TRACKBACK_SPECIFIC}</a>
                    </div>
                    <br />
                        {serendipity_printTrackbacks entry=$entry.id}
            </div>
        {/if}

        {if $is_single_entry and not $is_preview}
            <div class="serendipity_comments">
                <br />
                <a id="comments"></a>
                <div class="serendipity_commentsTitle">{$CONST.COMMENTS}</div>
                <div class="serendipity_center">{$CONST.DISPLAY_COMMENTS_AS}
                {if $entry.viewmode eq $CONST.VIEWMODE_LINEAR}
                    ({$CONST.COMMENTS_VIEWMODE_LINEAR} | <a href="{$entry.link_viewmode_threaded}#comments">{$CONST.COMMENTS_VIEWMODE_THREADED}</a>)
                {else}
                    (<a href="{$entry.link_viewmode_linear}#comments">{$CONST.COMMENTS_VIEWMODE_LINEAR}</a> | {$CONST.COMMENTS_VIEWMODE_THREADED})
                {/if}
                </div>
                <br />
			</div>
            <div class="serendipity_comments">
                    {serendipity_printComments entry=$entry.id mode=$entry.viewmode}
</div>
                {if $entry.is_entry_owner}
                    {if $entry.allow_comments}
                    <div class="serendipity_center">(<a href="{$entry.link_deny_comments}">{$CONST.COMMENTS_DISABLE}</a>)</div>
                    {else}
                    <div class="serendipity_center">(<a href="{$entry.link_allow_comments}">{$CONST.COMMENTS_ENABLE}</a>)</div>
                    {/if}
                {/if}
                <a id="feedback"></a>

                {foreach from=$comments_messagestack item="message"}
                <div class="serendipity_center serendipity_msg_important">{$message}</div>
                {/foreach}

                {if $is_comment_added}

                <br />
                <div class="serendipity_center serendipity_msg_notice">{$CONST.COMMENT_ADDED}</div>

                {elseif $is_comment_moderate}

                <br />
                <div class="serendipity_center serendipity_msg_notice">{$CONST.COMMENT_ADDED}<br />{$CONST.THIS_COMMENT_NEEDS_REVIEW}</div>

                {elseif not $entry.allow_comments}

                <br />
                <div class="serendipity_center serendipity_msg_important">{$CONST.COMMENTS_CLOSED}</div>

                {else}

                <br />
                <div class="serendipity_commentsTitle">{$CONST.ADD_COMMENT}</div>
                {$COMMENTFORM}

                {/if}
            </div>
        {/if}

        {$entry.backend_preview}
        {/foreach}
    </div>
    {foreachelse}
    {if not $plugin_clean_page}
        {$CONST.NO_ENTRIES_TO_PRINT}
    {/if}
    {/foreach}

    <div class='serendipity_pageFooter' style="text-align: center">
    {if $footer_prev_page}
        <a href="{$footer_prev_page}">« {$CONST.PREVIOUS_PAGE}</a>  
    {/if}

    {if $footer_info}
        ({$footer_info})
    {/if}

    {if $footer_next_page}
          <a href="{$footer_next_page}">{$CONST.NEXT_PAGE} »</a>
    {/if}

    {serendipity_hookPlugin hook="entries_footer"}
    </div>
<!-- ENTRIES END -->

Re: How to save grandma's performance pennies?

Posted: Wed Apr 26, 2006 12:04 pm
by garvinhicking
Hi!

In your entries.tpl you must use "$entry" instead of "$entrydata!". $entrydata is only available when using the plugin...

Regards,
Garvin

Posted: Wed Apr 26, 2006 12:39 pm
by Josh
Thanks. I have changed it, but the problems continue.

Posted: Wed Apr 26, 2006 1:27 pm
by garvinhicking
Can you post your entries.tpl on http://nopaste.php-q.net/ with the contents you now modified using $entry instead of $entrydata?

Regards,
Garvin

Posted: Wed Apr 26, 2006 2:40 pm
by Josh