• Archived  

By seGAP - May 18, 2007

Hi,

This may be common knowledge, but since we haven't found an example in the Forum, we thought we'd share what we stumbled across in playing with a chained version of the getFieldValueByNum modifier.

This example retrieves the Parent Category's Name, but it could be used to get any standard or custom field on the Parent Category.

$categoryNum:getFieldValueByNum(category,parentNum):getFieldValueByNum(category,name,Not Found)$

Where a Parent exists, the 1st modifier gets the Parent's Number, and the 2nd gets its Name.

Where there is no Parent, the 1st modifier sets Zero, and the 2nd drops through to its "else" condition to give "Not Found".

I guess you could add a copy of the 1st modifier before the 2nd modifer to navigate to the GrandParent Category, etc.

We were just playing when we found this, but we think we can usefully apply it in at least one of our templates... so now is a good time to ask for comments on whether this is a sensible/valid/efficient use of Modifiers.

Any thoughts?

Thanks
seGAP

Re: [seGAP] Using Placeholder Modifers to Parent Category information

  • Archived  

By deniseb - May 19, 2007

Hi seGAP,

Thanks for the post!

This is something that I'm sure many members of the community will find useful. This does sound like a good way to use the modifiers and I'm glad to see that your getting a handle on how the modifiers work. :)

Re: [ChetW] Using Placeholder Modifers to Parent Category information

  • Archived  

By wimberb - May 19, 2007

Could this be used to test whether or not the parent of a category is the current selected category? If so, how would I do this?

Re: [wimberb] Using Placeholder Modifers to Parent Category information

  • Archived  

By deniseb - May 20, 2007

Hi wimberb,

Thanks for the post!

At the moment I'm not sure if you could set things up this way or how you would set this up if it does work. What I'll do is take a closer look at this to see what's possible, once I have a better idea of what can be done I'll post a follow-up reply. :)

Re: [wimberb] Using Placeholder Modifers to Parent Category information

  • Archived  

By seGAP - May 20, 2007

wimberb,

What about trying some kind of variation on...

<!-- templateIf: {placeholder for selected category number} eq {placeholder for selected category number}:getFieldValueByNum(category,parentNum)$ -->
{conditional code goes here}
<!-- /templateIf -->

seGAP