Expand my Community achievements bar.

SOLVED

Passing a parameter to a component

Avatar

Former Community Member

I've created a custom template which uses a custom component to insert an image into a dps article.

I want to use this component through a workflow which renders an article for each image in the DAM. I want to make the "img source=" a variable where I can pass the name of each image that it refers to.

I.E: <img src="/content/dam/images/my"+imagevariable>

What options do I have and what would be the best approach here?

Did some reading and came across using Slightly request? I was thinking of putting the name of the image in a property which I can pull out and change for each image within the component.

Thanks,

Ram

1 Accepted Solution

Avatar

Correct answer by
Level 10
The best way to make images a variable  is to write and read from JCR node props. So in one part of your AEM app, write the image to a prop. Then read that prop when you need to know what image to display.       

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10
The best way to make images a variable  is to write and read from JCR node props. So in one part of your AEM app, write the image to a prop. Then read that prop when you need to know what image to display.