Get category name

Discussion about MagicEdit features, modules, applications, and HowTos.

Get category name

Postby kosborn » Mon Feb 25, 2013 9:58 am

OK, I thought I could figure it out, but it appears I can't. How do I get the category name thru Magic Edit to show the category name that is used in the nav, as the me_name="CateogrryPage-PageName" on each of the category.html pages?

http://iconsafe.free.magicedit.com/mult ... n-detector

I'd like to show the same category name where this page says "MULTIGAS W/ PID - PHOTOIONIZATION DETECTOR" automatically.

Thanks!
kosborn
 
Posts: 77
Joined: Wed Sep 14, 2011 2:02 pm

Re: Get category name

Postby raw10 » Mon Feb 25, 2013 12:14 pm

In your menu.html file you have the basic outline for your categories. It looks like you have three category sections as repeats, namely CategoryGroup, CategoryGroup2, and CategoryGroup3. Inside each of these you also have additional repeats for subcategories, named similarly.

The trick is to name the MagicEdit regions for the titles the same as in the menu. First, on category.html page you need to name the header the same as in the menu. In includes/menu.html you have:

Code: Select all
<magicedit me_name="CategoryHeading" me_plain>Category Head</magicedit>


And in category.html you have:

Code: Select all
<magicedit me_name="CategoryPage-PageName" me_plain>Category Name</magicedit>


Since they are named differently, there is no way they can be linked. What I would do is the following. In includes/menu.html do this:

Code: Select all
<magicedit me_name="CategoryHeading" me_hidebuttons>Category Head</magicedit>


And in category.html do this:

Code: Select all
<magicedit me_name="CategoryHeading" me_plain>Category Head</magicedit>


Now you won't have edit buttons cluttering up the menu, and they will update if edited from the category page. Another note here. You don't need to have different me_names in each MagicRepeat region. As long as they are contained within a different MagicRepeat region they will be unique to that region (in other words, each MagicRepeat has its own namespace). So in your menu.html file just use me_name="CategoryHeading" in each of the three instances.

I see that you're using the same category.html file for the subcategory headings as well. This is great! A nice way to reuse the same file as a template for each category level. Again, since you are placing this inside a MagicRepeat, it gets its own namespace. You should still use me_name="CategoryHeading" in this case as well, and the subheadings will just work.

The downside here is that you already have titles entered in. You will need to re-enter the titles, but from then on they should be linked.

Basically, every place you have a heading, whether in the menu or on the category.html page, just use the same me_name for the title. MagicRepeat makes sure that the titles are different for each instance of the repeat.
raw10
 
Posts: 81
Joined: Tue Apr 12, 2011 2:46 pm


Return to MagicEdit Discusson

Who is online

Users browsing this forum: No registered users and 1 guest

cron