Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2006
    Posts
    12
    Plugin Contributions
    0

    Default tpl_divular_display

    Hi all,

    My first post and working on my first zencart project, really loving it at the moment (dont think this feeling will fade!). I have to say a big thank-you first to everyone who has worked and helped with zencart as I am finding it very intuitive and well put together, including the documentation.

    As the title describes I am trying to build a 'div' based template, I am currently modifying tpl_tabular_display.php (copied as tpl_divular_display.php) and have a feeling it may get messy as i edit the th/td inserts. Has anyone tried doing this before? Can anyone help me?

    Thanks!
    Loque

  2. #2
    Join Date
    Dec 2006
    Posts
    12
    Plugin Contributions
    0

    Default Re: tpl_divular_display

    Ok, that was very easy, still working on it, but basically...

    I am php noobie so that was a pretty lucky guess (I'll put it down to zencart being so good).

    PHP Code:
    <?php
    /**
     * Common Template - tpl_divular_display.php
     *
     * This file is used for generating divular output where needed, based on the supplied array of table-cell contents.
     *
     * @package templateSystem
     * @copyright Copyright 2003-2006 Zen Cart Development Team
     * @copyright Portions Copyright 2003 osCommerce
     * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
     * @original version $Id: tpl_tabular_display.php 3957 2006-07-13 07:27:06Z drbyte $
     * @modified by Loque 2006-12-13
     */

    //print_r($list_box_contents);
      
    $cell_scope = (!isset($cell_scope) || empty($cell_scope)) ? 'col' $cell_scope;
      
    $cell_title = (!isset($cell_title) || empty($cell_title)) ? 'list' $cell_title;

    ?>
    <div id="<?php echo 'cat' $cPath 'Table'?>" class="tabTable">
    <?php
      
    for($row=0$row<sizeof($list_box_contents); $row++) {
        
    $r_params "";
        
    $c_params "";
        if (isset(
    $list_box_contents[$row]['params'])) $r_params .= ' ' $list_box_contents[$row]['params'];
    ?>
      <div<?php echo $r_params?>>
    <?php
        
    for($col=0;$col<sizeof($list_box_contents[$row]);$col++) {
          
    $c_params "";
          
    $cell_type = ($row==0) ? 'div' 'div';
          if (isset(
    $list_box_contents[$row][$col]['params'])) $c_params .= ' ' $list_box_contents[$row][$col]['params'];
          if (isset(
    $list_box_contents[$row][$col]['text'])) {
    ?>
       <?php echo '<' $cell_type $c_params '>'?><?php echo $list_box_contents[$row][$col]['text'?><?php echo '</' $cell_type '>'  "\n"?>
    <?php
          
    }
        }
    ?>
      </div>
    <?php
      
    }
    ?> 
    </div>
    Last edited by Loque; 13 Dec 2006 at 06:28 PM.

  3. #3
    Join Date
    Jun 2003
    Posts
    33,721
    Plugin Contributions
    0

    Default Re: tpl_divular_display

    This is probably a silly question, but the tabular builds the table to display tabular information, why change that?
    Please do not PM for support issues: a private solution doesn't benefit the community.

    Be careful with unsolicited advice via email or PM - Make sure the person you are talking to is a reliable source.

  4. #4
    Join Date
    Dec 2006
    Posts
    12
    Plugin Contributions
    0

    Default Re: tpl_divular_display

    I have been given a design that places the products in a non-tabular format, breaking the use of a table for displaying the products.

    It also singles out the first product displaying it differently to the others. So this is my next challenge :&#172;| (if it becomes to tricky i will just hand it back to the designer and let him know of the restrictions)

  5. #5
    Join Date
    Dec 2006
    Posts
    12
    Plugin Contributions
    0

    Default Re: tpl_divular_display

    Ok, this seems to work on my last point,

    PHP Code:
    <?php
    /**
     * Common Template - tpl_divular_display.php
     *
     * This file is used for generating divular output where needed, based on the supplied array of table-cell contents.
     *
     * @package templateSystem
     * @copyright Copyright 2003-2006 Zen Cart Development Team
     * @copyright Portions Copyright 2003 osCommerce
     * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
     * @original version $Id: tpl_tabular_display.php 3957 2006-07-13 07:27:06Z drbyte $
     * @modified by Loque 2006-12-13
     */

    //print_r($list_box_contents);
      
    $cell_scope = (!isset($cell_scope) || empty($cell_scope)) ? 'col' $cell_scope;
      
    $cell_title = (!isset($cell_title) || empty($cell_title)) ? 'list' $cell_title;

    ?>
    <div id="<?php echo 'cat' $cPath 'Table'?>" class="tabTable">
    <?php
      
    for($row=1$row<sizeof($list_box_contents); $row++) { // modified to exclude the headings... 
        
    $r_params "";
        
    $c_params "";
        if (isset(
    $list_box_contents[$row]['params'])) $r_params .= ' ' $list_box_contents[$row]['params'];
    ?>
      <div<?php echo $r_params?> <?php echo 'id="productList' $row '"'  ?>>
    <?php
        
    for($col=0;$col<sizeof($list_box_contents[$row]);$col++) {
          
    $c_params "";
          
    $cell_type = ($row==0) ? 'div' 'div';
          if (isset(
    $list_box_contents[$row][$col]['params'])) $c_params .= ' ' $list_box_contents[$row][$col]['params'];
          if (isset(
    $list_box_contents[$row][$col]['text'])) {
    ?>
       <?php echo '<' $cell_type $c_params '>'?><?php echo $list_box_contents[$row][$col]['text'?><?php echo '</' $cell_type '>'  "\n"?>
    <?php
          
    }
        }
    ?>
      </div>
    <?php
      
    }
    ?> 
    </div>
    outputs to this;

    HTML Code:
    <div id="cat65Table" class="tabTable">
      <div class="productListing-odd" id="productList1">
       <div class="productListing-data"><a href="http://yoursite.net//shop/index.php?main_page=product_info&amp;cPath=65&amp;products_id=182"><img src="images/blank.png" alt="CREST" title=" CREST " width="100" height="80" class="listingProductImage" /></a></div>
       <div class="productListing-data">30</div>
       <div class="productListing-data"><h3 class="itemTitle"><a href="http://yoursite.net//shop/index.php?main_page=product_info&amp;cPath=65&amp;products_id=182">CREST</a></h3><div class="listingDescription">165G 100% COMBED COTTON JERSEY PRINT ON FRONT AND BACK</div></div>
       <div class="productListing-data">&pound;25.00<br /><br /><a href="http://yoursite.net//shop/index.php?main_page=index&amp;cPath=65&amp;sort=20a&amp;action=buy_now&amp;products_id=182"><img src="includes/templates/template_default/buttons/english/button_buy_now.gif" alt="Buy Now" title=" Buy Now " width="60" height="15" class="listingBuyNowButton" /></a><br /><br /></div>
      </div>
      <div class="productListing-even" id="productList2">
       <div class="productListing-data"><a href="http://yoursite.net//shop/index.php?main_page=product_info&amp;cPath=65&amp;products_id=183"><img src="images/blank.png" alt="RETRO LOGO" title=" RETRO LOGO " width="100" height="80" class="listingProductImage" /></a></div>
       <div class="productListing-data">30</div>
       <div class="productListing-data"><h3 class="itemTitle"><a href="http://yoursite.net//shop/index.php?main_page=product_info&amp;cPath=65&amp;products_id=183">RETRO LOGO</a></h3><div class="listingDescription">165G 100% COMBED COTTON JERSEY PRINT ON FRONT AND BACK</div></div>
       <div class="productListing-data">&pound;25.00<br /><br /><a href="http://yoursite.net//shop/index.php?main_page=index&amp;cPath=65&amp;sort=20a&amp;action=buy_now&amp;products_id=183"><img src="includes/templates/template_default/buttons/english/button_buy_now.gif" alt="Buy Now" title=" Buy Now " width="60" height="15" class="listingBuyNowButton" /></a><br /><br /></div>
      </div>
      <div class="productListing-odd" id="productList3">
       <div class="productListing-data"><a href="http://yoursite.net//shop/index.php?main_page=product_info&amp;cPath=65&amp;products_id=181"><img src="images/blank.png" alt="ROOTS" title=" ROOTS " width="100" height="80" class="listingProductImage" /></a></div>
       <div class="productListing-data">30</div>
       <div class="productListing-data"><h3 class="itemTitle"><a href="http://yoursite.net//shop/index.php?main_page=product_info&amp;cPath=65&amp;products_id=181">ROOTS</a></h3><div class="listingDescription">160G 100% COTTON JERSEY PRINT ON FRONT AND ARM</div></div>
       <div class="productListing-data">&pound;25.00<br /><br /><a href="http://yoursite.net//shop/index.php?main_page=index&amp;cPath=65&amp;sort=20a&amp;action=buy_now&amp;products_id=181"><img src="includes/templates/template_default/buttons/english/button_buy_now.gif" alt="Buy Now" title=" Buy Now " width="60" height="15" class="listingBuyNowButton" /></a><br /><br /></div>
      </div>
      <div class="productListing-even" id="productList4">
       <div class="productListing-data"><a href="http://yoursite.net//shop/index.php?main_page=product_info&amp;cPath=65&amp;products_id=180"><img src="images/blank.png" alt="SKATER 1989" title=" SKATER 1989 " width="100" height="80" class="listingProductImage" /></a></div>
       <div class="productListing-data">30</div>
       <div class="productListing-data"><h3 class="itemTitle"><a href="http://yoursite.net//shop/index.php?main_page=product_info&amp;cPath=65&amp;products_id=180">SKATER 1989</a></h3><div class="listingDescription">160G 100% COTTON JERSEY PRINT ON FRONT AND BACK</div></div>
       <div class="productListing-data">&pound;25.00<br /><br /><a href="http://yoursite.net//shop/index.php?main_page=product_info&amp;cPath=65&amp;products_id=180">... more info</a><br /><br /></div>
      </div>
    </div>
    I am probably doing something silly somewhere :¬)

 

 

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