peeta Posted October 13, 2008 Share Posted October 13, 2008 I added an 'AddThis' button to my footer.tpl so viewers can add the page to their Social Network page but it uses a javascript located at their server to execute the submission process and it is not under SSL so it brings up the browser security error. I need to wrap a tag around like; {if mode == ssl}don't show button{else}show button{/if} How can I achieve this? Thanks. 0 Quote Link to comment Share on other sites More sharing options...
herpherp Posted October 13, 2008 Share Posted October 13, 2008 {php} if($_SERVER['HTTPS']) echo 'Code if SSL is ON'; else echo 'Code if SSL is OFF'; {/php} 0 Quote Link to comment Share on other sites More sharing options...
peeta Posted October 13, 2008 Author Share Posted October 13, 2008 Thanks herp. It does work though the code I have has single quotes and they cause errors. How do I make it work with those quotes <script type="text/javascript">addthis_pub = 'host';</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://www.host.net/templates/0708/images/button1-addthis.gif" width="125" height="16" border="0" alt="" /></a> <script type="text/javascript" src="http://s7.addthis.com/js/152/addthis_widget.js"></script> 0 Quote Link to comment Share on other sites More sharing options...
herpherp Posted October 13, 2008 Share Posted October 13, 2008 Thanks herp. It does work though the code I have has single quotes and they cause errors. How do I make it work with those quotes {php} if($_SERVER['HTTPS']) echo 'Code if SSL is ON'; else echo "<script type=\"text/javascript\">addthis_pub = 'host';</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://www.host.net/templates/0708/images/button1-addthis.gif\" width=\"125\" height=\"16\" border=\"0\" alt=\"\" /></a> <script type=\"text/javascript\" src=\"http://s7.addthis.com/js/152/addthis_widget.js\"></script>"; {/php} 0 Quote Link to comment Share on other sites More sharing options...
herpherp Posted October 13, 2008 Share Posted October 13, 2008 Just so you are aware there is an ssl version as well so you can use the code below to switch between the two... Tested in both ie and ff and get no ssl warnings {php} if($_SERVER['HTTPS']) echo '<script type="text/javascript">addthis_pub = \'host\';</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="https://secure.addthis.com/button1-addthis.gif" width="125" height="16" border="0" alt="" /></a><script type="text/javascript" src="https://secure.addthis.com/js/152/addthis_widget.js"></script>'; else echo '<script type="text/javascript">addthis_pub = \'host\';</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-addthis.gif" width="125" height="16" border="0" alt="" /></a><script type="text/javascript" src="http://s7.addthis.com/js/152/addthis_widget.js"></script>'; {/php} 0 Quote Link to comment Share on other sites More sharing options...
peeta Posted October 15, 2008 Author Share Posted October 15, 2008 Herp, thanks again. I was not aware of the ssl version that would be way simpler. However I had come up with a hack solution by placing the code in a file named addthis.php and then use an include to call it and it has been working so i left it {php} if($_SERVER['HTTPS']) echo ''; else include ('templates/0708/includes/addthis.php') {/php} 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.