issue with checking magic tags via vars.. odd behaviour

This topic is: not resolved

This topic contains 2 replies, has 2 voices, and was last updated by  tomhermans 2 years, 10 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #163598

    tomhermans
    Participant
    Post count: 3

    Parse error: syntax error, unexpected T_STRING in /var/web/fn0639/highlifeplus.com/wp-highlife/wp-content/plugins/pods/classes/Pod.php(778) : eval()’d code on line 134

    I looked into my template file, and apparently this field:
    <pre>$childactiv = ‘{@kinderinfo}’;
    if(!empty($childactiv)) {
    echo $childactiv’;
    }
    </pre>

    produced the error (for this specific pod-item, not all of them do this.)
    I checked the field, it is a normal paragraph (desc)-field, with nothing but regular, plain text in it, no tags, just chars..

    So for now I edited the template, leaving that pod-field out, but when surfing I found another pod-item with the same error (while the field was still out..)

    Does this have something to do with the upgrade, or …

    When I just try to display the field with {@kinderinfo} that works fine..
    just not able to check it’s value by putting it in a variable..

    #163599

    logikal16
    Member

    Tom,

    Magic Tags don’t return anything — they output values directly. This is a problem since you need to return the value into the $childactiv variable. Let’s walk through the code:

    Let’s say that the actual value of {@kinderinfo} is:

    What happens with Magic Tags is this:

    That extra single quote will cause PHP to break. If you simply want to output a value, then Magic Tags are fine. If you need to get the value into PHP itself, then use get_field() instead:

    Hope that helps.

    #163600

    tomhermans
    Participant
    Post count: 3

    aha !
    indeed, didn’t think about that..
    found it a bit odd, since the plugin-upgrade didn’t mention that kind of adjustments..

    thanks Matt.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

Wordpress Cloud Hosting