Good morning,
I'm using the latest AdminLTE version (3.0). For sidebars, it uses the <nav> tags, like this:
<nav class="mt-2">
<ul class="nav nav-pills nav-sidebar flex-column" data-widget="treeview" role="menu" data-accordion="false">
<li class="nav-item">
<a href="/dashboard" class="nav-link{% if active_dashboard is defined %} active{% endif %}">
<i class="nav-icon fas fa-tachometer-alt"></i>
<p>Dashboard</p>
</a>
</li>
As you can see, I'm using the active_dashboard
variable to set the active
tag on the link (to highlight it). Problem is, that I need to use link_to
, since the live server has another baseURI
and I can't just use my absolute paths.
Now I wanted to come up with something like this:
<li class="nav-item">
{{ link_to('dashboard', '<i class="nav-icon fas fa-tachometer-alt"></i><p>Dashboard</p>', 'class': 'nav-link{% if active_dashboard is defined %} active{% endif %}' )}}
</li>
But the if-clause won't get parsed, it just gets printed out.
So, question: How can I get this if-clause to get executed inside the link_to?
Thank you.