Announcement

Collapse
No announcement yet.

Conditionals - Where are they parsed?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Conditionals - Where are they parsed?

    I've tried asking this on vB.org but haven't had a response. Apologies if this is in the wrong place.

    I've been trying to work this out for months: Where exactly are the conditionals in vBulletin templates changed to and parsed as PHP code to produce output for whether the conditional is true or not?

    For example, say I had the conditional
    PHP Code:
    <if condition="$foo">some text</if> 
    in the calendar weekly template, (and $foo is set to 1 in a plugin elsewhere) where is the
    PHP Code:
    <if condition="$foo"
    parsed so that the "some text" appears on the page? I can't seem to just do it with eval(), there must be a function somewhere doing it.

    Many thanks in advance

  • #2
    As far as I know the conditionals are parsed when the template is saved in the Style Manager.
    Best Regards
    Colin Frei

    Please don't contact me per PM.

    Comment


    • #3
      Hi Colin, thanks for your quick reply.

      I've had a look and it would appear that the saved templates in the database still have in tact
      PHP Code:
      <if condition="$foo"
      syntax stored with them.

      I'll have another look myself anyway.

      Many thanks
      Last edited by mhuxtable; Wed 24th May '06, 11:23am.

      Comment


      • #4
        Originally posted by mhuxtable
        I've had a look and it would appear that the saved templates in the database still have in tact
        PHP Code:
        <if condition="$foo"
        syntax stored with them.

        I'll have another look myself anyway.

        Many thanks
        Still having trouble pinpointing this down. I'm probably not looking hard enough but if anyone knows I would be very grateful.

        Comment


        • #5
          Originally posted by Colin F
          As far as I know the conditionals are parsed when the template is saved in the Style Manager.
          Nahh that wouldn't be possible, would ruin the whole point in the conditionals since they would't run at time of execution.

          I haven't been able to find where this is either, and actually came here to ask this (I've asked before in another thread but no reply).

          http://filesharingtalk.com

          Comment


          • #6
            Originally posted by rossco_2005
            Nahh that wouldn't be possible, would ruin the whole point in the conditionals since they would't run at time of execution.

            I haven't been able to find where this is either, and actually came here to ask this (I've asked before in another thread but no reply).
            Thanks for your reply. It's probably something simple the way that they are parsed but I can't find it, and although I'm a "pretty good" PHP coder I'm not brilliant.

            I've also tried asking over at vbulletin.org but no response there either. It seems it's a hidden secret! If anyone knows we would be grateful if it could be revealed!

            Many thanks

            Comment


            • #7
              Actually, I was under the impression that the templates were stored in a precompiled format, where conditionals were replaced with PHP, and this PHP was then evaluated during runtime.
              If you look in the template table of the database you'll also see two fields, a template and a template_un.
              The template field has PHP code in it, the template_un shows the code as we know it.
              Best Regards
              Colin Frei

              Please don't contact me per PM.

              Comment


              • #8
                Originally posted by Colin F
                Actually, I was under the impression that the templates were stored in a precompiled format, where conditionals were replaced with PHP, and this PHP was then evaluated during runtime.
                If you look in the template table of the database you'll also see two fields, a template and a template_un.
                The template field has PHP code in it, the template_un shows the code as we know it.
                Hi Colin,

                Thank you ever so much for your response. I've had a look now and everything makes sense.

                If there was a "thanks" button or the reputation was switched on I'd click the button!

                Thanks again. It is much appreciated.

                Comment


                • #9
                  Just thought I would mention that I have been studying the code for this for the past few days and have had trouble understanding parts of it, but I'm sure I will get back to normal over time and everything will make sense to me.

                  Many thanks

                  Comment

                  widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                  Working...
                  X