How ro render specified item?

More
13 years 4 months ago #29999 by dkom
Hello! In my PHP code I want to render specified $id (id of flexicontent item) with $template (flexicontent template).

How me to do it?

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

More
13 years 4 months ago #30004 by ggppdk
What PHP code?

is your code executed with Joomla framework loaded or it some custom code?

which component is active? is it flexicontent or other?

if it is flexicontent which view is active? (category?)


-- 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 review. Thanks!

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

More
13 years 4 months ago #30006 by dkom
Replied by dkom on topic How ro render specified item?
Yes, it is my own Joomla module. I have two variables $flexiItemId and $template and want to visualize this item with `item` layout.

Currently my code runs while rendering option=com_flexicontent&view=item, but... why does it matter? I want (if it possible) universal code just to render the item I have (or maybe array of items).

For example I want something like:
Code:
for ($itemsId as $itemId) { $item = new FlexiItem($itemId); $template = new FlexiTemplate($templateName); $html = $template->render($item); echo $html; }

Right now to render my item as workaround I download URL:
Code:
JURI::base()."index.php?option=com_flexicontent&view=item&tmpl=component&id=".intval($itemId);
But it is
1) gets HTML only for default item type template
2) overkill due to unnesessary HTTP requests

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

More
13 years 4 months ago #30013 by ggppdk
there is code for rendering an item in category view *(an FC content item mean to display author description)

but i think maybe it would be better to use iframe?


-- 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 review. Thanks!

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

More
13 years 4 months ago #30022 by dkom
Replied by dkom on topic How ro render specified item?
I'll see code in categories view...

IFrame is not good solution because of problems with CSS in that case. Also HTTP overkill still exists.
(have imagined page with 100 iframes... 100 net requests). :?

I browsed the code of flexicontent and see that is uses JRequest parameters. Maybe better to make new abstraction level, to do model to be not depending of network parameters?

Another idea (as workaround) is to save JRequest parameters, fill with another, run Flexi renderer, and load old JRequest parameters. How do you think, as Flexi developer, is it realistic?

Also, I think, feature to easely use CCK items in code is key for CCK. I was very surprised (after using Drupal CCK) that Flexicontent does not have this one.

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

More
13 years 4 months ago #30030 by dkom
Replied by dkom on topic How ro render specified item?
The code from categories is terrible, it is context dependent, uses JRequest static variables instead of function arguments.
If it'll be fixed, the work with CCK becames much easy and flexible.


Btw, I have done better workaround:
Code:
shell_exec('php '.$_SERVER['SCRIPT_FILENAME'].' option=com_flexicontent view=item tmpl=component id=' . intval($itemId))

and parsing <body> tag. But it is still not the best solution for that.

If I can improve and contribute code into Flexicontent, let me know, how do you think: is it possible without changing all product design to create new abstraction level (between JRequest and FlexiContent item/categories classes) and from where to start.

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

More
13 years 4 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 review. Thanks!

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

More
13 years 4 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 review. Thanks!

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

More
13 years 3 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
13 years 3 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.

Moderators: vistamediajoomlacornerggppdk
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
Save