Uploaded image for project: 'phpBB3'
  1. phpBB3
  2. PHPBB3-7580

Allow isset() check in IF template syntax

    Details

    • Type: New Feature
    • Status: Unverified Fix
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.0.9
    • Fix Version/s: 3.1.0-b2
    • Component/s: Template Engine
    • Labels:

      Description

      Could it be possible to add an isset() check for variables to be used in template if statements?

      So you could do something like:

      <!-- IF isset FOO -->{FOO}<!-- ENDIF -->

      This would be quite useful when you need separate checks to see if a variable is outputted or if it is 0 or false.

        Activity

        Hide
        Desdenova Desdenova [X] (Inactive) added a comment -

        Doesn't it do that already for the following?

        <!-- IF FOO -->{FOO}<!-- ENDIF -->

        Unless I'm mistaken, if FOO isn't set or is false/0, the IF statement acts as if it is false already. O_o

        Show
        Desdenova Desdenova [X] (Inactive) added a comment - Doesn't it do that already for the following? <!-- IF FOO -->{FOO}<!-- ENDIF --> Unless I'm mistaken, if FOO isn't set or is false/0, the IF statement acts as if it is false already. O_o
        Hide
        EXreaction EXreaction [X] (Inactive) added a comment -

        I don't want to know if it is 0/false/anything. I want to know if it was set or not.

        Show
        EXreaction EXreaction [X] (Inactive) added a comment - I don't want to know if it is 0/false/anything. I want to know if it was set or not.
        Hide
        Desdenova Desdenova [X] (Inactive) added a comment -

        Just code it in a way where false would be acted upon as if it isn't set, or just use a separate template variable for it. Most of us do, and so does the phpBB core, I think.

        Show
        Desdenova Desdenova [X] (Inactive) added a comment - Just code it in a way where false would be acted upon as if it isn't set, or just use a separate template variable for it. Most of us do, and so does the phpBB core, I think.
        Hide
        EXreaction EXreaction [X] (Inactive) added a comment -

        If I could have done that I would have.

        Show
        EXreaction EXreaction [X] (Inactive) added a comment - If I could have done that I would have.
        Hide
        nickvergessen Joas Schilling added a comment -

        Twig allows is defined we should forward that to our syntax

        Show
        nickvergessen Joas Schilling added a comment - Twig allows is defined we should forward that to our syntax
        Hide
        EXreaction EXreaction [X] (Inactive) added a comment -

        Then <!-- IF FOO is defined -->

        {FOO}

        <!-- ENDIF --> should work fine, could just add a test for it

        Show
        EXreaction EXreaction [X] (Inactive) added a comment - Then <!-- IF FOO is defined --> {FOO} <!-- ENDIF --> should work fine, could just add a test for it

          People

          • Assignee:
            nickvergessen Joas Schilling
            Reporter:
            EXreaction EXreaction [X] (Inactive)
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development