php - magento getpath() extract value -


i request information of how extract particular value in getpath() function.

currently placed following information:

<?php $currentcat = mage::registry('current_category'); ?> <?php echo $currentcat->getpath()?> 

and system echo 1/2/5 , 1 root of root, 2 catalog root , 5 first simple category.

i extract third value (number 5 in example) in serie of categories echo info in page tried different appraches no success.

thank you.

explode(), end()

<?php echo end(explode("/", $currentcat->getpath())); ?> 

do know if can place value retrieve 3 level no matter if im placed in subcategory

should looks this:

<?php     $exp = explode("/", $currentcat->getpath());    echo $exp[2]; ?> 

i recommend take @ explode() again :)


Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -