Как добавить значок печати на страницу каталога в Zoo Pro 1.0.7.

Тема в разделе "ZOO", создана пользователем antidot, 06.06.2011.

  1. Offline

    antidot Недавно здесь

    Регистрация:
    31.01.2011
    Сообщения:
    6
    Симпатии:
    0
    Пол:
    Мужской
    Здравствуйте. Интересует такой вопрос, как добавить значек печати в item и _item. В настройках такого нету, только на страницы материалов можно добавлять. А в каталог как? Можно ли из джумлы выдернуть код php и вставить в определенное место php кода каталога?
    Вот код item:

    <?php

    /**
    * @package Zoo Component
    * @version 1.0.7 2009-09-02 14:42:37
    * @author YOOtheme http://www.yootheme.com
    * @copyright Copyright (C) 2007 - 2009 YOOtheme GmbH
    * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 only
    */


    // no direct access


    defined('_JEXEC') or die('Restricted access');



    // include assets css/js

    if (strtolower(substr($GLOBALS['mainframe']->getTemplate(), 0, 3)) != 'yoo') {

    JHTML::stylesheet('reset.css', 'components/com_zoo/assets/css/');

    }

    JHTML::stylesheet('zoo.css.php', 'components/com_zoo/templates/product/assets/css/');

    JHTML::script('zoo.js', 'components/com_zoo/assets/js/');



    $elements = $this->item->getElements(true);



    $specifications = array();

    foreach ($elements as $name => $element) {

    if (in_array($element->type, array('radio', 'select', 'text', 'textarea')) && $element->name != 'description') {

    $specifications[] = $element;

    }

    }



    $image = null;

    if (isset($elements['gallery'])) {

    $image = $elements['gallery'];

    } elseif (isset($elements['image'])) {

    $image = $elements['image'];

    }



    ?>




    <div id="yoo-zoo">

    <div class="product page-<?php echo $this->item->alias; ?>">



    <div class="item">



    <div class="box-t1">

    <div class="box-t2">

    <div class="box-t3"></div>

    </div>

    </div>



    <div class="box-1">



    <div class="details">



    <?php if ($image) : ?>

    <div class="image"><?php echo $image->render(ZOO_VIEW_ITEM); ?></div>

    <?php endif; ?>



    <h1 class="name"><?php echo $this->item->name; ?></h1>



    <?php if (isset($elements['rating'])) : ?>

    <?php echo $elements['rating']->render(ZOO_VIEW_ITEM); ?>

    <?php endif; ?>



    <?php if (isset($elements['description']) && $elements['description']->hasValue('readmore')) : ?>

    <div class="description"><?php echo $elements['description']->render(ZOO_VIEW_ITEM, 'readmore'); ?></div>

    <?php endif; ?>



    <?php if (count($specifications)) : ?>

    <h2 class="specifications"><?php echo JText::_('Specifications'); ?></h2>

    <table cellspacing="0" cellpadding="0" border="0">

    <?php foreach ($specifications as $name => $element) : ?>

    <?php if (!in_array($element->getDisplay(), array(1, 3))) continue; ?>




    <td class="label"><table border="0" width="100">
    <tbody>
    <tr>
    <td><?php echo $element->label; ?>:</td>
    </tr>
    </tbody>
    </table>
    </td>
    <tr>

    <td class="value"><?php echo $element->render(ZOO_VIEW_ITEM); ?></td>



    </tr>

    <?php endforeach; ?>

    </table>

    <?php endif; ?>

    </div>



    <?php if (isset($elements['comments'])) : ?>

    <div id="comments" class="comments"><?php echo $elements['comments']->render(ZOO_VIEW_ITEM); ?></div>

    <?php endif; ?>



    </div>



    <div class="box-b1">

    <div class="box-b2">

    <div class="box-b3"></div>

    </div>

    </div>



    </div>



    </div>

    </div>
    Скажите где в джумла можно скопировать код вывода на печать и куда вставить, в item и _item. Я вроде нашел что то похожее, но незнаю оно ли:
    <?php
    /**
    * @version $Id: icon.php 21078 2011-04-04 20:52:23Z dextercowley $
    * @package Joomla
    * @subpackage Content
    * @copyright Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.
    * @license GNU/GPL, see LICENSE.php
    * Joomla! is free software. This version may have been modified pursuant to the
    * GNU General Public License, and as distributed it includes or is derivative
    * of works licensed under the GNU General Public License or other free or open
    * source software licenses. See COPYRIGHT.php for copyright notices and
    * details.
    */

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

    /**
    * Content Component HTML Helper
    *
    * @static
    * @package Joomla
    * @subpackage Content
    * @since 1.5
    */
    class JHTMLIcon
    {
    function create($article, $params, $access, $attribs = array())
    {
    $uri =& JFactory::getURI();
    $ret = $uri->toString();

    $url = 'index.php?task=new&ret='.base64_encode($ret).'&id=0&sectionid='.$article->sectionid;

    if ($params->get('show_icons')) {
    $text = JHTML::_('image.site', 'new.png', '/images/M_images/', NULL, NULL, JText::_('New') );
    } else {
    $text = JText::_('New').'&nbsp;';
    }

    $attribs = array( 'title' => JText::_( 'New' ));
    return JHTML::_('link', JRoute::_($url), $text, $attribs);
    }

    function pdf($article, $params, $access, $attribs = array())
    {
    $url = 'index.php?view=article';
    $url .= @$article->catslug ? '&catid='.$article->catslug : '';
    $url .= '&id='.$article->slug.'&format=pdf';

    $status = 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=640,height=480,directories=no,location=no';

    // checks template image directory for image, if non found default are loaded
    if ($params->get('show_icons')) {
    $text = JHTML::_('image.site', 'pdf_button.png', '/images/M_images/', NULL, NULL, JText::_('PDF'));
    } else {
    $text = JText::_('PDF').'&nbsp;';
    }

    $attribs['title'] = JText::_( 'PDF' );
    $attribs['onclick'] = "window.open(this.href,'win2','".$status."'); return false;";
    $attribs['rel'] = 'nofollow';

    return JHTML::_('link', JRoute::_($url), $text, $attribs);
    }

    function email($article, $params, $access, $attribs = array())
    {
    require_once(JPATH_SITE.DS.'components'.DS.'com_mailto'.DS.'helpers'.DS.'mailto.php');
    $uri =& JURI::getInstance();
    $base = $uri->toString( array('scheme', 'host', 'port'));
    $link = $base.JRoute::_( ContentHelperRoute::getArticleRoute($article->slug, $article->catslug, $article->sectionid) , false );

    $url = 'index.php?option=com_mailto&tmpl=component&link='.MailToHelper::addLink($link);
    $status = 'width=400,height=350,menubar=yes,resizable=yes';

    if ($params->get('show_icons')) {
    $text = JHTML::_('image.site', 'emailButton.png', '/images/M_images/', NULL, NULL, JText::_('Email'));
    } else {
    $text = '&nbsp;'.JText::_('Email');
    }

    $attribs['title'] = JText::_( 'Email' );
    $attribs['onclick'] = "window.open(this.href,'win2','".$status."'); return false;";

    $output = JHTML::_('link', JRoute::_($url), $text, $attribs);
    return $output;
    }

    function edit($article, $params, $access, $attribs = array())
    {
    $user =& JFactory::getUser();
    $uri =& JFactory::getURI();
    $ret = $uri->toString();

    if ($params->get('popup')) {
    return;
    }

    if ($article->state < 0) {
    return;
    }

    if (!$access->canEdit && !($access->canEditOwn && $article->created_by == $user->get('id'))) {
    return;
    }

    JHTML::_('behavior.tooltip');

    $url = 'index.php?view=article&id='.$article->slug.'&task=edit&ret='.base64_encode($ret);
    $icon = $article->state ? 'edit.png' : 'edit_unpublished.png';
    $text = JHTML::_('image.site', $icon, '/images/M_images/', NULL, NULL, JText::_('Edit'));

    if ($article->state == 0) {
    $overlib = JText::_('Unpublished');
    } else {
    $overlib = JText::_('Published');
    }
    $date = JHTML::_('date', $article->created);
    $author = $article->created_by_alias ? $article->created_by_alias : $article->author;

    $overlib .= '&lt;br /&gt;';
    $overlib .= JText::_($article->groups);
    $overlib .= '&lt;br /&gt;';
    $overlib .= $date;
    $overlib .= '&lt;br /&gt;';
    $overlib .= htmlspecialchars($author, ENT_COMPAT, 'UTF-8');

    $button = JHTML::_('link', JRoute::_($url), $text);

    $output = '<span class="hasTip" title="'.JText::_( 'Edit Item' ).' :: '.$overlib.'">'.$button.'</span>';
    return $output;
    }


    function print_popup($article, $params, $access, $attribs = array())
    {
    $url = 'index.php?view=article';
    $url .= @$article->catslug ? '&catid='.$article->catslug : '';
    $url .= '&id='.$article->slug.'&tmpl=component&print=1&layout=default&page='.@ $request->limitstart;

    $status = 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=640,height=480,directories=no,location=no';

    // checks template image directory for image, if non found default are loaded
    if ( $params->get( 'show_icons' ) ) {
    $text = JHTML::_('image.site', 'printButton.png', '/images/M_images/', NULL, NULL, JText::_( 'Print' ) );
    } else {
    $text = JText::_( 'ICON_SEP' ) .'&nbsp;'. JText::_( 'Print' ) .'&nbsp;'. JText::_( 'ICON_SEP' );
    }

    $attribs['title'] = JText::_( 'Print' );
    $attribs['onclick'] = "window.open(this.href,'win2','".$status."'); return false;";
    $attribs['rel'] = 'nofollow';

    return JHTML::_('link', JRoute::_($url), $text, $attribs);
    }

    function print_screen($article, $params, $access, $attribs = array())
    {
    // checks template image directory for image, if non found default are loaded
    if ( $params->get( 'show_icons' ) ) {
    $text = JHTML::_('image.site', 'printButton.png', '/images/M_images/', NULL, NULL, JText::_( 'Print' ) );
    } else {
    $text = JText::_( 'ICON_SEP' ) .'&nbsp;'. JText::_( 'Print' ) .'&nbsp;'. JText::_( 'ICON_SEP' );
    }
    return '<a href="#" onclick="window.print();return false;">'.$text.'</a>';
    }

    }
    Заранее спасибо!
     
  2.  
  3. Offline

    antidot Недавно здесь

    Регистрация:
    31.01.2011
    Сообщения:
    6
    Симпатии:
    0
    Пол:
    Мужской
    Добавил вот какую строчку <a href="#" onclick="window.print();return false;"><img alt="4" src="/images/M_images/print.png" width="160" height="25" /></a> Печатает, но только вместе с меню, оно у меня в шапке. Получается, что сразу за страницей каталога распечатывается меню сайта. Как сделать чтобы печаталась, только страница каталога?
    Хочу добавить, что в IE распечатывается страница сайта целиком, зато на одном листе.
     
    Последнее редактирование: 06.06.2011

Поделиться этой страницей

Загрузка...