durangod Posted November 26, 2013 Share Posted November 26, 2013 (edited) Hi, i posted this in the footer tpl file but its not picking up the https value to show the image, any ideas? {if !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443} <center> <img src="/images/ssl_seal.gif" border="0" alt="SSL Seal" /> </center> {/if} it looks like there is no value for any of those.. mmmmm thanks Edited November 26, 2013 by durangod 0 Quote Link to comment Share on other sites More sharing options...
durangod Posted November 26, 2013 Author Share Posted November 26, 2013 Here is a JS attempt but still does not work <div id="sslbadge" style="display: none;"> <img src="/images/ssl_seal.gif" border="0" alt="SSL Seal" /> </div> <script type="text/javascript"> if ("https:" === window.location.protocol) { document.getElementById('sslbadge').style.display = 'block'; } </script> 0 Quote Link to comment Share on other sites More sharing options...
durangod Posted November 27, 2013 Author Share Posted November 27, 2013 (edited) here is what finally worked and this is in footer tpl i checked the source and in the source it was only showing this much. <script type="text/javascript"> if(location.protocol === "https:") </script> so i was like ok no wonder its not doing anything because its not being told what to do. So then i realized (and this is a guess on my part) that since this is inside a smarty tpl file and smarty uses {} for php operations, then it probably confused the portion inside the js brackets for php. So i removed the brackets which i think are just for decoration anyway, and whallaaa there it was. i did try to use margin:0px auto to center and stay away from the center tag but nothing i tried css wise worked so i juse went back to the center tag. here is the final code.. <!-- added to only show seal on ssl pages --> <div id="sslbadge" style="display:none;"> <center> <img src="/images/ssl_seal.gif" border="0" alt="SSL Seal" /> </center> </div> <script type="text/javascript"> if(location.protocol === "https:") document.getElementById('sslbadge').style.display = ''; </script> <!-- end add --> Edited November 27, 2013 by durangod 0 Quote Link to comment Share on other sites More sharing options...
randini Posted December 15, 2013 Share Posted December 15, 2013 The brackets {} are there so it knows what to do if it equals it. The reason it's working is because you only have 1 line of code after the if statement so really the brackets are not needed. Here is why it would not work with the brackets.... When using a template file .tpl you have to let the system know what not to change. So things you want to work just as they are, such as java, you put this around it.. {literal} {/literal} So it would have worked had you done it this way... {literal} <script type="text/javascript"> if(location.protocol === "https:") { document.getElementById('sslbadge').style.display = ''; } </script> {/literal} However, the way you have it is just fine Great job! 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.