Jump to content

Need to get rid of this IF


scottybwoy

Recommended Posts

I have this function :
[code]
<?php
if (! empty($pref['autotip']) && $pref['autotip']==1) {
              $template->set_var('TIP_STATUS1', 'checked');
          } else {
            $template->set_var('TIP_STATUS1', '');
          }

          if (! empty($pref['autotip']) && $pref['autotip']==0) {
              $template->set_var('TIP_STATUS2', 'checked');
          } else {
              $template->set_var('TIP_STATUS2', '');
          }

          $template->set_var('PREF_MNGR', $PREF_MNGR);

          if (isset($this->update) && $this->update)
          {
            $template->set_var('UPDATE_MSG',
                                $this->getMessage('PREFERENCES_UPDATED')
                              );
          }
          else $template->set_var('UPDATE_MSG', '');

          $themeTemplate->set_var('CONTENT_BLOCK',
                                  $template->parse('mblock', 'mainBlock'));

          $template->parse('contentBlock', 'fh1');

          $themeTemplate->parse('cnblock', 'contentBlock');
          $themeTemplate->parse('mmblock', 'mmainBlock');
          $themeTemplate->pparse('output', 'fh');

      }
?>
[/code]
And I want 'autotip' to always == 1 for 'TIP_STATUS1' i.e $template->set_var('TIP_STATUS1', 'checked');
So it will not have to get info from the form.

And I always want it to be like that so it never really needs to be updated.  And if it never really needs to be updated it won't need to be stored in the database.

So could someone help me re-write this please.  Many Thanks
Link to comment
https://forums.phpfreaks.com/topic/19376-need-to-get-rid-of-this-if/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.