access an item's parameters in a category view [solved]

More
12 years 7 months ago - 12 years 7 months ago #23909 by hede
In a category view I loop through the items like this:
Code:
<?php foreach ($items as $item) : ?>
How do I access the parameters of each $item? I tried this but it dosn't give any result:
Code:
<?php echo $item->params->get('bottom_cols');?>
Thank you.

FF on Win10, FLEXIcontent version 3.0.10 on Joomla 3.4
Last edit: 12 years 7 months ago by hede.

Please Log in or Create an account to join the conversation.

More
12 years 7 months ago #23939 by ggppdk
Tryparameters instead of params:
Like this:
<?php echo $item->parameters->get('bottom_cols');?>


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

More
12 years 7 months ago #23944 by hede
Thank you. No success, non of the following works:
Code:
<?php echo $item->params->get('alias', 'x');?> <?php echo $item->parameters->get('alias', 'y');?> <?php echo $item->fields['alias']->display;?>
I got this to work though with a custom field:
Code:
<?php echo $item->fields['test']->display;?>
But I would really prefer to use parameters.

FF on Win10, FLEXIcontent version 3.0.10 on Joomla 3.4

Please Log in or Create an account to join the conversation.

More
12 years 7 months ago #23964 by ggppdk
aaa, yes the item parameters are not created in category view,

You could use :
Code:
$itemparams = new JParameter ($item->attribs);
But not these do not include heritage from component or category parameters etc,

if do not need heritage used the above other-wise use something like (i did not test):

[... removed], see my next post


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

More
12 years 7 months ago #23967 by hede
Thanks a lot ggppdk!

Problem with $itemparams = new JParameter ($item->attribs); is that it does NOT contain the layout parameters. It only holds the "Parameters : standard" but not "Parameters : default" or "Parameters : faq" hence also not any parameters from a custom layout/template.

Your other solution is way beyond me. But thanks anyway.

FF on Win10, FLEXIcontent version 3.0.10 on Joomla 3.4

Please Log in or Create an account to join the conversation.

More
12 years 7 months ago #23976 by ggppdk
add at the top of your category_items.php:
Code:
require_once ('components/com_flexicontent/models/item.php');
and, try this for every item:
Code:
$curmodel = new FlexicontentModelItem(); $curmodel->setId($item->id); //$curitem = $curmodel->getItem($item->id, false); $curmodel->_loadItemParams(); $curiparams = $curmodel->_item->parameters;

The includes parameters:
1. global components parameters,
2. overridden by category parameters,
3. overridden by content type parameters
4. overridden by item parameters


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.351 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline