Using FlexicontentFields::getFields in modulecrashes server

More
11 years 11 months ago #32948 by rubenreyes
Hello,

We are building a module that displays Flexicontent items.

We are following the instructions in the FAQ about Retrieving the HTML DISPLAY of FC fields ( www.flexicontent.org/documentati ... -code.html )

When the code gets to the line FlexicontentFields::getFields($items); the server crashes because the code uses more than the allocated memory (96MB).

Here is the rest of the code for you to check. $item is a simple array of items IDs. All the require_once declarations are at the top of my code.
Code:
require_once (JPATH_ADMINISTRATOR.DS.'components/com_flexicontent/defineconstants.php'); JTable::addIncludePath(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_flexicontent'.DS.'tables'); require_once("components/com_flexicontent/models/".FLEXI_ITEMVIEW.".php"); require_once("components/com_flexicontent/classes/flexicontent.fields.php"); require_once("components/com_flexicontent/classes/flexicontent.helper.php"); $id = '123'; // my fc item id $itemmodel = new FlexicontentModelItem(); // FC v.2 doesn't have an 's' in Items $item = $itemmodel->getItem($id,false); FlexicontentFields::getFields($item); $item_link = JRoute::_(FlexicontentHelperRoute::getItemRoute($item->slug, $item->categoryslug));

Is there an updated code to be used instead?
We are using FC 2.0.0 RC9b (r1601)

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

More
11 years 11 months ago #32949 by ggppdk
Hello,

function is supposed to be able to accept both an single item object and an array of item objects, but it has a double reference issue that results to infinite loop

there was an update/fix to it in r1617

For now did you try to call it exactly like in the example of the FAQ article ??
Code:
$items = array(&$item); FlexicontentFields::getFields($items);


-- 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 10 months ago #32961 by micker
i move this in dev forum ;)

FLEXIcontent is Free but involves a very big effort on our part.
Like the our support? (for a bug-free FC, despite being huge extension) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing reviews. Thanks![/size]

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

More
11 years 10 months ago #32963 by rubenreyes
Hi,

I changed it to the following, but it still breaks at the last line in this code:
Code:
$id = '123'; // my fc item id $itemmodel = new FlexicontentModelItem(); $item = $itemmodel->getItem($id,false); $items = array($item); FlexicontentFields::getFields($items);

I changed the server PHP settings to 1GB memory limit and 600secs execution, and still won't complete. So I think this is indeed an infinite loop.

The execution of the page without that line in the code uses only 17MB of memory.

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

More
11 years 10 months ago #32967 by rubenreyes
Hello

Just in case this is useful for you, I activated xdebug and I got the following stack track. See attached.

Will you produce and update soon to fix this? Or should I look for an alternative code to make my module work?

Thank you for your help!
Attachments:

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

More
11 years 10 months ago #32968 by ggppdk
You could try latest version from google SVN:

code.google.com/p/flexicontent/source/checkout


-- 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.899 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