Database publishing query - System Variables - Location URL

Hi all, I’m currently setting up a database publishing template for a new content item I’m developing. I’ve run in to an issue however with the bindings…

The content item being published out to the database can have a file uploaded to it from within it’s content editor. The content item’s content is published to the database, and the file is published to the server.

There is a field in the database which needs to store the location (url) of the file being published to the server.

I’ve set up a publishing location scheme for the file, which determines the location it is published to, using the following expression:

$sys.site.url + $sys.pub_path +
$sys.item.getProperty(“rx:sys_contentid”).String + $sys.item.getProperty(“rx:loc_files_ext”).String

I’d hoped when I set up the bindings in the database publishing templates I could make use of the system variables “$sys.site.url” and “$sys.pub_path” to construct the location of the file upload. However when I bound these variables to the file location field in the database, and ran the publishing edition this information wasn’t published to the database.

Is there anyway I can set up a binding in the database publishing template which get’s the site’s URL and publication path?

Thanks for reading!

Hi George

Just use the location scheme you’ve already setup.

$url = $rx.location.generate($sys.assemblyItem, 'ntuYourBinaryTemplatename')

Cheers
James

Hey Jimbo, thanks for the reply, I’ve tried this and it’s getting there however for some reason it’s publishing “unknownpath/12345.jpg” instead of the URL of the image. The location scheme works when I preview the templates which use it and change the context to 1 (publish) and builds the correct URL.

Have you added the scheme to your database publishing context?

Hi Keevan, the issue I was having with unknown path was being caused by the Destination site in my publishing edition, not having some information (Global template and Folder Root). I’ve put this information in now and this is working all OK.