Little trouble with conditionals

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • etones
    Senior Member
    • Sep 2000
    • 666

    Little trouble with conditionals

    Hi, im trying todo the following code:

    $post[$vboptions[ewfield]]

    as opposed to

    $post[field7]

    However it gets rejected:

    The following error occurred when attempting to evaluate this template:

    Parse error: parse error, expecting `']'' in /usr/local/apache/htdocs/forums2/includes/adminfunctions_template.php(3014) : eval()'d code on line 78

    This is likely caused by a malformed conditional statement. It is highly recommended that you fix this error before continuing, but you may continue as-is if you wish.
    I dont want to have to edit the php files

    Taz

    http://www.e-tones.co.uk - The best site on the net for mobile phones.
  • Zachery
    Former vBulletin Support
    • Jul 2002
    • 59097

    #2
    $post[$vboptions[ewfield]]

    wont ever work

    why cant you just use

    $post[fieldX] ?

    Comment

    • etones
      Senior Member
      • Sep 2000
      • 666

      #3
      Originally posted by Faranth
      $post[$vboptions[ewfield]]

      wont ever work

      why cant you just use

      $post[fieldX] ?
      fieldX may change in the future, instead of changing 100 templates, id rather change 1 option in the control panel.

      Why wont nested array calls ever work?

      Taz
      http://www.e-tones.co.uk - The best site on the net for mobile phones.

      Comment

      • Zachery
        Former vBulletin Support
        • Jul 2002
        • 59097

        #4
        ive never seen them done(not a php guy, didnt think it was possible to be hoenst), i doubt $post[fieldx] will ever change unless you change it, and why 100 templates? youd only need to edit the postbit template as thats the only place $post[fieldx] works.

        Comment

        • etones
          Senior Member
          • Sep 2000
          • 666

          #5
          Originally posted by Faranth
          ive never seen them done(not a php guy, didnt think it was possible to be hoenst), i doubt $post[fieldx] will ever change unless you change it, and why 100 templates? youd only need to edit the postbit template as thats the only place $post[fieldx] works.
          Nested array calls are used alot in any language. They are as fundamental (sp) as an if statement, however if they dont work in the conditional system theres nothing that can be done.

          As for not just editting the postbit templates, i like to keep my code as centralised as possible, if I can make it so that 1 change will reflect everywhere then I will make it so, simply a good programming ethos.

          Taz
          http://www.e-tones.co.uk - The best site on the net for mobile phones.

          Comment

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