Forum

Thread tagged as: Question, Problem

Passing content into select options

I'm trying to get a list of my pages into a select tag so my user can select a page to link to. Providing my content was a comma seperated string, should I be able to use something like:

<perch:content id="link_select" type="select" label="Select a page to link to" options="<perch:content id="pagelist" />" allowempty="false" />

I can see in <perch:showall /> that the comma seperated string contains all my page titles, but nothing is appearing in the select. Unless I am misusing the select in this case.

Mathew Doidge

Mathew Doidge 2 points

  • 4 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

No, that won't work.

Is the pagelist fieldtype now built into p3, Drew?

Drew McLellan

Drew McLellan 2638 points
Perch Support

Not as far as I'm aware, no.

Is there a way in which I could pop a select with navigation items? I looked at dataselect, but that looked like I would need to be pulling something from another region, whereas at the moment my variables being popuated via perch_pages_navigation and passed into the template via a sys var. It's not essential, I could just let the user paste in a link manually - just wanted to explore if this was an option.

Mathew, why aren't you just using the pagelist field type for this? While it isn't built in to P3 as you asked, it should still be working as a addon fieldtype.

Mathew,

BTW, I have done this with a str_replace() on the return HTML.

In my template I used

options="__OPTIONS__"

then use str_replace() to add the options before output to page.

Just another thought.