Welcome Guest, Not a member yet? Register   Sign In
Set Posts activ/inactiv
#9

[eluser]TWP Marketing[/eluser]
Zimoon,
Now you have two errors which do not work as you want them to do.

First, in your controller, pass the $active flag to the model function.
Code:
function index()
    {
    
      $data = array(
      'title'           => 'Aktuell'.$this->config->item('pageTitle'),
      'metaDescription' => 'Aktuell',
      'metaKeywords'    => 'Aktuell, '.$this->config->item('pageMetaKeywords'),
      'mainnav'         => 'aktuell',
      'subnav'          => '',
      'subsubnav'       => '',
      'hasSubnav'       => true
    );
    
    
    $active = TRUE; //<--- assign the value of $active
    $data['posts'] = $this->posts_model->getactivePosts($active); //<--- PASS THE $active FLAG
      $this->load->view('v-aktuell', $data);
    }

Second, in your model file:

[quote author="Zimooon" date="1303224924"]ok got the error..

if($active == TRUE) //<--- THIS IS CORRECT, you are doing a comparison

->

if($active = TRUE) . now it works <3 //<--- THIS IS NOT CORRECT, it must not be an assignment
thx for help

best regards[/quote]

Your if clause must use "==" to make a comparison. If you use "=", you are doing an assignment to the variable and the if() will ALWAYS execute the code inside the if statement.


Messages In This Thread
Set Posts activ/inactiv - by El Forum - 04-15-2011, 01:52 AM
Set Posts activ/inactiv - by El Forum - 04-15-2011, 04:31 AM
Set Posts activ/inactiv - by El Forum - 04-15-2011, 08:34 AM
Set Posts activ/inactiv - by El Forum - 04-15-2011, 12:06 PM
Set Posts activ/inactiv - by El Forum - 04-18-2011, 09:43 AM
Set Posts activ/inactiv - by El Forum - 04-18-2011, 10:48 AM
Set Posts activ/inactiv - by El Forum - 04-19-2011, 01:11 AM
Set Posts activ/inactiv - by El Forum - 04-19-2011, 03:55 AM
Set Posts activ/inactiv - by El Forum - 04-19-2011, 01:18 PM



Theme © iAndrew 2016 - Forum software by © MyBB