Page 1 of 1

"Facebook" Post include?

Posted: Tue Jan 06, 2009 2:11 am
by genesis
I've got the following code....

Code: Select all

<script>function fbs_click() {u=location.href;t=document.title;window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');return false;}</script><style> html .fb_share_button { display: -moz-inline-block; display:inline-block; padding:1px 20px 0 5px; height:15px; border:1px solid #d8dfea; background:url(http://static.ak.fbcdn.net/images/share/facebook_share_icon.gif?0:26981) no-repeat top right; } html .fb_share_button:hover { color:#fff; border-color:#295582; background:#3b5998 url(http://static.ak.fbcdn.net/images/share/facebook_share_icon.gif?0:26981) no-repeat top right; text-decoration:none; } </style> <a href="http://www.facebook.com/share.php?u=<url>" class="fb_share_button" onclick="return fbs_click()" target="_blank" style="text-decoration:none;">Share</a>
And am trying to insert it into my template so it shows up as a "button" at the end of each post, much like the tags do for digg, etc.

I've not been able to figure it out, which means I'm probably terminally stupid in understanding "Smarty"....

Any general pointers?

Posted: Tue Jan 06, 2009 7:25 am
by akremedy
There are others here who are much better at Smarty than I am, but I don't think I'd be wrong in pointing you to "entries.tpl" in whatever theme subdir corresponds to the theme that you're using (/templates/i3theme/entries.tpl in my case).

I expect for most themes that there is a block above {$entry.add_footer} which contains the author tags ($entry.author) where you could put your FB stuff.

What I'm not sure of is how the FB stuff is supposed to act...is it supposed to fetch the blog URI as part of some sort of FB post?

Anyway, I hope this at least gets you pointed in the right direction.

Adam
==================
Ah - I see (got curious because I'm becoming a FB addict it seems). The block of script you provided basically does all the work for you - fetches the background image to make the href look like a button, sends the current url to FB which prompts for login unless you're session is already active, etc.

Pretty cool - maybe I'll add this to my my site but stuff it in the {if $entry.is_entry_owner and not $is_preview} ... {/if} condition so that only I can push my blog entries to FB...but that's just personal preference.

Posted: Tue Jan 06, 2009 3:03 pm
by Don Chambers
Also place that block of code between {literal} and {/literal}.

Posted: Tue Jan 06, 2009 8:48 pm
by genesis
That worked... it was the {literal} that I needed....

Any idea how to get it in the block with the entry plugin that does DIGGs, etc?

Posted: Tue Jan 06, 2009 9:05 pm
by Don Chambers
Do you mean the "Findmore" plugin? You would need to edit the plugin to create this new option.

Quite frankly, I think it is generally recommended that users add the component pieces they need from that plugin to their entries.tpl file. You gain a small performance improvement in the process.

Posted: Tue Jan 06, 2009 10:40 pm
by genesis
No, its "show links" - which I may take down.....

Oops - that IS "findmore". Hmmm... ok. :)