-
☆ A M B ☆
- 24,524 Posts
Use a listing snippet like getResources and have this in the snippet's chunk tpl:
<a href="[[+tv.link]]">
<img src="[[+tv.image]]" alt="[[+tv.text]]" />
</a>
For this, I'd use
MIGx and its getImageList output snippet. The basic demo in the rtfm will work fine.
Thanks Susan,
I created a (MIGX) url inputTVtype to wrap images in a link that point to internal pages (though it doesn't seem to allow for a relative url). While it works ok it requires the client manually type (or copy/paste) the absolute url.
So, is there a more elegant way to create a (MIGX) inputTVtype field that would allow the user to select the (internal) page they want to link to and have it insert a relative url?
Revo 2.3
MIGX 2.8.1
[ed. note: todd.b last edited this post 12 years, 2 months ago.]
Todd
Quote from: todd.b at Jul 19, 2014, 03:16 PMThanks Susan,
I created a (MIGX) url inputTVtype to wrap images in a link that point to internal pages (though it doesn't seem to allow for a relative url). While it works ok it requires the client manually type (or copy/paste) the absolute url.
So, is there a more elegant way to create a (MIGX) inputTVtype field that would allow the user to select the (internal) page they want to link to and have it insert a relative url?
Revo 2.3
MIGX 2.8.1
this is all a matter, of your tpl-chunk
what is your tpl-chunk?
if link is a resource-id, you will need
<a href="[[~[[+link]]]]"><img src="[[+image]]" alt="[[+alt]]" /></a>
and you will need to put it into a tpl-chunk:
[[!getImageList?
&tvname=`slideshow`
&tpl=`tplLink`]]
otherwise MODX would try to parse
before the placeholder was parsed, which wouldn't work
Hi Bruno17,
I believe I did what you suggested correctly but I'm not seeing any difference between your approach and mine. I still have to manually type an absolute url to link to an internal page.
Instead of using a 'url' inputTVtype I think what I'm hoping to do is to use a picker (listbox) to select a site page and have the relative url generated.
Todd
discuss.answer
you can use a resource-list-TV-type to get the listbox for picking the resource.
This will store the resource-id and MODX will generate the url to that resource with
if link is the resource-list-field
That's excellent, Bruno. Thank you!
[ed. note: todd.b last edited this post 12 years, 2 months ago.]
Todd