Results 1 to 9 of 9
  1. #1
    Join Date
    Dec 2005
    Location
    Perth, Western Australia, Australia
    Posts
    781
    Plugin Contributions
    0

    red flag Putting code into Kuroi's Blank Sidebox

    Hi,

    I am trying to get the following code to integrate and work properly in Kuroi's Blank Sidebox.

    Code:
    <script language="Javascript" type="text/javascript">
    
    var fieldstocheck = new Array();
        fieldnames = new Array();
    
    function checkform() {
      for (i=0;i<fieldstocheck.length;i++) {
        if (eval("document.subscribeform.elements['"+fieldstocheck[i]+"'].value") == "") {
          alert("Please enter your "+fieldnames[i]);
          eval("document.subscribeform.elements['"+fieldstocheck[i]+"'].focus()");
          return false;
        }
      }
    
      return true;
    }
    
    
    function addFieldToCheck(value,name) {
      fieldstocheck[fieldstocheck.length] = value;
      fieldnames[fieldnames.length] = name;
    }
    
    function compareEmail()
    {
      return (document.subscribeform.elements["email"].value == document.subscribeform.elements["emailconfirm"].value);
    }
    
    </script><form method=post action="http://www.dealbyethan.com/newsletters/?p=subscribe&id=1" name="subscribeform" target="windowName" onsubmit="window.open('', this.target,
    'dialog,modal,scrollbars=no,resizable=no,width=550,height=300,left=0,top=0');"><style type="text/css">
          div.adminmessage {
            width: 100%;
            border: 2px dashed #000000;
            padding: 10px;
            margin-bottom: 15px;
            background-color: #E7BE8F;
    
          }
          </style>
    
    Email: <input type=text name=email value="" size="15">
      <script language="Javascript" type="text/javascript">addFieldToCheck("email","Email");</script>
            
            <input type="hidden" name="list[3]" value="signup"><input type="hidden" name="listname[3]" value="Mens Clothing"/><input type=submit name="subscribe" value="Subscribe" onClick="return checkform();">
        </form>
    It's essentially a simple phplist subscription with a field and subcribe button. I put the code in tpl_blank_sidebox.php but it gave me this error. The above code works fine if it wasn't in a sidebox. Please advise. Thank you.

    Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING
    The Team Behind DealByEthan.com | Curating unique finds for a discerning community. Committed to a seamless and inspiring shopping experience. Connect with us: https://linktr.ee/dealbyethan


  2. #2
    Join Date
    Jun 2003
    Posts
    33,721
    Plugin Contributions
    0

    Default Re: Putting code into Kuroi's Blank Sidebox

    Please do not PM for support issues: a private solution doesn't benefit the community.

    Be careful with unsolicited advice via email or PM - Make sure the person you are talking to is a reliable source.

  3. #3
    Join Date
    Oct 2006
    Location
    Alberta, Canada
    Posts
    4,571
    Plugin Contributions
    1

    Default Re: Putting code into Kuroi's Blank Sidebox

    Why reinvent the wheel?

    In the Downloads section you can get the Newsletter Sign up Module which sounds better for what you want.

  4. #4
    Join Date
    Dec 2005
    Location
    Perth, Western Australia, Australia
    Posts
    781
    Plugin Contributions
    0

    red flag Re: Putting code into Kuroi's Blank Sidebox

    @Kim: Thanks for the link. I will check and report back.

    @Website Rob: Yes, I am using that. It works well but when it comes to sending newsletters it come across a problem.

    I can't send newsletters in bulk to over 800 customers in zencart admin. It gave me a blank page and I know some customers received my newsletter but not others. So I thought of using the Newsletter Subscription Module in conjuction with phplist. This means I can make customers subscribe on zencart and then unsubscribe on zencart only OR phplist only. Although I am okay with exporting the email addresses from zencart admin and import them into phplist, these two methods are not good because if someone uses the former method, they will not be automatically be unsubscribed on phplist and vice versa for the latter method.

    I am thinking to switch to use phplist entirely because it can do subscription, unsubscription and newsletters reliably. Hence I thought of an idea to display a simple phplist subscription with an email field and subscribe button in a blank sidebox. I hope this make sense.

    You might say there is also a phplist module called Newsletter Center but it does not integrate well with zencart at this stage.
    The Team Behind DealByEthan.com | Curating unique finds for a discerning community. Committed to a seamless and inspiring shopping experience. Connect with us: https://linktr.ee/dealbyethan


  5. #5
    Join Date
    Dec 2005
    Location
    Perth, Western Australia, Australia
    Posts
    781
    Plugin Contributions
    0

    red flag Re: Putting code into Kuroi's Blank Sidebox

    @Kim: I took your suggestion... checked through the code and then tried again with no luck. The same error message shows up. Can anyone please help? Thanks.
    The Team Behind DealByEthan.com | Curating unique finds for a discerning community. Committed to a seamless and inspiring shopping experience. Connect with us: https://linktr.ee/dealbyethan


  6. #6
    Join Date
    Dec 2005
    Location
    Perth, Western Australia, Australia
    Posts
    781
    Plugin Contributions
    0

    red flag Re: Putting code into Kuroi's Blank Sidebox

    The following shows what I tried:

    Code:
    <?php
    /**
     * blank sidebox - allows a blank sidebox to be added to your site
     *
     * @package templateSystem
     * @copyright 2007 Kuroi Web Design
      * @copyright Portions Copyright 2003-2007 Zen Cart Development Team
     * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
     * @version $Id: blank_sidebox.php 2007-05-26 kuroi $
     */
    
      $content = '';
      $content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent">';
    
      // Replace the text and HTML tags between the apostophes on lines 19 and 20.
      // Use as many or as few lines using this model as you need for your custom content.
      // If you have a multilingual site define your text in the languages/YOUR_LANGUAGE/extra_definitions/blank_sidebox_defines.php and include it as shown in line 19.
      // If your site is monolingual, you can put the text right here as shown on line 20 (and nobody will know!)
      $content .= '<p>' . TEXT_BLANK_SIDEBOX . '</p>';
      $content .= '<script language="Javascript" type="text/javascript">
    
    var fieldstocheck = new Array();
        fieldnames = new Array();
    
    function checkform() {
      for (i=0;i<fieldstocheck.length;i++) {
        if (eval("document.subscribeform.elements['"+fieldstocheck[i]+"'].value") == "") {
          alert("Please enter your "+fieldnames[i]);
          eval("document.subscribeform.elements['"+fieldstocheck[i]+"'].focus()");
          return false;
        }
      }
    
      return true;
    }
    
    
    function addFieldToCheck(value,name) {
      fieldstocheck[fieldstocheck.length] = value;
      fieldnames[fieldnames.length] = name;
    }
    
    function compareEmail()
    {
      return (document.subscribeform.elements["email"].value == document.subscribeform.elements["emailconfirm"].value);
    }
    
    </script><form method=post action="http://www.dealbyethan.com/newsletters/?p=subscribe" name="subscribeform"><style type="text/css">
          div.adminmessage {
            width: 100%;
            border: 2px dashed #000000;
            padding: 10px;
            margin-bottom: 15px;
            background-color: #E7BE8F;
    
          }
          </style>
    
    Email:
    <input type=text name=email value="" size="15">
    <script language="Javascript" type="text/javascript">addFieldToCheck("email","Email");</script>
    
    <input type="hidden" name="list[3]" value="signup"><input type="hidden" name="listname[3]" value="Mens Clothing"/><input type=submit name="subscribe" value="Subscribe" onClick="return checkform();">
        </form>';
    
      $content .= '</div>';
    ?>
    The Team Behind DealByEthan.com | Curating unique finds for a discerning community. Committed to a seamless and inspiring shopping experience. Connect with us: https://linktr.ee/dealbyethan


  7. #7
    Join Date
    Jul 2008
    Posts
    23
    Plugin Contributions
    0

    Default Re: Putting code into Kuroi's Blank Sidebox

    I am a totally new Zenner..but liking what I have seen so far. I am trying to add an "Open in new Window" the the Blank Sidebox addon. The code is pretty simply :

    <body>
    <script language="JavaScript" type="text/JavaScript">
    <!--
    function opennewWindow(theURL,winName,features) {
    window.open(theURL,winName,features);
    }
    //-->
    </script>
    <a href="javascript:opennewWindow('measure_kit.html','','scrollbars=yes, width=525')">How to Measure</a>
    </body>

    I have created a file nemed jscript_measure.js and placed it in the includes/modules/pages/product_info folder so it would automatically load as I read in previous posts.

    I have added lines below to the tpl_blank_sidebox.php file:

    $content .= '<a href="javascript:opennewWindow('measure_kit.html','','scrollbars=yes, width=525')">How to Measure</a>';

    The page does not totally load. I have removed the <a href.... line to see if the issue is there and it seems to be since the page will load fine...but no active link.

    This code works fine in a HTML page I tested it in. Please tell me what I am missing.

  8. #8
    Join Date
    Apr 2006
    Location
    London, UK
    Posts
    10,569
    Plugin Contributions
    25

    Default Re: Putting code into Kuroi's Blank Sidebox

    @learning1

    The javascript that you are trying to insert should indeed work fine on an HTML page, but will break a PHP page. No surprises there, that's what you're seeing.

    The reason is all those single quotes. PHP doesn't know that the new ones that you're inserting are meant for the javascript and not for it, and it's trying to process them.

    To get around this you need to "escape" those which PHP should ignore by putting a "\" in front of them. So your line becomes:

    $content .= '<a href="javascript:opennewWindow(\'measure_kit.html\',\'\',\'scrollbars=yes, width=525\')">How to Measure</a>';
    Kuroi Web Design and Development | Twitter

    (Questions answered in the forum only - so that any forum member can benefit - not by personal message)

  9. #9
    Join Date
    Jul 2008
    Posts
    23
    Plugin Contributions
    0

    Default Re: Putting code into Kuroi's Blank Sidebox

    Excellent - exactly what was wrong. I should have also mentioned that I am new to PHP/MySQL as well - my previous web work has all been .asp.

    Thanks so much - I know it won't be my last question, but I thought I would post something since I was searching the forum for the past 2 days and couldn't find a soultion.

 

 

Similar Threads

  1. 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
  2. Inserting a shoutbox into a blank sidebox.
    By Rendle in forum Addon Sideboxes
    Replies: 11
    Last Post: 19 Jun 2011, 10:12 PM
  3. Replies: 1
    Last Post: 23 Apr 2010, 02:23 PM
  4. Help putting code in a blank sidebox
    By brimsjewelry in forum Addon Sideboxes
    Replies: 6
    Last Post: 26 Oct 2007, 01:45 AM
  5. Adding banner exchange code into blank side boxes
    By kapearl in forum Addon Sideboxes
    Replies: 1
    Last Post: 18 Jul 2007, 12:48 AM

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