This applied to any MVC based application, not just CI.
Since you're changing the way the view is displayed to the user, there is nothing wrong with putting a condition within your view. However, the logic to this should be carried out within your controller. For example, your controller could look something like:
class x
{
public function index()
{
if($session->get('logged_in') === true){
// send a variable to the view
}
}
}
then within your view,
Hey User! logout
login here
Obviously this will get tiresome to do within each controllers method, so check out this question which will allow you to avoid having duplicate code.