As some may know macro parameters cannot be named the same as some standard ASP.NET parameters. You can eg. not call a macro parameter "cssClass", as it will not work. My problem is that this is what I want to call it and I may have an ok solution.
How about calling it "_cssClass"? To hold a certain consistancy I suggest we allways insert the underscore at the beginning of parameter names. This would also make sure that MS won't make up new parameters possibly rendering one of our parameters of the same name useless.
I'm not fond of that - parameters end up as elements in the document sent to the XSLT file. XML elements that start with an underscore are not my cup of tea (though it seems like it's valid):
<macro>
<_cssClass>selected</_cssClass>
<!-- etc. -->
</macro>
I tend to use a prefix that makes sense for the current context/project, e.g. "vimeoVideoLink", "navSelectedClass" etc.
Yes i sertainly see your point. My problem is that a css class is a class no matter what the use. It would be nice for me to have a standard so when I wantet the css class from anyone of my macros their names would allways be the same, no matter the context.
Now, I could just call them umbracoCssClass, but I think that name is too long.
Macro naming best practice
Hi,
As some may know macro parameters cannot be named the same as some standard ASP.NET parameters. You can eg. not call a macro parameter "cssClass", as it will not work. My problem is that this is what I want to call it and I may have an ok solution.
How about calling it "_cssClass"? To hold a certain consistancy I suggest we allways insert the underscore at the beginning of parameter names. This would also make sure that MS won't make up new parameters possibly rendering one of our parameters of the same name useless.
Any ideas/comments on this?
/Rune
Hi Rune,
I'm not fond of that - parameters end up as elements in the document sent to the XSLT file. XML elements that start with an underscore are not my cup of tea (though it seems like it's valid):
I tend to use a prefix that makes sense for the current context/project, e.g. "vimeoVideoLink", "navSelectedClass" etc.
/Chriztian
Hi Chriztian,
Yes i sertainly see your point. My problem is that a css class is a class no matter what the use. It would be nice for me to have a standard so when I wantet the css class from anyone of my macros their names would allways be the same, no matter the context.
Now, I could just call them umbracoCssClass, but I think that name is too long.
/Rune
is working on a reply...