display dynamic content from flexi fields...

More
14 years 1 month ago #21702 by matthieu33
Hello,

after a brief search i wasn't able to find exactly what i wanted.

I have some fields into my flexicontent form on the backOffice.

I want to add some custom php code with for instance sorcerer to test the date field value of a field in the form.

When the content displays on the front-office, i would like to have my PHP custom code show a different content of the page related to the date (not the creation date) but a date field i added myself into the form.

So you have

Title : [your content]
Du date : [date i set manualy]
Description : [Your long content with PHP IF due date is < than today then display something.]

is it possible ? and do you know how to achieve this ?

Thank you

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

More
14 years 1 month ago #21704 by ggppdk
Well, you will need to write a custom field for this

maybe it could be done via an extra scope in universal module but we don't have it now

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

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

More
14 years 1 month ago #21706 by micker
maybe flexicodeinsert can do it
extensions.netassopro.com/5-exte ... codeinsert
regards

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
14 years 1 month ago #21708 by matthieu33
Hello, thank you for your answers.

Right now i am using Sourcerer.

So i can insert php code inside my flexicontent fields and displays fine the PHP code.

But i want to get value from a flexicontent form :

- for instance display dynamicaly within my description field, a date that has been entered into a date field. How to grab that variable to make it show on the front office within my description field ?

I am not sure my explanation is clear.

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

More
14 years 1 month ago #21714 by ggppdk
You will need to query the table:
#__flexicontent_fields_item_relations
Code:
$itemid = JRequest::getInt('id'); $datefieldid = 45; // id of your date field $query = "SELECT value" ." FROM #__flexicontent_fields_item_relations" ." WHERE field_id=$datefieldid AND item_id=$itemid "; $db =& JFactory::getDBO(); $db->setQuery($query ); $datefield = $db->loadResult();

In the above code set the variable $datefieldid to the id of you date field, also correct any syntax errors as i have not tested this

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

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

More
14 years 1 month ago #21716 by matthieu33
Thank you, i will test and i get back to you to tell you the result.

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

More
14 years 1 month ago #21784 by matthieu33
Hello,

unfortunatly, your solution, inside a Flexicontent field is not working.

I have no display back on screen with that code. I have changed the field id to the right one.

[COMMENT by ggppdk : the id was meant as an example, i have asked you to change it to the correct one.]
Code:
$itemid = JRequest::getInt('id'); $datefieldid = 15; // id of your date field $query = "SELECT value" ." FROM #__flexicontent_fields_item_relations" ." WHERE field_id=$datefieldid AND item_id=$itemid "; $db =& JFactory::getDBO(); $db->setQuery($query ); $datefield = $db->loadResult();

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

More
14 years 1 month ago #21786 by ggppdk
mmm, what do you mean you have changed the datefieldid to the right one?

of course you have to change the 'datefieldid', i don't know the id of you field, that is why i have asked you to change it in the first place. ;)

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

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

More
14 years 1 month ago #21791 by matthieu33
Thank you for your help.

This part is working like a charm now. I missed the point about the auto encoding as html entities of html tags from the hide/show wysiwyg joomla editor.

Now i have another thing to do and i am a bit stuck with this.

I want to access the flexi content fields from an external script. My script needs to update the description field doing an update having a test on a date field.

So it would do : If date of flexi content date field > than today, then update description field with my datas.
Code:
"update jos_content t1 SET introtext ='"MY TEXT' WHERE (SELECT COUNT(*) FROM jos_flexicontent_fields_item_relations t2 WHERE (t1.id=t2.item_id) AND t2.value < CURDATE())"

This part is also working. But to have things even better, i need to parse another field from the flexicontent form in order to insert the parsed data into my update... (an email in my case)

For instance my updated text (introtext) would be : "This is the updated text, presented to you by [get the value parsed from another field from the same flexicontent form]".

I really don't know how to proceed right now to get the value.

Any idea ? is it clear ? :?:

thank you

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

More
14 years 1 month ago #21819 by ggppdk
You mean "form field" or item field from database,
also this is beggining to become free custom development? :D

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

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