Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.