2 austriaco Sep 18, 2007 16:36

THANK YOU SO MUCH AUSTRIACO!!!!
I am new to php and to b2evo. I would like to add the addthis share widget to my blog (http://localecology.org/localecologist). Where would I place the code for this addthis widget? In main.php? If so, where?
Thank you!
- ecology
The widget:
<!-- AddThis Button BEGIN -->
<a href="http://www.addthis.com/bookmark.php" onclick="window.open('http://www.addthis.com/bookmark.php?wt=nw&pub=seatulip&url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title), 'addthis', 'scrollbars=yes,menubar=no,width=620,height=520,resizable=yes,toolbar=no,location=no,status=no,screenX=200,screenY=100,left=200,top=100'); return false;" title="Bookmark and Share" target="_blank"><img src="http://s9.addthis.com/button0-share.gif" width="83" height="16" border="0" alt="Bookmark and Share" /></a>
<!-- AddThis Button END -->
Hi ecology,
You should experiment a little. The snippet goes in the file _main.php as you suggested. A good place would be between
<?php
and
} // ---------------------------------- END OF POSTS ------------------------------------
Good luck
Thanks Afwas.
- ecology
http://localecology.org/localecologist/
:lol:
I'm getting close, I've been experimenting before calling for help but being a novice at php I know when I need help.
I've substituted the functions as mentioned but when trying to bookmark the post url is not included and there is a bit of gibberish on the post itself.
Obviously I have removed it from the site for meantime.
Can someone more experienced than have a quick look over the coding below and let me know what needs changing.
// AddThis Bookmark Post Button BEGIN
echo "<div><a href=\"http://www.addthis.com/bookmark.php?pub=barnesnet&url=".$Item->permanent_url()."&title=".$Item->title()."\"
title=\"Bookmark and Share\" target=\"_blank\"><img src=\"http://s9.addthis.com/button1-addthis.gif\" width=\"125\" height=\"16\" border=\"0\" alt=\"Bookmark and Share\" /></a></div>";
// AddThis Bookmark Post Button END
Many thanks
Hi sims,
The first variable will be $Item->get_permanent_url()
The second variable I am not sure about. Try: $Item->title('', '', 'false', 'raw') Unfortunately I cannot test at the moment.
The rest of your code looks good. Don't forget that this code must be between <?php and ?>. You can use the code in between existing ones or wrap your code around new ones.
Good luck
Thank you, it was better but still came up with this:
Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /home/barntcou/public_html/inc/items/model/_itemlight.class.php on line 707
An unexpected error has occured!
If this error persits, please report it to the administrator.Go back to home page
Additional information about this error:
Output format [] not supported.
Unfortunately, that doesnt mean too much to me.
sims,
What version of b2evo do you have?
I'm running b2evo 2.4.1 and I've been running this script for a while. I agree. It's very cool.
here's my code.
<!-- ADDTHIS BUTTON BEGIN -->
<script type="text/javascript">
addthis_pub = 'Your_AccountName';
addthis_brand = 'Your Brand Name';
addthis_options = 'favorites, email, digg, delicious, myspace, facebook, google, live, more';
</script>
<a href="http://www.addthis.com/bookmark.php" onmouseover="return addthis_open(this, '', '<?php $Item->permanent_url(); ?>', '<?php $Item->title(array('link_type'=>'none'))?>')" onmouseout="addthis_close()" onclick="return addthis_sendto()"><img src="http://s9.addthis.com/button1-share.gif" width="125" height="16" border="0" alt="" /></a>
<script type="text/javascript" src="http://s7.addthis.com/js/152/addthis_widget.js"></script>
<!-- ADDTHIS BUTTON END -->
Click here to see in action:
http://www.thechristianalert.org/index.php/2008/03/26/five-easy-ways-to-make-your-life-conveni?blog=5
That's excellant, thank you very much.
I worked out what the arrow was (=>), had a 30 second nightmare with php tags but managed to implement it very easily.
Would not have been able to create that on my own so thank you very much.
One more question, slightly off topic. I notice you have a hack/plugin that puts BBCode buttons on your message/feedback form. I have noticed this on a few websites but cannot find the hack/plugin to implement it.
Hello everyone,
and if I'd like to add AddThis code to every comment - the same like in blogger.com it is possible to share every post, I need to have possibility to share every comment.
thanx,
Ben
I have added the script to _item.comment.inc.php and it works as a by default link to post, so I'm promoting all the post with all the comments. If I'd like to promote only one comment is there any possibility to change [URL] into permalink of a comment somehow?
The functions you want are: $Item->permanent_url() and $Item->title().
The code documentation is always very helpul for this sort of stuff http://doc.b2evolution.net/v-1-10/evocore/Item.html