Pub Path in Velocity template

In my velocity templates(Page / Snippet), I need to replace the a path “//qa.xyx.com” to “//xyx.com” based on the Publish Path value in the site definition. Can we call Publish path value in velocity template?

Paddy

Paddy,

Initially I would have tried to use $sys.pub_path but this doesn’t seem to be populated at this point in assembly.

Another option would be to set a Context Variable in the Site Definition, and retrieve using $sys.variables.variableName.

The last and unrecommended method would be to query the database for the value.

#set($siteID = $rx.asmhelper.getSingleParamValue($sys.params,"sys_siteid"))##
$rx.db.get("RhythmyxData","SELECT root FROM RXSITES WHERE SITEID = '$siteID'")

RileyW,
Actually, $sys.site.path works in velocity templates. This way fixes my issue.

Paddy

Awesome,

I was using the assembler debug mode to see the available variables/bindings.

I had a similar question and stumbled upon this thread.

I could not get $sys.site.path to give me a value.

Why is calling the database to get this value not recommended.

#set ($siteID = $rx.asmhelper.getSingleParamValue($sys.params,“sys_siteid”))##
#set ($results = $rx.db.get(“RhythmyxData”,“SELECT root FROM RXSITES WHERE SITEID = ‘$siteID’”))
#foreach ($row in $results)
#set ($sitePubPath = $row.ROOT)
#end