-
Sidebox Code Problem
I am trying to add a social bookmarking site to a sidebox. Here is my homepage: http://www.lasilhouettelingerie.com/store/ (Please look in the top right corner at the Social Bookmarking sidebox).
Here is the code where I am supposed to paste my add this code into this sidebox:
Code:
$content = '<div id="absolutelinksContent" class="sideBoxContent centeredContent">';
/* Your html and/or javascript code goes between the 2 single quotes in the next line */
$content .= '<!-- AddThis Button BEGIN -->
<script type="text/javascript">var addthis_pub = "MYUSERNAMEHERE";</script>
<a href="http://www.addthis.com/bookmark.php" onmouseover="return addthis_open(this, '', '[URL]', '[TITLE]')" onmouseout="addthis_close()" onclick="return addthis_sendto()"><img src="http://s7.addthis.com/button1-bm.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 -->';
$content .= '</div>';
?>
According the the instructions I can paste html or javascript in between the single quoate of the $content'' line which is what I did. The code has errors (the page goes blank below this sidebox when I use the code above. Is the code syntax wrong? Anyone know how I can make this work? I am guessing it has to do with the single double quotes but I don't quite understand .php language.
-
Re: Sidebox Code Problem
-
Re: Sidebox Code Problem
Quote:
Originally Posted by
lasilhouette
Any suggestions?
Code:
$content = '<div id="absolutelinksContent" class="sideBoxContent centeredContent">';
$content .= '<!-- AddThis Button BEGIN -->';
$content .= '<script type="text/javascript">var addthis_pub = "MYUSERNAMEHERE";</script>';
$content .= '<a href="http://www.addthis.com/bookmark.php" onmouseover="return addthis_open(this, \'\', \'[url]\', \'[TITLE]\')" onmouseout="addthis_close()" onclick="return addthis_sendto()"><img src="http://s7.addthis.com/button1-bm.gif" width="125" height="16" border="0" alt="" /></a><script type="text/javascript" src="http://s7.addthis.com/js/152/addthis_widget.js"></script>';
$content .= '<!-- AddThis Button END -->';
$content .= '</div>';
For what you want to show up in a sidebox should be added to $content
As for the single quotes, just need to escape the ones within your JS code.
-
Re: Sidebox Code Problem
Dave,
I have added the content with the code above to the website and the button shows just fine.
The problem that I am having now is that when I click on send an e-mail or bookmark instead of the URL showing it shows the [url]. So it will not add to favorites or display the link when you click on send an e-mail. I suspect when social bookmarking it won't show the URL as well just the value for URL.
Is this because the single quotes are escaped? This works on all my other php sites but I didn't have to escape my single quotes code. Please visit this page: http://www.lasilhouettelingerie.com/store/ and give it a try. For some reason it is not inserting the URL for the url value.
Here is the exact code that I used:
Code:
/* Your html and/or javascript code goes between the 2 single quotes in the next line */
$content = '<div id="absolutelinksContent" class="sideBoxContent centeredContent">';
$content .= '<!-- AddThis Button BEGIN -->';
$content .= '<script type="text/javascript">var addthis_pub = "lasilhouette";</script>';
$content .= '<a href="http://www.addthis.com/bookmark.php" onmouseover="return addthis_open(this, \'\', \'[url]\', \'[TITLE]\')" onmouseout="addthis_close()" onclick="return addthis_sendto()"><img src="http://s7.addthis.com/button1-bm.gif" width="125" height="16" border="0" alt="" /></a><script type="text/javascript" src="http://s7.addthis.com/js/152/addthis_widget.js"></script>';
$content .= '<!-- AddThis Button END -->';
$content .= '</div>';
-
Re: Sidebox Code Problem
I got it now. It was that the [url] is case sensitive. Changed it to capital letters [URL] and now all works fine. Once again thank you very much! :clap:
-
Re: Sidebox Code Problem
is this an official Zen-Cart mod. I would like to implement this on my site as well. Can i just copy your code?
Thanks!