How ro render specified item?

More
11 years 6 months ago #30036 by ggppdk
It is easy to display all items fields of multiple items using this code (but you have it will not load the item's template layout)

Retrieving the HTML DISPLAY of FC fields inside 3rd-party code


-- 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
11 years 6 months ago #30086 by ggppdk
Hello, did you try this solution?


-- 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
11 years 6 months ago #30130 by dkom
Replied by dkom on topic How ro render specified item?

ggppdk wrote: Hello, did you try this solution?

Just started trying it.
Probably you have missed there:
Code:
require_once(JPATH_ADMINISTRATOR.DS."components/com_flexicontent/models/items.php");
Fixed.
But then I got a error:
Code:
Fatal error: Call to undefined method FlexicontentModelItems::getItem()
on calling "FlexicontentFields::getFields($items);".

Now I am exploring FlexiContent code to undestand why does it so.

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

More
11 years 6 months ago #30131 by dkom
Replied by dkom on topic How ro render specified item?
Also I think, it is a good idea to create

class AnyField(?) {
...
function getDisplay() {
FlexicontentFields::getFieldDisplay($this->ownerItem, $this->name);
return $this->display;
}
...
}


to be compatable with items' templates.
Template'll use
Code:
$field->getDisplay()
and it will not require calling another function before template (because outter code does not know what fields we are to render, and what we are not).

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

More
11 years 6 months ago #30133 by dkom
Replied by dkom on topic How ro render specified item?
Code:
require_once(JPATH_ADMINISTRATOR.DS."components/com_flexicontent/models/items.php"); require_once(JPATH_ADMINISTRATOR.DS."components/com_flexicontent/controllers/items.php"); $c = new FlexiContentControllerItems(); $itemmodel = $c->getModel('item');

This code works fine.
Now I'll try to integrate it with templates, thank you for help.

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

More
11 years 6 months ago #30149 by dkom
Replied by dkom on topic How ro render specified item?
Strange... I want to display selected item with template, but get an error:
Code:
$itemmodel = $c->getModel('item'); $item = $itemmodel->getItem($itemId, $check_view_access=false); $items = array(&$item); FlexicontentFields::getFields($items); require_once(JPATH_ADMINISTRATOR.DS."components/com_flexicontent/models/itemelement.php"); $view = new FlexicontentViewItem(); $view->setModel($itemmodel); print_r($view->display()); die;

$view->display
raises
Fatal error: Call to a member function get() on a non-object in /joomla-path/components/com_flexicontent/views/item/view.html.php on line 68

it seems getModel() returns null even I have set it before.

Could you explain what am I doing wrong?

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

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