4
Hello, I am wearing Codeigniter to develop my website, I am trying to verify which controller the user is browsing, for example, I have the login and registration area, if the user is browsing the login page I want to show the registration button, And if he’s browsing the registration page, I want you to show him the login button.
I’m trying to do this on navbar
to not have to create two different files just to create a simple button. Well this would be a normal way to do:
<?php
if ($_GET['url'] === 'login') {
echo '<li>
<p class="navbar-btn">
<a href="#" class="btn btn-info">
Cadastro
</a>
</p>
</li>';
}
if ($_GET['url'] === 'cadastro') {
echo '<li>
<p class="navbar-btn">
<a href="#" class="btn btn-info">
Login
</a>
</p>
</li>';
}
And in the Codeigniter how can I proceed to do this?
What version of Codeigniter?
– Guilherme Nascimento
I am using version 2.1.2, I was following a tutorial on youtube, I am beginner so I downloaded the same version of the tutorial.
– Guilherme SpinXO
I’ll try to post an answer, but it’s CI3, but it shouldn’t change much
– Guilherme Nascimento
Okay, anything I switch to CI3.
– Guilherme SpinXO
From what I’ve looked at it looks like it’s the same on CI2 ;) can test.
– Guilherme Nascimento