1. NOTICE: If you are using Fabrik and update to Joomla 3.10, you will need to update to Fabrik 3.10. And, if you are using Fabrik, do not upgrade to Joomla 4, we do not have a supported version ready for release. More information on a release date coming soon. Also, please note that Fabrik 3.10 will not install on any Joomla sites less than 3.8.
    Dismiss Notice

PHP Syntax Error when using placeholder in eval

Discussion in 'Community' started by achartier, Jul 22, 2018.

Thread Status:
Not open for further replies.
  1. achartier

    achartier Active Member

    Level: Community
    I have a field element called care_and_share___details which is rendered as a wysiwyg editor window. I also have a display element called care_and_share___link where I want to test if the user actually entered anything into the details element. In the default eval for the link element I am trying to use strlen('{care_and_share___details}') but this fails on a php syntax error whenever the content of the details includes any quotation marks.

    I have confirmed that magic quotes is turned off. I have the most recent Joomla and most recent github update.

    How might I make this test without throwing the error?

    Thanks.
     
  2. achartier

    achartier Active Member

    Level: Community
    OK, solved my problem. The Display element is only required in list view, so in the eval I added a
    Code (Text):
    if (!array_key_exists('__pk_val', $data)) {return;}
    and this will simply return when we are in form mode. In list mode rather than using the '{element_name}' syntax I can test $data['element_name'] and this does not require substitution and hence will not choke on embedded quotes.

    Hopefully this will help anyone else who comes across the issue.
     
  3. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    Yeah, quotes in the values of placeholders are a problem, and there simply isn't a workable solution.

    -- hugh
     
Thread Status:
Not open for further replies.

Share This Page