Is it possible to call a php script in the design parse file? I want to do a random image in the design which I've successfully done with javascript but what I'd like to do is shuffle the array on the server side and write only the relevant image tag with the appropriate attributes into the rendered html. I tried a little <?php echo blah /> test directly in the design but the parser spat the dummy.
No, you can't include PHP anywhere in Matrix. However, you can use an Asset Listing in Random mode to insert a random image via a Nested Content design area.
Steps:
- Create a Nest Content design area in your design where you want the image to appear.
- Create an asset listing that lists images and set it to Random mode. You may want to switch all the bodycopies into Raw presentation and Raw HTML mode so that you don't get <div> tags printed in the output.
- Nest the asset listing into your design.
- PROFIT!
Thanks Avi, Ill try that.