Jump to content

Need an {if} tag to identify SSL mode


peeta

Recommended Posts

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.

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

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}

Link to comment
Share on other sites

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}

Link to comment
Share on other sites

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}

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated