Q
Q
qwex2016-03-21 21:47:15
go
qwex, 2016-03-21 21:47:15

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>

You need to determine which page the user is on and assign the menu class "active".
Thanks in advance :3

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question