Answer the question
In order to leave comments, you need to log in
How to determine which page the user is on in beego?
Hello.
The task is to determine which page the user is on and, in accordance with this, emphasize the menu item.
There are index.tpl and index2.tpl, header and footer are placed in separate files (header.tpl, footer.tpl).
I connected it to the index like this: {{template "header.tpl"}}
{{template "footer.tpl"}}
Since there will be a lot of pages, changing the menu class in each page is cumbersome.
Menu example:
<ul>
<li><a class="active" href="/">1</a></li>
<li><a href="#">2</a></li>
<li><a href="#">3</a></li>
<li><a href="#">4</a></li>
</ul>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question