Hi,
When I create a multi select input where i can select resources and I want the output to be a link to that resource. How can I get to link to read/show the title of the page i'm linking to? I can't find any info about that.
I've read about using snippets for this. But that seems unnessesary..
Thanks.
-
MODX Staff
- 2,502 Posts
Could you provide a little more detail into where this is and what you are using to display these? You will need some form of processing either a snippet that will get the pagetitle of the resource you're requesting. You can't just do it via [[~34]] as all that does is make a path to the resource.
Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup
magician.
Blog ✦
Twitter ✦
LinkedIn ✦
GitHub
Ok. I'll try to explain it better. :s
I have 10 pages. ID's ranging 0-9.
Each page uses the same template.
On each page I need a little menu. The menu items can be selected by the user using a tv. This tv has an input type of a multi select list. This list is a collection of all the pages. I'm using this query to get these pages:
@SELECT `pagetitle` AS `name`,`id` FROM `[[+PREFIX]]site_content` WHERE `published` = 1 AND `deleted` = 0
As output type i select URL.
Now, when I place this tag [[*tv.menu]] in my template and view a webpage, I get this menu, linking to the selected pages. But the text of each link is the ID of the page i'm linking to, not the title.
My question is: How to make the text of the link the title of the page i'm linking to?
(What should I insert in "Display Text:"?)
EDIT: I read that I shouldn't use output type URL, instead output with a separator and then use getResources. And that works fine, and probably better because it gives me more flexibiliy with markup.
[ed. note: meddiecap last edited this post 14 years, 8 months ago.]