
Custom Attributes
You can actually define your own custom attributes and access it via the MXAE API. This is good if you would like to pass certain parameters to a block tag such as "list". For example:
<!--[list parent="-1" mode="article" start="0" mycustomattr="my custom value"]-->
<?php echo "mycustomattr = ".$GLOBALS['_mxPub']->getTSL()->getAttr($_mxLevel + 1, 'mycustomattr'); ?>
<!--[/list]-->
You can also pass variables into the custom attributes which will get evaluated at run-time just like the built-in attributes.The other usage where this can be useful is treating the custom attribute(s) as parameter(s) when including a different template. For example:
<!--[template code="header" myattr="hello world"]-->
Then inside template "header", you can access the attributes by calling this function:
<?php echo "myattr = ".$GLOBALS['_mxPub']->getTSL()->getAttr($_mxLevel, 'myattr'); ?>
Note that in accessing the custom attribute within a template, you don't have to offset $_mxLevel with a "+1".You can have define as many custom attributes as desired.
MXAE Release News
MXAE 2.7.5 Released ![]() |
![]() |
Tips & Tricks
How to change SQL Query to MXAPI ![]() |
![]() |