Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2007
    Location
    Coventry, West Midlands
    Posts
    36
    Plugin Contributions
    0

    Default Am unable to insert PHP code into newly installed Blank Sidebox

    Can anybody help me please. I am having difficulty inserting the following PHP code into my newly installed Blank Sidebox.

    Code that I require within the Sidebox:

    <?php
    /**
    Social bookmarking / social shopping links - by That Software Guy
    @copyright Copyright That Software Guy, 2006-2007
    @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
    **/
    $linktitle = STORE_NAME;
    $linktitle = urlencode($linktitle);
    $linkpath = HTTP_SERVER . DIR_WS_CATALOG;
    while (strstr($linkpath, '&amp;'))
    $linkpath = str_replace('&amp;', '&', $linkpath);
    $linkpath = urlencode($linkpath);
    define('SOCIAL_NETWORKING_MAIN_PAGE', '1');
    ?>
    <?php
    require($template->get_template_dir('tpl_social.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_social2.php');
    ?>

    This is my template file:

    <?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 .= '<p>You can include text, links, images, HTML markup and even PHP code</p>';
    $content .= '</div>';

    ?>

    When I replace the text in red with the above PHP code it doesn't work - can anybody please tell me where I'm going wrong.

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

    Default Re: Am unable to insert PHP code into newly installed Blank Sidebox

    The code you show is for a module file, which calls a particular template file. It cannot be inserted into a template file as-is, in three ways.
    First, the <?php and ?> tags around it need to be stripped off if you are inserting it inside a PHP section like the blank sidebox code.
    Second, the "require" statement would be redundant and need to be removed if the code were inserted in a tpl_ file.
    Third, $linktitle and $linkpath are not variables that would be handled by a standard sidebox output file, so the content would never be output by it - it would need to be converted into contents of the $content variable. Also, the code given would only generate links to the store's homepage, not interact with social bookmarking sites, so it is incomplete and needs a bunch more code to have useful functionality.

    This code originally had a specific template file associated with it to handle its output, and without knowing how it was intended to work there is no way to insert it here. I think it was not intended to go into a sidebox in its current form.
    Last edited by gjh42; 23 Apr 2010 at 02:26 PM.

 

 

Similar Threads

  1. How do I insert PHP code into 'define_page_x.php'?
    By oavs in forum General Questions
    Replies: 1
    Last Post: 7 Nov 2011, 09:46 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. insert code into module file
    By quick1 in forum General Questions
    Replies: 1
    Last Post: 5 May 2011, 03:40 AM
  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. Putting code into Kuroi's Blank Sidebox
    By dealbyethan.com in forum Basic Configuration
    Replies: 8
    Last Post: 15 Jul 2008, 01:18 PM

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