Page 1 of 2 12 LastLast
Results 1 to 10 of 13
  1. #1
    Join Date
    Jul 2012
    Posts
    5
    Plugin Contributions
    0

    Default PHP code in new created sidebox

    Hello all,
    Firstly let me say a big "HELLO" to everyone and let me show my consideration for this amazyng e-commerce called ZENCART.
    I have been using Zencart for some time now and wanted to customize a little.
    Basicall I have created a new sidebox and want to show some links in it.
    Everyhting is OK, the sidebox shows up and everything but I cant get php code to be runned in it.
    I want to set some variables and according to that variables to show various links but when I put my php code in content.=' <?php ...php-code... ?>'; it simply doesnt run.
    Has anybody tried this ?

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

    Default Re: PHP code in new created sidebox

    How did you create the sidebox ? Have you tried the Blank Sidebox mod which will run PHP ?

  3. #3
    Join Date
    Jul 2012
    Posts
    5
    Plugin Contributions
    0

    Default Re: PHP code in new created sidebox

    Hello,
    Thank you for your reply,
    I have just installed the Blank Box.
    Entered my php test code and still doesnt show up.

    See bellow I have tested with a simple php echo code but nothing.
    <?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 .= '<?php echo="Text should be visible" ?>';

    $content .= '</div>';
    ?>

  4. #4
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    10,537
    Plugin Contributions
    127

    Default Re: PHP code in new created sidebox

    Change this:
    Code:
    $content .= '<?php echo="Text should be visible" ?>';
    to this:

    Code:
    $content .= "Text should be visible";
    That Software Guy. My Store: Zen Cart Support
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  5. #5
    Join Date
    Jul 2012
    Posts
    5
    Plugin Contributions
    0

    Default Re: PHP code in new created sidebox

    Hello,
    The "Text should be visible" was just for an example.
    I want ro use php because I need to access some variables.
    Ig I want to echo the value of variable $test for example I will need to enter <?php echo $test ?> but this doesnt work.
    Is there a reason for not executing the php code ?
    If I view my source code of page where the sidebox is enabled I see exactly <?php echo $test ?> but this shouldnt be there, the php code should be executed but somethign stops it, this is what I guess.
    Anybody any clue on this ?

  6. #6
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    10,537
    Plugin Contributions
    127

    Default Re: PHP code in new created sidebox

    You're already in PHP. You don't need the beginning and end tags. That's your problem.
    That Software Guy. My Store: Zen Cart Support
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  7. #7
    Join Date
    Jul 2012
    Posts
    5
    Plugin Contributions
    0

    Default Re: PHP code in new created sidebox

    OK, eliminated the php start and end,
    For a quick test I have declared a variable and tried to echo:
    $content .= '
    $test="test";
    echo $test;';
    Just to mention I have tried this already yesterday, but this give the text "$test="test"; echo $test;" in my sidebox. Its just that php isnt executed.

  8. #8
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    10,537
    Plugin Contributions
    127

    Default Re: PHP code in new created sidebox

    This is what you want:

    $test = "A test string ABCDE";
    $content .= $test;
    That Software Guy. My Store: Zen Cart Support
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  9. #9
    Join Date
    Jul 2012
    Posts
    5
    Plugin Contributions
    0

    Default Re: PHP code in new created sidebox

    YES, YES, YES, YES
    This is what exactly what I wanted.
    I never would have thought to lose the ' ' from content.=' '
    This worked like a charm
    Thank you very much.

  10. #10
    Join Date
    Jan 2007
    Location
    Los Angeles, California, United States
    Posts
    10,021
    Plugin Contributions
    32

    Default Re: PHP code in new created sidebox

    Quote Originally Posted by swguy View Post
    This is what you want:

    $test = "A test string ABCDE";
    $content .= $test;
    I really hate to resurrect such an old post, but I cannot find a support thread for the Blank Sidebox module.. After reading through every possible "Blank Sidebox" post this is the ONLY one that comes CLOSE to what I am trying to do..

    Trying to add the sign-up form for my client's mailing list to his store.. This code works on a defined page:

    Code:
    <?php
    echo do_shortcode('[wysija_form id="1"]');
    ?>
    This code does NOT work using the Editable Sidebox module (Editable Sidebox parses the PHP code effectively disabling it). So I'm now trying to figure out how to work this using the Blank Sidebox module.. Can any kind hearted person help me sort out how to add this to the Blank Sidebox??

    I've tried:
    Code:
    $content .= echo do_shortcode('[wysija_form id="1"]');
    AND
    Code:
    $content .= do_shortcode('[wysija_form id="1"]');
    Neither worked
    My Site - Zen Cart & WordPress integration specialist
    I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Can I place code in sidebox/banner_box.php
    By Bulletproofbody in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 23 May 2012, 06:57 AM
  2. PHP code in a blank sidebox
    By Lazar in forum Addon Sideboxes
    Replies: 0
    Last Post: 10 Aug 2011, 11:27 AM
  3. new sidebox created. how to add links??
    By maxy007 in forum Templates, Stylesheets, Page Layout
    Replies: 15
    Last Post: 15 Jul 2011, 12:00 PM
  4. Text-Link-Ads php code in Blank Sidebox
    By never2cute in forum Basic Configuration
    Replies: 1
    Last Post: 26 Dec 2008, 11:51 AM
  5. Want to put php code in sidebox
    By bgroup99 in forum Basic Configuration
    Replies: 0
    Last Post: 30 Nov 2007, 08:05 PM

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