Перейти к содержимому


Фотография
- - - - -

Elements description


Лучший Ответ Kess , 03 September 2013 - 11:15

It seems that you accidentally replaced more code that was needed. Here is how that file should be:

<?php
/**
 * JBZoo App is universal Joomla CCK, application for YooTheme Zoo component
 *
 * @package     jbzoo
 * @version     2.x Pro
 * @author      JBZoo App http://jbzoo.com
 * @copyright   Copyright (C) JBZoo.com,  All rights reserved.
 * @license     http://jbzoo.com/license-pro.php JBZoo Licence
 * @coder       Denis Smetannikov <denis@jbzoo.com>
 */

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


// default params
$params = array_merge(array(
    'first'      => 0,
    'last'       => 0,
    'showlabel'  => 0,
    'altlabel'   => '',
    'element'    => '',
    'style'      => 'jbblock',
    'tag'        => 'div',
    'labelTag'   => 'strong',
    'wrapperTag' => '',
    'clear'      => 0,
    'class'      => '',
    '_layout'    => '',
    '_position'  => '',
    '_index'     => '',
), $params);

// create label
$label = '';
$desc = '';
$tipcl = '';

if ($description = $element->config->get('description')) {
   $tipcl = ' hasTip';
   $desc = ' title="'.$description.'"';
}

if ($params['showlabel']) {
    $labelText = ($params['altlabel']) ? $params['altlabel'] : $element->getConfig()->get('name');
    $label     = '<' . $params['labelTag'] . ' class="element-label'.$tipcl.'"'.$desc.'> ' . $labelText . '</' . $params['labelTag'] . '>';
}

$classes = array_filter(array(
    'index-' . (int)$params['_index'],
    $params['class'],
    'element-' . $element->identifier,
    'element-' . $element->getElementType(),
    $params['first'] ? 'first' : '',
    $params['last'] ? 'last' : '',
));

// add clear after html
$clear = $params['clear'] ? '<div class="clear clr clearfix"></div>' : '';

// render HTML for  current element
$render = $element->render($params);

// wrapping the element HTML
if ($params['wrapperTag']) {
    $render = '<' . $params['wrapperTag'] . '>' . $render . '</' . $params['wrapperTag'] . '>';
}


// render result
echo '<' . $params['tag'] . ' class="' . implode(' ', $classes) . '">', $label,
    ' ' . $render, '</' . $params['tag'] . '>', "\n" . $clear;
Перейти к сообщению


  • Закрытая тема Тема закрыта
Сообщений в теме: 12

#1 P.K

P.K

Отправлено 31 August 2013 - 19:54

Hi

We have a field the element description that displays a tooltip when the item is edited.

Can that be shown also on the frontpage on the item page?

 

thanks


  • 0

#2 SmetDenis

SmetDenis

Отправлено 31 August 2013 - 21:30

This description you need for site administrators, as a help.
Maybe it easier for you to change the "Alternative Label" for the item layout?
  • 0
JBZoo v4.0 и новый чудный мир Open Source GPL
Отключайте проверку лицензий как можно скорее!



— Есть два типа людей: Кто еще не делает бекапы и кто уже делает бекапы.


#3 P.K

P.K

Отправлено 01 September 2013 - 18:07

I want that description to be displayed  to the users on the sites also. Creating a new description would increase the load. Instead i wanted to have this only displayed to the users(in the frontend) when they point the mouse on the header. Can this be possible?


  • 0

#4 Kess

Kess

Отправлено 01 September 2013 - 19:43

I think that's possible. I tried this on my copy of the demo site. Please, take a look here:

 

http://jbzoo.kess.com.ua/

 

Try to hover the mouse over the "Processor", "HDD", "OS" or "Video card" properties of the notebook teasers on the frontpage. Is this what you need?


  • 0

#5 P.K

P.K

Отправлено 02 September 2013 - 11:23

Hi

You got it right. I want this only but i may want that in the original tooltip like the one used in the zoo backend itself like this.

http://img11.imagesh...1/7290/c8gk.jpg

 

I think there would be no need to load extra js file for this and this may be part of already present js files?

 

