Get all Categories in a Category Select


Use this to pull all selected categories in a widget category select. After you use this code to grab them you can make it part your dotcontent.pull query like this:



${esc.hash}foreach(${esc.dollar}inode in ${esc.dollar}categoriesToDisplay)
    ${esc.hash}if(${esc.dollar}velocityCount == 1)
         ${esc.hash}set(${esc.dollar}catlist = ${esc.dollar}categories.getCategoryByInode(${esc.dollar}inode).getCategoryVelocityVarName())
         ${esc.hash}set(${esc.dollar}catlist = "${esc.dollar}catlist ${esc.dollar}categories.getCategoryByInode(${esc.dollar}inode).getCategoryVelocityVarName()")

Have you created code you'd like to share with the dotCMS community?

Share your code Become a Contributor