Jump to content

Archived

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

scottybwoy

Need to get rid of this IF

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

Share this post


Link to post
Share on other sites
I may be a little confused, by if you don't want that status to change, why not just comment out that first if/else block?

Share this post


Link to post
Share on other sites

×

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.