Social Bookmarking: serendipity_event_findmore

Creating and modifying plugins.
Post Reply
johncanary
Regular
Posts: 116
Joined: Mon Aug 20, 2007 4:00 am
Location: Spain
Contact:

Social Bookmarking: serendipity_event_findmore

Post by johncanary »

Hi!

What is the Smarty variable that has the complete permalink URI of a post
(incl. the http:// part)?

Here the full story:
--------------------------------

* I installed the "serendipity_event_findmore" plugin.
* Tweaked the list of services in the findmore.tpl template file.

Garwin, who contributed the plugin, wrote that is better for performance to put
the stuff directly into the "entries.tpl" Templates. That makes sense to me and
I have more freedom, how to position the Social Bookmarking icons.

I figured out that the Smarty Variable Names have to be different.

* Then I deactivated the Plugin and it works just fine.

ONE question: I could not figure out the name of the SMARTY Variable that hold
the complete (possibly URL escaped) URI for the permalink to an entry.


I did it a not cool way. Probably someone can give me a hint on how to make this
more efficient and cooler. I am great with PERL, but a PHP beginner. Have mercy.

Here's the code that I am talking about. It is inside the entries.tpl file

By the way: You can see the result at http://blog.fcon21.biz/

Code: Select all

<div class="social_bookmarking_top noprint">
 <a href="http://del.icio.us/post?url={'http://blog.fcon21.biz'|cat:$entry.link|escape:'url'}&title={$entry.title|escape:'url'}" title="Bookmark {$entry.title}  at del.icio.us"><img width="18" height="18" src="/img/social/delicious.png" class="socialbkmark" alt="Bookmark {$entry.title} at del.icio.us"/></a>
   <a href="http://digg.com/submit?phase=2&url={'http://blog.fcon21.biz'|cat:$entry.link|escape:'url'}" title="Digg {$entry.title} "><img src="/img/social/diggman.png" width="16" height="14" class="socialbkmark" alt="Digg {$entry.title}"/></a>
   <a href="http://technorati.com/faves?sub=addfavbtn&add={'http://blog.fcon21.biz'|cat:$entry.link|escape:'url'}" title="Technorati {$entry.title}"><img src="/img/social/technorati.png" width="18" height="18" class="socialbkmark" alt="Technorati {$entry.title}"/></a>
   <a href="http://www.newsvine.com/_tools/seed&save?u={'http://blog.fcon21.biz'|cat:$entry.link|escape:'url'}&h={$entry.title|escape:'url'}" title="Bookmark {$entry.title}  at NewsVine"><img width="16" height="16" src="/img/social/newsvine.png" class="socialbkmark" alt="Bookmark {$entry.title}  at NewsVine"/></a>
   <a href="http://www.stumbleupon.com/submit?url={'http://blog.fcon21.biz'|cat:$entry.link|escape:'url'}&title={$entry.title|escape:'url'}" title="StumbleIt {$entry.title}  at StumbleUpon"><img width="16" height="16" src="/img/social/stumbleit.gif" class="socialbkmark" alt="StumbleIt {$entry.title}"/></a>
   <a href="http://www.furl.net/storeIt.jsp?t={$entry.title|escape:'url'}&u={'http://blog.fcon21.biz'|cat:$entry.link|escape:'url'}" title="Bookmark {$entry.title}  at Furl.net"><img src="/img/social/furl.png" width="16" height="17" class="socialbkmark" alt="Bookmark {$entry.title}  at Furl.net"/></a>
   <a href="http://cgi.fark.com/cgi/fark/edit.pl?new_url={'http://blog.fcon21.biz'|cat:$entry.link|escape:'url'}&new_comment={$entry.title|escape:'url'}&new_link_other=&linktype=Misc" title="Fark this: {$entry.title} "><img width="15" height="18" src="/img/social/fark.png" class="socialbkmark" alt="Fark this: {$entry.title} "/></a>
   <a href="http://blogmarks.net/my/new.php?mini=1&simple=1&url={'http://blog.fcon21.biz'|cat:$entry.link|escape:'url'}&title={$entry.title|escape:'url'}" title="Bookmark {$entry.title}  at blogmarks"><img width="16" height="16" src="/img/social/blogmarks.png" class="socialbkmark" alt="Bookmark {$entry.title}  at blogmarks"/></a>
   <a href="http://myweb2.search.yahoo.com/myresults/bookmarklet?t={$entry.title|escape:'url'}&u={'http://blog.fcon21.biz'|cat:$entry.link|escape:'url'}" title="Bookmark {$entry.title}  at YahooMyWeb"><img width="18" height="18" src="/img/social/yahoomyweb.png" class="socialbkmark" alt="Bookmark {$entry.title}  at YahooMyWeb"/></a>
   <a href="http://www.addtoany.com/?linkurl={'http://blog.fcon21.biz'|cat:$entry.link|escape:'url'}&linkname={$entry.title|escape:'url'}&type=page" title="Bookmark at 'AddToAny' using any bookmark manager! {$entry.title}"><img src="/img/social/addtoany.gif" alt="Bookmark {$entry.title}  using any bookmark manager! " width="91" height="17" class="socialbkmark"/></a>
   <a href="http://www.addthis.com/bookmark.php?pub=&url={'http://blog.fcon21.biz'|cat:$entry.link|escape:'url'}&title={$entry.title|escape:'url'}" title="Bookmark at 'AddThis' using any bookmark manager! {$entry.title}"><img src="/img/social/button0-bm.gif" alt="Bookmark {$entry.title}  using any bookmark manager!" width="83" height="16" class="socialbkmark"/></a>
</div>
Yours John
: John's Google+ Profile
: John's E-Biz Booster Blog powered by Serendipity 1.7/PHP 5.3.14
johncanary
Regular
Posts: 116
Joined: Mon Aug 20, 2007 4:00 am
Location: Spain
Contact:

Post by johncanary »

Some remark about the SMARTY escape function:

When using {$variable|escape:'url'} should ' ' (spaces) not get translated to '+' sign instead of %20 ?? At least it is described that way in the SMARTY docu, unless I have misunderstood this.

I noticed the following in the output HTML Source of the code from above.

E.g.

Code: Select all

http://del.icio.us/post?url=http%3A%2F%2Fblog.fcon21.biz%2F2007-08%2F52-Canaries-on-Fire&title=Canaries%20on%20Fire"
Yours John
: John's Google+ Profile
: John's E-Biz Booster Blog powered by Serendipity 1.7/PHP 5.3.14
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Social Bookmarking: serendipity_event_findmore

Post by garvinhicking »

Hi!
What is the Smarty variable that has the complete permalink URI of a post
(incl. the http:// part)?
That's {$entry.rdf_ident}. Usually that link is only used for the RDF-metadata (hence the name), because s9y usually only uses absolute links without the servername to allow to be used on other domain names.

So using that variable, you can changed your entries.tpl code to use that, instead of the "|cat" operator. :)

Using the 'escape:url' modifier is alright. Using %20 is perfectly legal. If a "+" occured within a url, the remote site would need to "decode" the URL variables (urldecode() PHP function), but with %20 it wouldn't need that transcoding. So all is well. :-)

Best 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/
johncanary
Regular
Posts: 116
Joined: Mon Aug 20, 2007 4:00 am
Location: Spain
Contact:

Thank You

Post by johncanary »

All parts of my question have been answered.
Thank you so much.
Yours John
: John's Google+ Profile
: John's E-Biz Booster Blog powered by Serendipity 1.7/PHP 5.3.14
Post Reply