How to get folder name of a content item in velocity template? I tried this $user.psoFolders.getParentFolderPath($tools.math.toInteger($contentno)) but not getting results.
Any suggestions?
Paddy
How to get folder name of a content item in velocity template? I tried this $user.psoFolders.getParentFolderPath($tools.math.toInteger($contentno)) but not getting results.
Any suggestions?
Paddy
Paddy,
You could use the following to retrieve the folder name:
#set($folderPath = $user.psoFolders.getParentFolderPath($sys.assemblyItem))##
$folderPath.substring( $tools.math.add($folderPath.lastIndexOf('/'),1),$folderPath.length())
I attempted to use psoFolders.getFolderProperties; however, it doesn’t return the name property.
Riley,
Any reason you aren’t using $rx.location.folderPath($sys.assemblyItem)? Just out of curiosity…
Paddy,
I think that function (getParentFolderPath) takes in a IPSGuid (or IPSAssemblyItem), not an integer… (at least it did in 6.5)
RileyW,
Thank you for the quick turn around. The solution works for the current item, but my scenario is some thing like this…
I have a Page Template P1 for a Content Type A. In P1 i have a bunch of content ids of other Content type B, for which I want to know the Parent Folder name for each content id.
I’m able to get the Parent folder id of a content item by using this function $user.psoFolders.getParentFolderId. But the problem is we are not able to get the name of the folder. Is there any function that can be used to get the foldername by passing a folder id?
Paddy
Jitendra,
Can i use $rx.location.folderPath($sys.assemblyItem) by passing a content item or a folder id?
Jit,
Only continued to use getParentFolderPath to support Paddy’s use of the function.
$rx.location.folderPath would be a better choice based upon the fact it is shipped with Percussion and faster compared to the number of calls performed by getParentFolderPath (http://goo.gl/a6kbb).
[QUOTE=Paddy;20330]RileyW,
Thank you for the quick turn around. The solution works for the current item, but my scenario is some thing like this…
I have a Page Template P1 for a Content Type A. In P1 i have a bunch of content ids of other Content type B, for which I want to know the Parent Folder name for each content id.
I’m able to get the Parent folder id of a content item by using this function $user.psoFolders.getParentFolderId. But the problem is we are not able to get the name of the folder. Is there any function that can be used to get the foldername by passing a folder id?
Paddy[/QUOTE]
How is P1 generating the list of Content type B content item ids? Depending on how you’re generating this list you could discover/set the folder name.
RileyW,
I queried the DB to get all the content ids of type B.
I got the folder name by passing the folder id ($user.psoFolders.getFolderPath(id)). That solved my issue…
Paddy