Results 1 to 6 of 6
  1. #1
    Join Date
    Jan 2013
    Posts
    808
    Plugin Contributions
    0

    Default How to add array to tpl main file

    im trying to turn off sideboxes(no problem) and stretch screen (Problem) when boxes not present on certain pages like login and checkout one pages
    this is my code from tpl main
    Code:
    <?php
    /**
     * Common Template - tpl_main_page.php
     *
     * Governs the overall layout of an entire page<br>
     * Normally consisting of a header, left side column. center column. right side column and footer<br>
     * For customizing, this file can be copied to /templates/your_template_dir/pagename<br>
     * example: to override the privacy page<br>
     * - make a directory /templates/my_template/privacy<br>
     * - copy /templates/templates_defaults/common/tpl_main_page.php to /templates/my_template/privacy/tpl_main_page.php<br>
     * <br>
     * to override the global settings and turn off columns un-comment the lines below for the correct column to turn off<br>
     * to turn off the header and/or footer uncomment the lines below<br>
     * Note: header can be disabled in the tpl_header.php<br>
     * Note: footer can be disabled in the tpl_footer.php<br>
     * <br>
     * $flag_disable_header = true;<br>
     * $flag_disable_left = true;<br>
     * $flag_disable_right = true;<br>
     * $flag_disable_footer = true;<br>
     * <br>
     * // example to not display right column on main page when Always Show Categories is OFF<br>
     * <br>
     * if ($current_page_base == 'index' and $cPath == '') {<br>
     *  $flag_disable_right = true;<br>
     * }<br>
     * <br>
     * example to not display right column on main page when Always Show Categories is ON and set to categories_id 3<br>
     * <br>
     * if ($current_page_base == 'index' and $cPath == '' or $cPath == '3') {<br>
     *  $flag_disable_right = true;<br>
     * }<br>
     *
     * @package templateSystem
     * @copyright Copyright 2003-2007 Zen Cart Development Team
     * @copyright Portions Copyright 2003 osCommerce
     * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
     * @version $Id: tpl_main_page.php 7085 2007-09-22 04:56:31Z ajeh $
     */
    
    // the following IF statement can be duplicated/modified as needed to set additional flags
      if (in_array($current_page_base,explode(",",'login,')) ) {
        $flag_disable_right = true;
    	$flag_disable_left = true;
      }
      $header_template = 'tpl_header.php';
      $footer_template = 'tpl_footer.php';
      $left_column_file = 'column_left.php';
      $right_column_file = 'column_right.php';
      $body_id = ($this_is_home_page) ? 'indexHome' : str_replace('_', '', $_GET['main_page']);
    // BOF ZX POS
    if(isset($_SESSION['POStoken']) && $current_page_base == 'barcode_cart') {
        $flag_disable_left = true;
        $flag_disable_right = true;
        $flag_disable_header = true;
    }
    // EOF ZX POS																					   
      
    ?>
    </head>
    <body id="<?php echo $body_id . 'Body'; ?>"<?php if($zv_onload !='') echo ' onload="'.$zv_onload.'"'; ?>>
      
      <?php if ($messageStack->size('contact') > 0) echo $messageStack->output('contact'); ?>
    
     <div id="page">
    <!-- ========== IMAGE BORDER TOP ========== --> 
    
    <!-- BOF- BANNER TOP display -->
    
        <?php
          if (SHOW_BANNERS_GROUP_SET1 != '' && $banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET1)) {
            if ($banner->RecordCount() > 0) {
              ?>
            <div id="bannerTop" class="banners"><?php echo zen_display_banner('static', $banner); ?></div>
            <?php
          }
        }
        ?>
    <!-- EOF- BANNER TOP display -->
        
        <!-- ====================================== --> 
    
        <!-- ========== HEADER ========== -->
          <?php
    	    /* prepares and displays header output */
    	     if (CUSTOMERS_APPROVAL_AUTHORIZATION == 1 && CUSTOMERS_AUTHORIZATION_HEADER_OFF == 'true' and ($_SESSION['customers_authorization'] != 0 or $_SESSION['customer_id'] == '')) {
    		    $flag_disable_header = true;
    	     }
    	     require($template->get_template_dir('tpl_header.php',DIR_WS_TEMPLATE, $current_page_base,'common'). '/tpl_header.php');
    	    ?>
        <!-- ============================ -->
    
    <section>
      <?php if(!$this_is_home_page) { ?>
        <div class="container">
          <div class="row">
            <div class="col-xs-12">
              <?php if (DEFINE_BREADCRUMB_STATUS == '1' || (DEFINE_BREADCRUMB_STATUS == '2' && !$this_is_home_page) ) { ?>
                <div id="navBreadCrumb" class="breadcrumb"><?php echo $breadcrumb->trail(""); ?></div>
              <?php } ?>
            </div>
          </div>
        </div>
      <?php } ?>
      <?php if($this_is_home_page) { ?>
          <div class="container">
            <div class="slider"> 
              <!-- begin edit for ZX Slideshow -->
              <?php if(ZX_SLIDESHOW_STATUS == 'true') { ?>
              <?php require($template->get_template_dir('zx_slideshow.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/zx_slideshow.php'); ?>
              <?php } ?>
              <!-- end edit for ZX Slideshow --> 
            </div>
          </div>
      <?php } ?>
        <div class="container">
        <div class="row">
          <div class="main-col 
    	  <?php if ((COLUMN_LEFT_STATUS == 1 && $body_id !== 'productinfo') || (COLUMN_RIGHT_STATUS == 1 && $body_id !== 'productinfo')) { ?>col-sm-9 <?php }?>
    	  <?php if (COLUMN_LEFT_STATUS == 1 ) {?> left_column<?php }?><?php if (COLUMN_RIGHT_STATUS == 1 ) {?> right_column<?php }?>
          <?php if ((COLUMN_LEFT_STATUS == 0 && $body_id !== 'productinfo') || (COLUMN_RIGHT_STATUS == 0 && $body_id !== 'productinfo')) { ?>col-sm-12 <?php }?>">
            <div class="banners1">
              <div class="row">
                <?php if($this_is_home_page) { ?>
                  <?php $new_banner_search = zen_build_banners_group(SHOW_BANNERS_GROUP_SET3);
        
                  // secure pages
                  switch ($request_type) {
                    case ('SSL'):
                      $my_banner_filter=" and banners_on_ssl= " . "1";
                      break;
                    case ('NONSSL'):
                      $my_banner_filter='';
                      break;
                  }
                
                  $sql = "select banners_id from " . TABLE_BANNERS . " where status = 1 " . $new_banner_search . $my_banner_filter . " order by banners_sort_order";
                  $banners_all = $db->Execute($sql);
        
                // if no active banner in the specified banner group then the box will not show
                  $banner_cnt = 0;
                  while (!$banners_all->EOF) {
                    $banner_cnt++;
                    $banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET3);
                    echo '<div class="col-sm-6 col-xs-12"><div data-match-height="banner1" class="item item_'.$banner_cnt.'">'.tm_zen_display_banner('static', $banners_all->fields['banners_id']).'</div></div>';
                // add spacing between banners
                    if ($banner_cnt < $banners_all->RecordCount()) {
                      
                    }
                    $banners_all->MoveNext();
                  }
                  }
                ?>
              </div>
            </div>
    		 <div class="row">
    
            <div class="center_column col-xs-12
    				<?php 
    					if (COLUMN_LEFT_STATUS == 1 && COLUMN_RIGHT_STATUS == 1 && $body_id !== 'productinfo') { 
    						echo 'col-sm-8 two_columns';
    					} elseif ((COLUMN_LEFT_STATUS == 1 && $body_id !== 'productinfo') || (COLUMN_RIGHT_STATUS == 1 && $body_id !== 'productinfo')) { 
    						echo 'col-sm-12 with_col';
    					} else {
    						echo 'col-sm-12';
    					} 
    					
        			?> ">
              <?php 
                if ($messageStack->size('upload') > 0) echo $messageStack->output('upload');
        			 require($body_code);
        			?>
            </div>
          
          <?php
    	       if($body_id !== 'productinfo'){
        				if (COLUMN_RIGHT_STATUS == 0 or (CUSTOMERS_APPROVAL == '1' and $_SESSION['customer_id'] == '')) {
        				  // global disable of column_right
        				  $flag_disable_right = true;
        				}
        				if (!isset($flag_disable_right) || !$flag_disable_right) {
        			?>
            <div class="column right_column col-xs-12 col-sm-4">
              <?php
        						 /* ----- prepares and displays left column sideboxes ----- */
        						?>
              <?php require(DIR_WS_MODULES . zen_get_module_directory('column_right.php')); ?>
            </div> 
            <?php
        				}
    	  		}
        			?>
                    </div>
                    </div>
                <?php
    		if($body_id !== 'productinfo'){
    			if (COLUMN_LEFT_STATUS == 0 or (CUSTOMERS_APPROVAL == '1' and $_SESSION['customer_id'] == '')) {
    			  // global disable of column_left
    			  $flag_disable_left = true;
    			}
    			if (!isset($flag_disable_left) || !$flag_disable_left) {
    		?>
            <aside class="column left_column col-xs-12 col-sm-3">
    	       <?php
               /* ----- prepares and displays left column sideboxes ----- */
            ?>
            <?php require(DIR_WS_MODULES . zen_get_module_directory('column_left.php')); ?>
            </aside>
            <?php
    			 }
    			}
    		?>
            </div>  
                    <div class="clearfix"></div>
            
            <!--bof-custom block display-->
          <?php require($template->get_template_dir('tpl_customblock.php',DIR_WS_TEMPLATE, $current_page_base,'common'). '/tpl_customblock.php');?> 
            <!--eof-custom block display--> 
          </div>
       
      </section>
    <!-- ========== FOOTER ========== -->
      <footer>
        <div class="footer-container">
            <?php
            	 /* prepares and displays footer output */
            	  if (CUSTOMERS_APPROVAL_AUTHORIZATION == 1 && CUSTOMERS_AUTHORIZATION_FOOTER_OFF == 'true' and ($_SESSION['customers_authorization'] != 0 or $_SESSION['customer_id'] == '')) {
            		$flag_disable_footer = true;
            	  }
            	  require($template->get_template_dir('tpl_footer.php',DIR_WS_TEMPLATE, $current_page_base,'common'). '/tpl_footer.php');
            	?>
          <div class="copyright">
            <div class="container">
              <div class="row">
               <div class="col-xs-12">
                <!-- ========== COPYRIGHT ========== -->
                  <p><?php echo FOOTER_TEXT_BODY; ?> &nbsp;| &nbsp;<br><a href="<?php echo zen_href_link(FILENAME_PRIVACY)?>"><?php echo BOX_INFORMATION_PRIVACY?></a> &nbsp;| &nbsp;<a href="<?php echo zen_href_link(FILENAME_PAGE_2)?>">Template settings</a>
                    <?php
                        if (SHOW_FOOTER_IP == '1') {
                    ?>
                            <div id="siteinfoIP"><?php echo TEXT_YOUR_IP_ADDRESS . '  ' . $_SERVER['REMOTE_ADDR']; ?></div>
                    <?php
                        }
                    ?>
                  </p>
                <!-- =============================== -->
                </div>
              </div>
            </div>
          </div>
        </div>
      </footer>
    <!-- ============================ --> 
    </div>
    <!-- ========================================= -->
    
    <!-- begin Chatra code --> 
    <script>
    window.ChatraSetup = {
        colors: {
            buttonText: '#f0f0f0', /* chat button text color */
            buttonBg: '#3499da'    /* chat button background color */
        }
    };
    </script>
    <!-- Chatra {literal} -->
    <script>
        (function(d, w, c) {
            w.ChatraID = 'yfz2dwnFxZgz3CTwk';
            var s = d.createElement('script');
            w[c] = w[c] || function() {
                (w[c].q = w[c].q || []).push(arguments);
            };
            s.async = true;
            s.src = 'https://call.chatra.io/chatra.js';
            if (d.head) d.head.appendChild(s);
        })(document, window, 'Chatra');
    </script>
    <!-- /Chatra {/literal} -->
    																																																										 
    		   
    <!-- end Chatra code -->
    
    </body>
    i did try adding a or to the productinfo sections using section from top
    Need assistance please

  2. #2
    Join Date
    Jan 2013
    Posts
    808
    Plugin Contributions
    0

    Default Re: How to add array to tpl main file

    the product info is what i want the non sidebox pages to look like
    https://jnsflooringandsupplies.com/N...products_id=32

  3. #3
    Join Date
    Feb 2009
    Location
    UK
    Posts
    1,221
    Plugin Contributions
    1

    Default Re: How to add array to tpl main file

    From a more recent version of Zen Cart,
    Code:
    if (in_array($current_page_base,explode(",",'login,checkout,checkout_shipping,checkout_shipping_address,checkout_payment_address,checkout_payment,checkout_success')) ) {
        $flag_disable_left = true;
    }
    Is that what you want?
    Simon

  4. #4
    Join Date
    Jan 2013
    Posts
    808
    Plugin Contributions
    0

    Default Re: How to add array to tpl main file

    not want i want, that is the no problem part. i need to stretch screen on certain pages to.

  5. #5
    Join Date
    Feb 2009
    Location
    UK
    Posts
    1,221
    Plugin Contributions
    1

    Default Re: How to add array to tpl main file

    Quote Originally Posted by jimmie View Post
    not want i want, that is the no problem part. i need to stretch screen on certain pages to.
    I don't know that template but would a page-specific css stylesheet help. You could then set the centre column width to 100% on those pages.
    Simon

  6. #6
    Join Date
    Jan 2013
    Posts
    808
    Plugin Contributions
    0

    Default Re: How to add array to tpl main file

    not sure, but if you look in file i see
    Code:
    <div class="container">
        <div class="row">
          <div class="main-col 
    	  <?php if ((COLUMN_LEFT_STATUS == 1 && $body_id !== 'productinfo') || (COLUMN_RIGHT_STATUS == 1 && $body_id !== 'productinfo')) { ?>col-sm-9 <?php }?>
    	  <?php if (COLUMN_LEFT_STATUS == 1 ) {?> left_column<?php }?><?php if (COLUMN_RIGHT_STATUS == 1 ) {?> right_column<?php }?>
          <?php if ((COLUMN_LEFT_STATUS == 0 && $body_id !== 'productinfo') || (COLUMN_RIGHT_STATUS == 0 && $body_id !== 'productinfo')) { ?>col-sm-12 <?php }?>">
    wanted to add an array for certain pages

 

 

Similar Threads

  1. v151 Add image to header.tpl file
    By sports guy in forum Templates, Stylesheets, Page Layout
    Replies: 7
    Last Post: 13 Nov 2012, 09:45 PM
  2. which tpl file?
    By creff in forum Templates, Stylesheets, Page Layout
    Replies: 13
    Last Post: 26 Oct 2009, 04:10 PM
  3. Blank Sidebox TPL file Apostrophe
    By ryanb4614 in forum Basic Configuration
    Replies: 2
    Last Post: 19 Aug 2009, 02:01 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