Jump to content


Photo
- - - - -

How to get custom parameters from template.xml

custom params

  • This topic is locked This topic is locked
6 replies to this topic

#1 muhammad

muhammad

Posted 14 August 2013 - 05:53

Calling $view->params->get('template.item_sidebar') in renderer/item/full.php gives errors.

 

How & what should I call instead of $view->params->get('template.item_sidebar') to get my custom parameters.

 

 

 



#2 SmetDenis

SmetDenis
  • Administrators
  • User rate: 139.4
  • posts: 16232
  • topics: 200

Posted 14 August 2013 - 21:50

Try replace $view to $this or $item variable.
  • 0
JBZoo v4.0 и новый чудный мир Open Source GPL
Отключайте проверку лицензий как можно скорее!



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


#3 muhammad

muhammad
  • Topic Starter
  • Members
  • User rate: ~
  • posts: 4
  • topics: 1

Posted 16 August 2013 - 20:37

Try replace $view to $this or $item variable.

 

( $this-->params->get ) gives error.  ( $item-->params->get ) doesn't show error but it gets nothing. No custom parameters get implimented through this. If I set a custom list params like: 1.Left 2.Right & call it by :

<?php $item_sidebar = $item->params->get('template.item_sidebar'); ?>

It gets nothing.



#4 muhammad

muhammad
  • Topic Starter
  • Members
  • User rate: ~
  • posts: 4
  • topics: 1

Posted 16 August 2013 - 21:56

I want it like that:

if($item_sidebar == 'left') { do something; }, if($item_sidebar == "right") { do else; } 

In this form it doesn't get the value.

 

However if I call it like :

if($item_sidebar = 'left') { do something; }, if($item_sidebar = "right") { do else; }

It gets both the value & show all the results.

 

 

In core zoo : $view->params->get('template.item_sidebar') works fine



#5 SmetDenis

SmetDenis
  • Administrators
  • User rate: 139.4
  • posts: 16232
  • topics: 200

Posted 18 August 2013 - 10:06

Where are you set parameter "template.item_sidebar" ?
What is param-xml used?
  • 0
JBZoo v4.0 и новый чудный мир Open Source GPL
Отключайте проверку лицензий как можно скорее!



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


#6 muhammad

muhammad
  • Topic Starter
  • Members
  • User rate: ~
  • posts: 4
  • topics: 1

Posted 18 August 2013 - 21:00

If i set custom parameter in templates catalog folder template.xml :

<params group="item">
<param name="item_sidebar" type="list" default="right" label="Item Sidebar" description="Item Sdebar">
            <option value="left">Left</option>
            <option value="right">Right</option>
</param>
</params>

In full.php:  $item_sidebar = $item->params->get('template.item_sidebar');

Variable $item_sidebar not getting proper list value from the backend for if statement.

 

 

 

If I call:

if($item_sidebar =="left")  { do some;}  if($item_sidebar =="right")  { do other;}

$item_sidebar getting both the value. So 1 statement doesn't work.

 

 

If I call:

if($item_sidebar = "left")  { do some;}  if($item_sidebar = "right")  { do other;}

Both the results get displayed.

 

 

If I call:

if($item_sidebar = "left")  { do some;}  elseif($item_sidebar = "right")  { do other;}

only first statement loads.

 

 

In core zoo template works fine:

$item_sidebar = $view->params->get('template.item_sidebar');

 

 

 

 

   



#7 SmetDenis

SmetDenis
  • Administrators
  • User rate: 139.4
  • posts: 16232
  • topics: 200

Posted 18 August 2013 - 22:47

I tried in full.php and teaser.php this code.
Its work fine.

echo $item->params->get('template.item_sidebar', '<DEFAULT VALUE>');
Are you save param in item?
20130819-165-71kb_200x0.jpg

20130819-s9k-164kb_200x0.jpg

20130819-629-36kb_200x0.jpg
  • 0
JBZoo v4.0 и новый чудный мир Open Source GPL
Отключайте проверку лицензий как можно скорее!



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





Click to return to top of page in style!