-
Notifications
You must be signed in to change notification settings - Fork 104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Any template tag to show parent menu title as sub menu title #135
Comments
It is a bit hard to understand what you mean but I think this should satisfy your needs: |
Here is the template that you can replicate within your project to fit your needs. Tell me if this template tag didn't fit your needs somehow: https://github.com/batiste/django-page-cms/blob/master/pages/templates/pages/dynamic_tree_menu.html |
Thanks for the notes, I tried all available in the document but not being able to achieve my needs. For example, from below page menus and I am in the
|
If I understand your you have this tree::
And you want to only display:
? |
Yes. For all the pages under Product, the 5ah to show Product. Same as page title which differs for every page but sidemenu title always shows the top most menu title for all the pages under Product page. Hope this clears up the confusion. |
Edited: wrong example Well Django Page CMS uses Django MPTT to represent trees. You can use get_root to get the root page ("the product page"): http://django-mptt.github.io/django-mptt/mptt.models.html#mptt.models.MPTTModel.get_root So I guess things would look a bit like this
Or use pages_navigation which contains all the root pages
|
Hmm, did not think of that before hand, let me give it a try. Your advice makes good sense. Thanks. |
Trying things out as per your advice, here is what I did. I put tags in the head of the template
And put the code like below (perhaps something is missing here, I am afraid)
Then below returned, what am I missing?
Traceback detail shows
|
You don't put parenthesis in the django template language (I know this is weird sometimes). Also you need {{ }} for an expression ({% %} is for template tags) so that will that:
Or better yet, using the show_content template tag (this one handle translation depending of the user language):
|
Many thanks. Yes, they worked well - just a little typo got me stranded for a minute though. This worked well Below first showed none So I had a look around existing templatetags, and found out a typo - missed string " ". And below worked well. |
In the side bar to show sub menu title, is there such template tag? Ex, Product > Software > Mobile and I am in Mobile page, then sub menu title is the root of selected menu which n this case is Product.
The text was updated successfully, but these errors were encountered: