i will store in one snippet file more of 5 variants of an divider-hr-code-snippet.
and then i can be use the include-syntax with an option to choose one of the variants.
<?php snippet('divider', ['zickzack']) ?>
how can i solve this?
i will store in one snippet file more of 5 variants of an divider-hr-code-snippet.
and then i can be use the include-syntax with an option to choose one of the variants.
<?php snippet('divider', ['zickzack']) ?>
how can i solve this?
In what way do your 5 variants differ?
its a dividier with an image. it is a various line. tick zack, curved, dashed,…
If you have differing html, you would need different snippets, unless you use if statements/switch syntax that depend on a variable you pass to the snippet:
<?php
switch ($lineType) {
case 'zigzag':
$url = url('assets/images/zigzag.svg');
break;
case 'curved':
$url = url('assets/images/curved.svg');
break;
case 'dashed':
$url = url('assets/images/dashed.svg');
break;
default:
$url = url('assets/images/straight.svg'); // default line if value does not exist
}
?>
<img src"<?= $url ?>" alt="">
Snippet call:
<?php snippet('divider', ['lineType' => 'zigzag']) ?>
very nice. thats it!
thanks a lot.