Page 1 of 2 12 LastLast
Results 1 to 10 of 20
  1. #1
    Join Date
    May 2010
    Posts
    222
    Plugin Contributions
    0

    Default Adding JavaScript to Blank Sidebox module

    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?

  2. #2
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

  3. #3
    Join Date
    May 2010
    Posts
    222
    Plugin Contributions
    0

    Default Re: Adding JavaScript to Blank Sidebox module

    Thank you! That worked.

  4. #4
    Join Date
    Apr 2014
    Location
    Canada
    Posts
    249
    Plugin Contributions
    0

    Default Re: Adding JavaScript to Blank Sidebox module

    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.
    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>
    2.
    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>
    I've returned both my defines and tpl files to stock at this point.

    My dev site is:

    dev DOT littlecloset DOT ca

  5. #5
    Join Date
    Feb 2005
    Location
    Lansing, Michigan USA
    Posts
    20,024
    Plugin Contributions
    3

    Default Re: Adding JavaScript to Blank Sidebox module

    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.

  6. #6
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Adding JavaScript to Blank Sidebox module

    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_.
    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);
        })();
    I'm not sure if the ( before function and the )() at the end are good to have there. Someone proficient in javascript would know.


    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
    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>'

    I have edited the coding format to function correctly in the particular context.
    Last edited by gjh42; 14 May 2014 at 07:13 PM.

  7. #7
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Adding JavaScript to Blank Sidebox module

    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.

  8. #8
    Join Date
    Apr 2014
    Location
    Canada
    Posts
    249
    Plugin Contributions
    0

    Default Re: Adding JavaScript to Blank Sidebox module

    Try it both ways.
    Didn't help.

    Question; is the code suppose to be a continuous line?

  9. #9
    Join Date
    Apr 2014
    Location
    Canada
    Posts
    249
    Plugin Contributions
    0

    Default Re: Adding JavaScript to Blank Sidebox module

    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">

  10. #10
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Adding JavaScript to Blank Sidebox module

    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.

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Adding pages to blank sidebox
    By strike_noir in forum Addon Sideboxes
    Replies: 4
    Last Post: 31 Jan 2021, 09:19 AM
  2. v150 Blank Sidebox Blank Page after adding code for livechat software
    By whatisthat456 in forum Basic Configuration
    Replies: 8
    Last Post: 3 May 2012, 10:40 AM
  3. javascript in blank sidebox - livezilla
    By giftsandwhatnot in forum Addon Sideboxes
    Replies: 0
    Last Post: 10 Aug 2011, 04:56 AM
  4. adding another blank sidebox
    By macc88 in forum Basic Configuration
    Replies: 3
    Last Post: 29 Nov 2009, 05:20 PM
  5. Problem adding javascript to custom sidebox
    By etrader in forum Basic Configuration
    Replies: 2
    Last Post: 28 Aug 2006, 04:03 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR