Is there a way to add JavaScript to the Blank Sidebox module? If not, is there any other way to add JavaScript to a sidebox?
Is there a way to add JavaScript to the Blank Sidebox module? If not, is there any other way to add JavaScript to a sidebox?
Thank you! That worked.
Hi.
I'm resurrecting this because I'm trying to accomplish the same or at least similar goal.
As soon as I start adding php and java to tpl_blank_sidebox.php OR blank_sidebox_defines.php my site goes blank(ah! I guess it's going it's job ;))
So my questions are:
-All the posts I've found imply the solution is to escape single quotes. I've tried that. Perhaps some need escaping and others don't...I really don't know. But I know if I escape them all the site still goes blank.
-I've read to avoid putting java in the defines so how do I add it properly?
Here's the codes I'm trying to insert:
1.
2.Code:<div id="footer-payments"> <center> <img src="<?php echo $template->get_template_dir('',DIR_WS_TEMPLATE, $current_page_base,'images').'/'.FOOTER_PAYMENT_ICON ?>" alt="payments we accept" class="payments-image" /> </center> </div>
I've returned both my defines and tpl files to stock at this point.Code:<script type="text/javascript"> (function() { var ss = document.createElement('script'); ss.type = 'text/javascript'; ss.async = true; ss.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'seal.ssls.com/script.js?cn=' + window.location.host; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ss, s); })(); </script> <!-- Do not alter for the seal to work properly --> <div id="sslsSiteSeal"> seal by <a href="http://ssls.com/">SSLs.com</a> </div>
My dev site is:
dev DOT littlecloset DOT ca
Blank pages generally result from PHP errors and create error log files in your /logs folder. Post the contents of the most recent one here.
In general, you would put the script (without <script type="text/javascript"> </script> tags) in a new file named like jscript_siteseal.js, saved in /includes/templates/your_template/jscript/. You can name it as you like as long as it starts with jscript_.I'm not sure if the ( before function and the )() at the end are good to have there. Someone proficient in javascript would know.Code:(function() { var ss = document.createElement('script'); ss.type = 'text/javascript'; ss.async = true; ss.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'seal.ssls.com/script.js?cn=' + window.location.host; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ss, s); })();
The rest of the code you show would go into either the sidebox define file or tpl_ file. In the tpl_ file, you would assign it to $content like
I have edited the coding format to function correctly in the particular context.PHP Code:
$content .= '<div id="footer-payments">
<center>
<img src="' . $template->get_template_dir('',DIR_WS_TEMPLATE, $current_page_base,\'images\') . '/' . FOOTER_PAYMENT_ICON" alt="payments we accept" class="payments-image" />
</center>
</div>';
$content .= ' <!-- Do not alter for the seal to work properly -->
<div id="sslsSiteSeal">
seal by <a href="http://ssls.com/">SSLs.com</a>
</div>';
Last edited by gjh42; 14 May 2014 at 07:13 PM.
Missed one :)
This bit
$template->get_template_dir('',DIR_WS_TEMPLATE, $current_page_base,\'images\')
needs either the first '' (two single quotes) escaped (\'\'), or the second set \'images\' not escaped ('images'); I forget which at the moment... think the escapes are not needed here. Try it both ways.
Didn't help.Try it both ways.
Question; is the code suppose to be a continuous line?
In case this will help, here's an entry in the logs I suspect is related to the code:
[15-May-2014 10:09:01 America/New_York] PHP Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/littlecl/HIDDEN/dev/includes/templates/piccadilly_posh/sideboxes/tpl_blank_sidebox.php on line 19
Line 19 is:
$content .= '<div id="footer-payments">
If you use line breaks in the define, they will show in the "view source" of your output. They will not break a define unless you are doing something else wrong.
One of the escaping options *will* work while the other won't. This means you have some other error in your code. Post your tpl_blank_sidebox.php so we can see exactly how you are adding the content. Also, exactly what you did with the javascript and where.
Bookmarks