One text attribute works, and the other does not. Included code. Can't figure it out. :-(
Permalink
I am using a simple code to check for a text page attribute from inside the autonav block view, and then output it.
Here is the code:
I created text attribute with handle 'boom_customclass' and name 'BOOM! Custom Class', and add it to a page that is in my nav tree.
I attempt to output the variable by using something like
I can't get anything to output this way.
If I change the code to check for another attribute that was installed by a third party block, it works fine. For instance instead of 'boom_customclass' I can put in 'megamenu_accesskey' which is also a text attribute, add it to a page same as before, and my code will output fine, just as intended.
Is there something I am missing with regard to custom attributes?
Many thanks.
PS: $_c is in the main autonav loop. It is the current iteration's collection object.
Here is the code:
$getCustomClass = $_c->getCollectionAttributeValue('boom_customclass'); if ($getCustomClass) { $customClass = ' class="' . $getCustomClass . '" '; } else { $customClass = ''; }
I created text attribute with handle 'boom_customclass' and name 'BOOM! Custom Class', and add it to a page that is in my nav tree.
I attempt to output the variable by using something like
echo ('<li' . $customClass . '>');
I can't get anything to output this way.
If I change the code to check for another attribute that was installed by a third party block, it works fine. For instance instead of 'boom_customclass' I can put in 'megamenu_accesskey' which is also a text attribute, add it to a page same as before, and my code will output fine, just as intended.
Is there something I am missing with regard to custom attributes?
Many thanks.
PS: $_c is in the main autonav loop. It is the current iteration's collection object.