Closed multiplehats closed 5 years ago
Hey,
Love Tonik :)
Noobie question.
Let's say I have a button template like so:
<button class="<?php echo $button_classes ?>"><?php echo $title ?></button>
And I want to render that button:
template('partials/button', [ 'title' => 'Click me' ]);
How can I send an array to render the button classes? I tried a few things already.
template('partials/button', [ 'title' => 'Click me', 'button_classes' => array('thing1', thing2') ]);
Thanks!
You just need to either access the array values directly or more likely loop through them.
Directly $button_classes[0] $button_classes[1]
Loop foreach ($button_classes as $class) { echo $class;)
Hey,
Love Tonik :)
Noobie question.
Let's say I have a button template like so:
<button class="<?php echo $button_classes ?>"><?php echo $title ?></button>
And I want to render that button:
template('partials/button', [ 'title' => 'Click me' ]);
How can I send an array to render the button classes? I tried a few things already.
template('partials/button', [ 'title' => 'Click me', 'button_classes' => array('thing1', thing2') ]);
Thanks!