Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1
    Join Date
    Oct 2012
    Posts
    48
    Plugin Contributions
    0

    Default Looking for some help with turning on a sidebox for secific pages

    Hi Everyone

    I have recently made a small contact form in a custom sidebox which I am happpy with everything works ok

    I require some help modyfing the box as I only want to display this sidebox on a dozen or so pages not on all the pages.

    I have tried some if statements but dont seem to have a grasp on this one

    many Thanks in advance

    Boyd

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

    Default Re: Looking for some help with turning on a sidebox for secific pages


  3. #3
    Join Date
    Oct 2012
    Posts
    48
    Plugin Contributions
    0

    Default Re: Looking for some help with turning on a sidebox for secific pages

    Hi Stevesh

    Thanks for this I have had a look and am unsure about this

    If your sidebox module doesn't have a conditional such as if ($show_featured == true) { ... } wrapped around the code, then just add it (changing the variable name to something suitable and unique for your sidebox to avoid unintentionally turning off other sideboxes.

    This is my sidebox php just noy sure how to add the conditional wrapped around the code I have tried looking at other mods but am still unsure

    <?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 .= '<form id="Oform3" name="form3" action="contact_send.php" method="post" enctype="application/x-www-form-urlencoded">
    <p style="font-size: 11pt; color: black ">Name:</p>
    <input type="text" class="Gform1" name="name" />
    <p style="font-size: 11pt; color: black ">Telephone No:</p>
    <input type="text" class="Gform2" name="telephone" />
    <p style="font-size: 11pt; color: black ">Email:</p>
    <input type="text" class="Gform3" name="email" />
    <p style="font-size: 11pt; color: black ">Postcode:</p>
    <input type="text" class="Gform4" name="postcode" />
    <p style="font-size: 11pt; color: black ">Message</p>
    <textarea name="message" class="Gform5" rows="5" cols="1">
    Text Area</textarea>

    <input type="submit" class="Gform6" name="form8" value="Submit" />
    </form>';

    $content .= '</div>';


    ?>

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

    Default Re: Looking for some help with turning on a sidebox for secific pages

    Is your sidebox module file still named blank_sidebox.php? If so, just add the test above
    PHP Code:
    $content '';
    $content .= '<div id="' str_replace('_''-'$box_id 'Content') . '" class="sideBoxContent">';

    //your code

    $content .= '</div>';


    and the closing } at the bottom of the file.

    You want to adapt this test from tpl_main_page.php for your multi-page display test:
    PHP Code:
    // the following IF statement can be duplicated/modified as needed to set additional flags
      
    if (in_array($current_page_base,explode(",",'list_pages_to_skip_all_right_sideboxes_on_here,separated_by_commas,and_no_spaces')) ) {
        
    $flag_disable_right true;
      } 
    PHP Code:
      if (in_array($current_page_base,explode(",",'list_pages_to_skip_all_right_sideboxes_on_here,separated_by_commas,and_no_spaces')) ) {
        
    $show_blank_sidebox false;
      } else {
        
    $show_blank_sidebox true;
      }

    if (
    $show_blank_sidebox) {
    $content '';
    $content .= '<div id="' str_replace('_''-'$box_id 'Content') . '" class="sideBoxContent">';

    //your code

    $content .= '</div>';



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

    Default Re: Looking for some help with turning on a sidebox for secific pages

    Switch around the show statements according to which way is easier to define. If you only want to show the sidebox on certain pages, you would use
    PHP Code:
        $show_blank_sidebox true;
      } else {
        
    $show_blank_sidebox false;
      } 

  6. #6
    Join Date
    Oct 2012
    Posts
    48
    Plugin Contributions
    0

    Default Re: Looking for some help with turning on a sidebox for secific pages

    Hi Glen

    I have it working to a degree I have manged to diplsay the sidebox on one category only using the following

    <?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 $
    */

    // test if box should display
    $show_blank_sidebox = true;

    if ($current_page_base == 'index' and $cPath == '1_2' ) {
    $show_blank_sidebox = true;
    require($template->get_template_dir('tpl_blank_sidebox.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_blank_sidebox.php');
    $title = BOX_HEADING_BLANK_SIDEBOX;
    $title_link = false;
    require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default);
    }
    ?>


    How can I extend this to include a product path too as I only want to display this on 6 pages

    if ($current_page_base == 'index' and $cPath == '1_2' ) {
    $show_blank_sidebox = true;

    I have tried adding
    and $pPath == 1
    and $product_id == 1

    but dont seem to be able to set it to a specific product ppage

    Thanks again for all your help

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

    Default Re: Looking for some help with turning on a sidebox for secific pages

    Exactly what pages do you want to display this on? Product info pages use a different page base than category or product listing pages. For these you would use something like
    PHP Code:
    if ($current_page_base == 'product_info' and ($products_id == '234' or $products_id == '169')) { 

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

    Default Re: Looking for some help with turning on a sidebox for secific pages

    If you have a substantial list of product info pages, you could use
    PHP Code:
    if ($current_page_base == 'product_info' and in_array($products_idexplode(',','234,169,789,54,77,345'))) { 

  9. #9
    Join Date
    Oct 2012
    Posts
    48
    Plugin Contributions
    0

    Default Re: Looking for some help with turning on a sidebox for secific pages

    Hi Glenn

    I have tried the following both ways but dont seem to be able to get it to work here is my 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 $
    */

    // test if box should display
    $show_blank_sidebox = false;

    if ($current_page_base == 'product_info' and in_array($products_id, explode(',','1,2,3,4,5,6'))) {
    $show_blank_sidebox = true;
    require($template->get_template_dir('tpl_blank_sidebox.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_blank_sidebox.php');
    $title = BOX_HEADING_BLANK_SIDEBOX;
    $title_link = false;
    require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default);
    }
    ?>

  10. #10
    Join Date
    Oct 2012
    Posts
    48
    Plugin Contributions
    0

    Default Re: Looking for some help with turning on a sidebox for secific pages

    Hi Everyone

    I managed to get it to work ok with this


    if ($current_page_base == 'product_info' and $_GET['products_id'] == '4' or $_GET['products_id'] == '1' or $_GET['products_id'] == '2' or $_GET['products_id'] == '3') {
    $show_blank_sidebox = false;

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Looking for some help
    By SACA in forum Upgrading to 1.5.x
    Replies: 10
    Last Post: 20 Jan 2012, 01:46 PM
  2. New Zenner having some trouble... looking for help
    By Dojora4 in forum Templates, Stylesheets, Page Layout
    Replies: 5
    Last Post: 21 Apr 2009, 06:21 AM
  3. looking for some help..
    By samfoot123 in forum General Questions
    Replies: 2
    Last Post: 1 Jun 2006, 06:31 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