Snippets

templating

4 months 4 weeks ago #94049

Jonathan's Avatar Jonathan

https://drive.google.com/file/d/1YWHFqYSaFaUqd5S-JWknEW94bXhNhcBE/view?usp=sharing

How can I create a structure like what's in green and dynamically replace what is in yellow. The idea is to be able to reuse and standardize the green structure as a standard and just insert the specific URL and text

4 months 4 weeks ago #94051

Peter van Westen's Avatar Peter van Westen Admin

You could have a Snippet item that deals with this.
Something like:

<a href="[%snippet \1%]"...>
   <button ...>
      <i class="fa fa-lg fa-\2">&nbsp;&nbsp;\3
   </button>
</a>

Then to call that, you can do:
[%snippet name-of-this-snippet|name-of-inner-snippet|some-icon|Some Text%]

With ReReplacer you are more flexible in how you deal with the syntax. And could even implement default values.
But requires some more setup and Regular Expressions and php knowledge.

4 months 4 weeks ago #94052

Jonathan's Avatar Jonathan

This is great thanks. I dont want to use rereplacer because its DANGEROUS =)

4 months 4 weeks ago #94053

Peter van Westen's Avatar Peter van Westen Admin

But oh so powerful!!!