Welcome Guest, Not a member yet? Register   Sign In
Setting active class and selecting specific row from DB
#1

[eluser]Unknown[/eluser]
Hello,
I'm new to CodeIgniter and I'm currently trying to build the first website with it.

I'm pulling my navi and content from a DB.

First, the navi (model):
Code:
function getNavi()
    {
        $query = $this->db->get('content');
        
        if ($query->num_rows() == 0)
        {
            echo "Datenbank leer...";    
        } else {
            return $query->result();
        }
    }
And the view:
Code:
<?php foreach($navi as $kategorien): ?>
            <li>&lt;?php echo $kategorien->name; ?&gt;</li>
    &lt;?php endforeach; ?&gt;
This displays all the navi-buttons I have. What I'd like to do is to set a "class="active""for whatever site currently is active.

Also, I'm trying to select only the content-row of the currently active site. I tried with an ?id=1 URI-parameter and then setting $_GET['id'], but this won't work. Any other suggestions?

Also, I searched the forums and Google and didn't happen to find a solution to my 2 little problems.


Messages In This Thread
Setting active class and selecting specific row from DB - by El Forum - 02-06-2010, 05:06 AM
Setting active class and selecting specific row from DB - by El Forum - 02-06-2010, 06:24 AM
Setting active class and selecting specific row from DB - by El Forum - 02-06-2010, 06:27 AM
Setting active class and selecting specific row from DB - by El Forum - 02-06-2010, 06:34 AM



Theme © iAndrew 2016 - Forum software by © MyBB