Build path dynamically
I'm trying to build an image path dynamically. I'm using the
following code in my velocity format:
<img src="[system-asset]_common/images/providers/${docsFirstName}-${docsLastName}.png[/system-asset]" />
And I get this error when I test the format:
An error occurred: Could not transform with Script format
"_internal/formats/provider-listing": Error on line 25: The value
of attribute "src" associated with an element type "img" must not
contain the '<' character.
You may choose to retry the operation. If the problem persists,
please contact a system administrator.
The error has been logged to the system console.
If I take out the dynamic variables, but use the same code, I
don't get the error.
<img src="[system-asset]_common/images/providers/brent-bartgis.png[/system-asset]" />
I'm not sure if it is because I don't have images with all of the
names uploaded into Cascade, or if it is something in the way I'm
trying to do it.
I've defined the variables I'm using and they are outputting correctly using the EscapeTool.
Thanks!
Discussions are closed to public comments.
If you need help with Cascade CMS please
start a new discussion.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
1 Posted by Ryan Griffith on 18 Jul, 2014 03:02 PM
Hi Lauren,
It sounds like there may be an issue with one, or both, of your variables. When you have a moment, please attach or paste your Format so I can take a closer look.
Thanks!
2 Posted by lauren.fraser on 18 Jul, 2014 04:05 PM
Here is the format. And the xml
3 Posted by Ryan Griffith on 18 Jul, 2014 05:39 PM
Thank you for attaching the Format and XML, Lauren.
Looking over the Format, I am seeing that you are setting these variables as follows:
This is setting the variables to an XML Element and not a value, so when you attempt to output them within the
<img>
tag, it's actually going to output something like the following:So, instead of:
Try the following:
Please let me know if you have any questions.
Thanks!
4 Posted by lauren.fraser on 28 Jul, 2014 06:20 PM
Ryan, that worked perfectly. Thanks!
lauren.fraser closed this discussion on 28 Jul, 2014 06:20 PM.