Hi at all,
I'm new to movable type and I'm still trying to understand the way it works.
This is my problem:
I have two main categories. "EN" and "DE" which stands for english and german content. Both have the same subcategory-structure.
Within these main categories are 2 layers of subcategories.
I'll try to illustrate:
EN
-->SubCatA
-->SubSubCatA1
-->SubSubCatA2
-->SubSubCatA3
-->SubCatB
-->SubSubCatB1
-->SUbSubCatB2
-->SubSubCatB3
-->SubCatC
...and so on... (same for the DE-Category)
Now if a user enters a SubCat, I want to show him a submenu of all children belonging to this SubCat (SubSubCat A1,A2 and A3).
This, I think, I solved:
<ul>
<MTSubCategories>
<li><a href="<$MTArchiveLink$>"><$MTArchiveTitle$></a></li>
</MTSubCategories>
</ul>
So far so good. But if the user enters one of thes SubSubCats I still want to show him the exact same submenu. So I have to generate a submenu, that contains all sibling-categories of the SubSubCat the user is into.
So how do I have to do this?
I tried to loop through all categories and display just the subSubCats of the Subcat I'm in, but I didn't find something like
<mt:if tag="categoryLabel" like="the-current-Subcat-I'm-in"> //show all SubSubCats </mt:if>
I have to do this dynamically, so I somehow need a variable that contains the current Subcategory the user is in.
Could anybody help me please?
Thank you in advance!
greets Michael.
Reported on Movable Type 5

Hi Michael,
For the subsubcategory you would have to set a variable with its parent category, which in this case would be a subcategory.
Then, you would list all the entries inside that subcategory, eventually marking the current one in context, either assigning it a class or making it bold.
Kind Regards,
Mihai Bocsaru
----------------------------------
Daily Movable Type Consultant
Web Development
Movable Type Consulting
Six Apart Partner
http://www.pro-it-service.com/
----------------------------------
Movable Type Demo
http://www.movabletypedemo.org/
----------------------------------
Open Melody Demo
http://www.openmelodydemo.org/
Hi Mihai,
thank you for your fast reply!
Could you please give me a example on how to get the name of the parent category? I'm still a little bit lost in the MT-Tag language.
All I find is how to loop through all categories and list them up. I don't know how to say "get Parent Category of the current Category"
Assuming that i have that parent category variable, I would do the following:
is that the right way to do? (regardless of marking the current subcategory)
Thank you very much!
greets,
Michael
Hi Michael,
You are welcome!
Here are some hints from the documentation:
http://www.movabletype.org/documentation/appendices/tags/setvarblock.html
http://www.movabletype.org/documentation/appendices/tags/hasparentcategory.html
http://www.movabletype.org/documentation/appendices/tags/parentcategory.html
You could get the parent category of the current category in context using:
<mt:ParentCategory><mt:CategoryLabel></mt:ParentCategory>
Setting it as a variable could be done using:
<mt:HasParentCategory><mt:SetVarBlock name="parent_category"><mt:ParentCategory><mt:CategoryLabel></mt:ParentCategory></mt:SetVarBlock></mt:HasParentCategory>
(the above could work also without the mt:HasParentCategory)
Invoking the parent category works like this:
<mt:Categories category="$parent_category">
Of course, you would have to play a bit with this coding until you get what you wanted.
Kind Regards,
Mihai Bocsaru
Thank you very much, again!
When I try your code I get 2 error messages.
1. MTHasParentCategory has to be within a category-context
if I wrap the <mt:HasParentCategory> with <mt:Categories>
the lines:
produce the other error:
2. Can't call method "entry_based" on an undefined value
what does that mean?
Maybe it's important to know, that this submenu is placed within a widget, that is included in the footer-widget, which is placed within the Entry-list archive template (don't know the exact english translation for this)
I hope I don't bother you to much! Thank you again for your help!
greets,
Michael
Of course that you have to include that coding inside a category context...
Is that widget called only fron the "Entry Listing" archive template? Also, since you are getting the 1st error, I guess that you are not publishing only categories, but also monthly archives, if not also author archives and also category monthly archives...
A link to your site would also help!
I'm still having the problem, with this "category context"
I moved the listing inside the "beta-column" (div id="beta-inner"). By the way, I'm using the "Professionelles Blog 1.0", if it's important.
here is my code:
i can wrap around <mt:categories>...</mt:categories> around the first block, but then MT goes trough all categories. I want to do this:
<mt:Go-ONLY-into-the-current-category> <mt:HasParentCategory> <mt:SetVarBlock name="parent_category"> <mt:ParentCategory> <mt:CategoryLabel> </mt:ParentCategory> </mt:SetVarBlock> </mt:HasParentCategory> </mt:Go-ONLY-into-the-current-category>Which "category context" can I put around the <mt:HasParentCategory> that MT just graps the current SubSubCategory the user is in an checks if it has a parent category? Isn't there any variable, that contains the current category?
here is the link Nevermind the design, it's not mine ;-)
Thanks again!
Looks like my last post didn't show up in the thread... don't know why...
I'll repeat the post.Here we go:
I moved the code from the widget directly into the Entry listing archive template but I still have the problem with the "category context".
here ist my code:
what tag can I wrap around the MTHasParentCategories, that its still within a category context and only checks the current category the user is in? Isn't there any variable, that stores the current category the user is in?
for Example, If i hard code
everything works fine, but I need this dynamically.
Thank you again! I'm somehow getting desperate... :-(
Sorry for the double post.
here is the link
nevermind the design...it's not from me ;-)
greets,
Michael
here is the link, sorry for double post
http://www2.fremde-werden-freunde.de/
greets,
Michael