Inject HTML into custom template with template variables?

Liam W

in memoriam 1998-2020
I have a custom template setup for an addon, which basically contains a select drop down box.

The options are dynamic, and I though I would be able to stick them in by creating an array of the <option></option> tags in the php, and then adding this to the viewparams and then using <xen:foreach> to loop through the option tags and output them.

Well, this sort of works - but it doesn't. The outputted text is obviously not intepreted as HTML, and as such the options aren't being added to the drop down.

Is there any way I could do this?

(If only there was an <xen:eval> template thingy...)
 
If you're already using a <xen:foreach> in the template, you should just put any HTML in the templates and not in the PHP.

True, but I was initially doing it a different way, and it was easier to not change it. I'll do it that way now though :)

(Also, I didn't think of your way ;))

Incidentally, is it possible to define custom actions for existing controllers to create a custom route of the existing route?
 
True, but I was initially doing it a different way, and it was easier to not change it. I'll do it that way now though :)

(Also, I didn't think of your way ;))

Incidentally, is it possible to define custom actions for existing controllers to create a custom route of the existing route?
Yes. Hook into the listener and extend the controller. I believe the listener is load_class_controller.
 
Back
Top Bottom