www.webdeveloper.com
Results 1 to 4 of 4

Thread: Unexpected results with math formula. Also, can't pass value.

  1. #1
    Join Date
    Nov 2004
    Posts
    63

    Unexpected results with math formula. Also, can't pass value.

    For those that are aware of the component, I'm attempting to edit one of the templates in ZOO 3.1.6 (for Joomla 3.x).

    From what I can gather, when going into a category, ZOO first calls the category.php file, which calls the _items.php file, which calls the _item.php file.

    The structure for the HTML / columns and rows seems to be done in the _items.php file but I need a value to pass into _item.php.

    Here is my _items.php file:
    PHP Code:
    <?php
    /**
    * @package   com_zoo
    * @author    YOOtheme http://www.yootheme.com
    * @copyright Copyright (C) YOOtheme GmbH
    * @license   http://www.gnu.org/licenses/gpl.html GNU/GPL
    */

    // no direct access
    defined('_JEXEC') or die('Restricted access');
                    
    // init vars
    $i       0;
    $columns = array();
    $column  0;
    $row     0;
    $rows    ceil(count($this->items) / $this->params->get('template.items_cols'));

    // create columns
    foreach ($this->items as $item) {

        if (
    $this->params->get('template.items_order')) {
            
    // order down
            
    if ($row >= $rows) {
                
    $column++;
                
    $row  0;
                
    $rows ceil((count($this->items) - $i) / ($this->params->get('template.items_cols') - $column));
            }
            
    $row++;
            
    $i++;
        } else {
            
    // order across
            
    $column $i++ % $this->params->get('template.items_cols');
        }

        if (!isset(
    $columns[$column])) {
            
    $columns[$column] = '';
        }

        
    $columns[$column] .= $this->partial('item'compact('item'));
    }

    // render columns
    $count count($columns);
    if (
    $count) {
        echo 
    '<div class="items items-col-'.$count.'">';
        for (
    $j 0$j $count$j++) {
            
    $first = ($j == 0) ? ' first' null;
            
    $last  = ($j == $count 1) ? ' last' null;
        
    $oddeven = (($j 2) == 0) ? ' row-even' ' row-odd';
            echo 
    '<div class="width'.intval(100 $count).$first.$last.'">'.$columns[$j].'</div>';
        }
        echo 
    '</div>';
    }

    // render pagination
    echo $this->partial('pagination');
    Here is my _item.php file:
    PHP Code:
    <?php
    /**
    * @package   com_zoo
    * @author    YOOtheme http://www.yootheme.com
    * @copyright Copyright (C) YOOtheme GmbH
    * @license   http://www.gnu.org/licenses/gpl.html GNU/GPL
    */

    // no direct access
    defined('_JEXEC') or die('Restricted access');

    ?>

    <div class="teaser-item">
        <div class="teaser-item-bg<?php echo $oddeven?>">
        <?php if ($item) : ?>
            
            <?php echo $this->renderer->render('item.teaser', array('view' => $this'item' => $item)); ?>

        <?php endif; ?>
        </div>
    </div>
    In _items.php I have created the variable $oddeven and am trying to set a text value to this variable to echo as a class in the appropriate spot. But, first my math statement seems to be breaking the script, and secondly I have tried a static variable but it doesn't seem to be picked up in the _item.php file.

    Can someone please help me?

  2. #2
    Join Date
    Nov 2004
    Posts
    63
    117 views... Nobody have a suggestion for me?

  3. #3
    Join Date
    Jul 2013
    Location
    Voorheesville NY USA
    Posts
    711
    Have you tried to set a session var to be used in whatever script ?

    Can you point out the math problem statement?
    JG
    PS - If you're posting here you should be using:

    error_reporting(E_ALL | E_NOTICE);
    ini_set('display_errors', '1');


    at the top of ALL php code while you develop it!

  4. #4
    Join Date
    Nov 2004
    Posts
    63
    It's alright. Rather than trying to work with their script, i have just re-coded the whole thing.

    Thanks!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles