$sys.pub.path not defined in page template

What’s the right way to produce the text “http://myschool.edu/itunes/images/featuredContent/FCimagine.jpg” in the List slot of my page template? (Since I’m not having the same question that prompted my previous thread, I thought I should start a new thread.)

This line works in my snippet template:

'$rxs_navbase/images/featuredContent/$sys.item.getProperty('sys_title').String$sys.item.getProperty('sys_suffix').String' 

This line produces “http://myschool.edu/itunes$sys.pub.pathFCimagine.jpg”:

'$rxs_navbase$sys.pub.path$sys.item.getProperty('sys_title').String$sys.item.getProperty('sys_suffix').String'

which means that the variable is undefined.

I know, $sys.pub.path is only designed for location schemes, but how do I do the same thing using JSR-170 in a template? When I define “$sys.pub.path” as “$sys.variables.sys.pub_path” or “$sys.variables.sys.path” or “sys.params.sys.pub_path” or “$sys.params.sys.path” in the binding of either/both the snippet and/or the page template, the variable still previews as undefined. Now, $sys.folder.path is defined, but that doesn’t help much in a URL.

If you are trying to build a link to the current content item, the recommended approach is to use $rx.location.generate().

This value will give you a “preview” URL in the preview context and the actual file path in the publish context.

Dave

Yes, $rx.location.generate($sys.assemblyItem) gives me a URL in the page template, but I’m trying to generate it in the List snippet template, to create a list of image links. When I use it in the snippet template, I get:

Problem assembling output for item: 1-101-1072 with template: SnRotate exception: Could not locate the default template for content at path /1072#1 with content type 348 because no default template could be found for site id = 0-9-405 see log for stack trace

This error repeats three times, with 1072#1, 1073#1, and 1074#1, since the List slot has three items. I pasted my SnRotate code in the previous thread.

I believe you may need to duplicate the assembly item and then build the link based off of that…eg…within the loop for the list slot (so initialize the slot yourself). Of course there may be an easier solution that i’m missing here (or i may be off on the wrong tangent)…


#set($thisN = $sys.assemblyItem.clone())
$thisN.setNode($someListSlotItem)
#set($pagelink=$rx.location.generate($thisN))

Thanks so much. I’m not quite sure how to implement this and I’m still learning to how to read Javadocs. I apologize if I’m asking questions that have already been answered. I might (might) find more of my own answers, for example about how to use $rx.location.generate if vBulletin didn’t give messages such as:

The following words are either very common, too long, or too short and were not included in your search : $rx.location.generate