thanks


  • 0

#6 Kess

Kess

Отправлено 02 September 2013 - 13:56

I managed to do it like you wanted. You can see how it works on that demo site. 

In order to do this you need to make changes in several files. Those files might be different from the ones I've changed. I'll try to describe how to find the needed files.

 

So, i wanted to add these tooltips to the properties in the teaser of my "product" type. I've opened

 

media/zoo/applications/jbuniversal/templates/catalog/renderer/item/product/teaser.php

 

and found there that properties are rendered with this line:

 

<?php echo $this->renderPosition('properties', array('style' => 'list')); ?>

 

Now we should find the file which renders this style. In this case it's the standard ZOO style, located here:

 

components/com_zoo/renderer/element/list.php

 

In here I've changed 

<li class="<?php echo $class; ?>">
	<?php echo $label.$element->render($params); ?>
</li>

to this:

<?php
if ($description = $element->config->get('description')) {
   $class .= " hasTip";
}
?>


<li class="<?php echo $class; ?>" <?php if ($description) { echo ' title="' . $description . '"'; } ?>>
	<?php echo $label.$element->render($params); ?>
</li>

This adds class "hasTip" and title to the elements with description. The only thing left now is to use standard joomla scripts that change this to tooltips like in backend. To do this just add

 

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

 

to the index.php of your frontend template.


  • 0

#7 P.K

P.K

Отправлено 02 September 2013 - 14:55

Hi
My properties are rendered like this
<table class="jbtable table zebra">
                
                     <?php echo $this->renderPosition('prop-2', array('style' => 'jbtable')); ?>
                        <h3>Screen</h3>
                        
                </table>
                <table class="jbtable table zebra">
                
                     <?php echo $this->renderPosition('prop-3', array('style' => 'jbtable')); ?>
                        <h3>Hardware</h3>
 
                </table>
So how do i find jbtable? 
Though i found it at media\zoo\applications\jbuniversal\templates\catalog\renderer\element
I am unsure on how to edit it?
  • 0

#8 Kess

Kess

Отправлено 02 September 2013 - 21:59

Here is the solution that should work for you:

 

Open media/zoo/applications/jbuniversal/templates/catalog/renderer/element/jbblock.php and replace this code:

// create label
$label = '';
if ($params['showlabel']) {
    $labelText = ($params['altlabel']) ? $params['altlabel'] : $element->getConfig()->get('name');
    $label     = '<' . $params['labelTag'] . ' class="element-label"> ' . $labelText . '</' . $params['labelTag'] . '>';
}

with this:

// create label
$label = '';
$desc = '';
$tipcl = '';

if ($description = $element->config->get('description')) {
   $tipcl = ' hasTip';
   $desc = ' title="'.$description.'"';
}

if ($params['showlabel']) {
    $labelText = ($params['altlabel']) ? $params['altlabel'] : $element->getConfig()->get('name');
    $label     = '<' . $params['labelTag'] . ' class="element-label'.$tipcl.'"'.$desc.'> ' . $labelText . '</' . $params['labelTag'] . '>';
}

And don't forget about JHTML::_('behavior.tooltip'); in your template.


  • 0

#9 P.K

P.K

Отправлено 03 September 2013 - 10:11

Hi

getting these errors

Notice: Undefined variable: classes inC:\xampp\htdocs\pgdemo\media\zoo\applications\jbuniversal\templates\catalog\renderer\element\jbblock.php on line 63

Warning: implode(): Invalid arguments passed inC:\xampp\htdocs\pgdemo\media\zoo\applications\jbuniversal\templates\catalog\renderer\element\jbblock.php on line 63

 

Code is 

62 // render result
63 echo '<' . $params['tag'] . ' class="' . implode(' ', $classes) . '">', $label,
64  ' ' . $render, '</' . $params['tag'] . '>', "\n" . $clear;

  • 0

#10 Kess

Kess

Отправлено 03 September 2013 - 10:28

Could you, please, paste here the complete contents of your jbblock.php? It would be best to use special button for pasting code.


  • 0




Click to return to top of page in style!