Results 1 to 10 of 13

Hybrid View

  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.

 

 

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