The logic is quite simple: the SQL query returns rows of desired contentid/revision which feed into macro #assemble(), which then calls snippet template intraSnAbstractTD to generate the right HTML code. The page content item resides under /admin/. when I preview the page which displays a list of abstracts (title/image/text/…), links on the abstracts render fine. However, after I published the content item, the target page displays all abstract links as /admin/index.htm. Clearly there is something NOT right with $rx.location.generate($sys.assemblyItem)
I hope you’ve solved this on your own but in case not… I’ve used Sam’s code successfully (THANKS, Sam!) and I’m not sure why you’re having problems. I assume you’ve modified his #assemble macro since you pass an additional parameter. I am guessing you use $asmAbstract to hold the ‘intraSnAbstractTD’ output for additional processing before displaying. However, you don’t indicate what you do to $asmAbstract. If you’re not adding anything to the snippet template output, why not save a line, use Sam’s original signature, and wrap the macro call in the table-row tagset?
#foreach( $abstract in $abstracts)
<tr>#assemble($abstract.get('ABSID') $abstract.get('ABSREV') 'intraSnAbstractTD' '')</tr>
#end
As to the publish link being different from the preview, that sounds more like a location scheme issue with Context > Site_Folder_Assembly. When you preview an item (where links are working) change the browser URL parameter ‘sys_context’ from 0 (preview context) to 1 (publish context) and view the page source to see what the assembled links look like and maybe that will give you more troubleshooting info. HTH
I used Sam’s macro in other places and it works perfect. The scenario here is a little bit different. I copied the final response from Percussion Tech Support here. Eventually I have to pass in the folder path in the assemble() as a parameter like
This causes links NOT work in Preview but work when published
Hello Hua,
This is a summary of our meeting this afternoon: we concluded that you need to extract the folder path of the abstract when you retrieve them for assembly, and bind it to a variable to use in the href value of the link. Given that there are no parent folder passed in this assembly context, $rx.location.generate method will assemble the links in relation to the parent page. Thus, sys.pub_path will resolve to the parent page path.
I am now closing this case per our discussion.