[Solved]Displaying extra data from items of a subcategory

More
12 years 3 months ago - 12 years 3 months ago #21577 by jdc18
I want to display the other fields I added to an item of a subcategory in my main category. Here it is what I am doing,
I created a category and type called Page, which is similar to articles. Also, I created another category and type called Project.
The category project is a subcategory of Page. And I want to display a small index of the items of type projects.
To obtain the items of this subcategory on the category I do the following:
Code:
$Proy = new FlexicontentModelCategory(); $Proy->setId($this->categories[0]->id); $Proy->getCategory(); $Proy->getData(); $Proy->getChilds(); $ProyView = new FlexicontentViewCategory($Proy);

After I do this I have a list of the items, and I can access the title and the introtext of all the items, but I dont have access other fields like for example images, year of the project, etc.

So I figured I have to use a similar class like FlexicontentModelCategory but for items, that can connect to the database to get the rest of the items like it does for every item with FlexicontentModelItems.
I tried using FlexicontentModelItems, but it didnt recognize the class, i am asuming it has to do with the fact that FlexicontentModelCategory is called in as part of the mcv, and FlexicontentModelItems is called on it respective Model. (I dont know how to explain this in english, but it make senses that is doesnt work respecting the mcv thing)

How can I call that class to get the information need to that, or should I use another class or should I write my own class or.
Last edit: 12 years 3 months ago by jdc18.

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

More
12 years 3 months ago #21583 by ggppdk
To create the custom fields that are on the category layout of your template:

you will need to include /components/com_flexicontent/class/flexicontent.fields.php

and then call this function on the items:
function getFields($items, $view = 'item', $params = null);

$subitems = FlexicontentFields::getFields($subitems, 'category', $params, $aid);

$params is category params

Did not test it should work
Regards


-- 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 3 months ago #21597 by jdc18
Hi thanks for the info, it has being very helpfull.

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

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.264 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