Add php in Item HTML parameter

More
12 years 11 months ago #35638 by bendeb
Thank Micker.
I look this, and I will tell you. :)
But it seems this plugins can't do what I have to do.

In fact, I have to put some php code in the Item HTML of relation field, because this custom HTML is repeated for each relation item choosen.

At this time, I put this in my custom HTML of my relation field :
Code:
<tr><td>{{title}}</td><td>{{field1}}</td><td>{{field2}}</td><td>{{field3}}</td></tr>

And here is the code in my template (item.php) :
Code:
<table><tbody><tr><th>Title</th><th>Field1</th> <th>Field2</th><th>Field3</th></tr> <?php echo $this->fields['my_relation_field']->display;?> </tbody> </table>

So, when I choose a related item, it display with its values in a table and it's great.
But now, I want to add another column with some php code for each related item. Like this :
Code:
<tr><td>{{title}}</td><td>{{field1}}</td><td>{{field2}}</td><td>{{field3}}</td><td>--SOME PHP CODE--</td></tr>

In this case, the php code could repeat itself for each item. :)

I don't know if I'm understandable. :?

Flexicontent 4.1.0b1
Joomla 3.9.18

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

More
12 years 11 months ago #35644 by bendeb
I tried the plugin, and maybe it could do what I want but it seems there is a problem.
In the field parameters, if a choose Langage HTML, it works, but if I choose Langage PHP, I have this error in frontend :

Notice: Undefined property: stdClass::$display in ...\components\com_flexicontent\templates\my_template\item.php on line 222

Line 222 is the displaying of the field :
Code:
<b>Code :</b> <?php echo $this->fields['code']->display; ?>

So, for now, I don't know if this plugin will help me for what I have to do, but maybe yes. :?

I use the latest version of Flexicontent (r1659 for Joomla 2.5).

Flexicontent 4.1.0b1
Joomla 3.9.18

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

More
12 years 11 months ago #35645 by ggppdk
Hello,
A solution now
is to use:
ReReplacer + Sourcer from Nonumber extensions

These will allow you to replace specific text with the execution of PHP code

- Negative , it is a little slower than implementing this inside FLEXIcontent CORE
- Positive you add replacement anywhere !!
- NOTE: the more replacement you add the slower it gets, so use only what is needed (a small number of replacements will not harm performance !!)

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
12 years 11 months ago #35646 by bendeb
Thank ggppdk.
I will try this method and say you if it's good. :)

Flexicontent 4.1.0b1
Joomla 3.9.18

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

More
12 years 11 months ago #35652 by bendeb
Rereplacer works fine.
However, Sourcerer is not activated in Rereplacer, I don't have the button to put code in the text area Search and the textarea Replace. :?

Flexicontent 4.1.0b1
Joomla 3.9.18

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

More
12 years 11 months ago #35655 by ggppdk
Hello,
as far as i know/remember, it is possible, please see documentation and ask/search in Nonumber forums


-- 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
12 years 11 months ago #35656 by bendeb
Yes, I'll do this. :)

But maybe I found a solution.
I create a textarea field in flexicontent (named 'code') with HTML allowed.
And in my item, I can use the Sourcerer button for this field and put my php codes.
And after, I call my field 'code' with {{code}} in Item HTML of my relation field.
By this way, I think I don't need Rereplacer for what I have to do (although Rereplacer is great too for others applications).
Thank to told me about these extensions. ;)

Flexicontent 4.1.0b1
Joomla 3.9.18

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

More
12 years 11 months ago #35659 by bendeb
Or I can put my code in a custom html module, and create a field of type Load module.
It's more convenient for what I have to do, for this code is the same for each item. :)

Flexicontent 4.1.0b1
Joomla 3.9.18

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

More
12 years 11 months ago #35661 by ggppdk
NOTE: flexicontent loadmodule field can make customizations of a the same module per item !!!!

see description of last parameter !


-- 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
12 years 11 months ago #35666 by bendeb
yes, I have see that. :)

Flexicontent 4.1.0b1
Joomla 3.9.18

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