I don’t know and I think that’s really also an edge case. Normally, you would have to replace strings only in limited locations, i.e. long form text, which could be a textarea field or blocks field, not all over the place.
Of course, you can buffer all your stuff in your templates, then call the replacement on the buffered string. Or use JavaScript on the frontend or whatever.
it seems i’ll go the way of using kt() nearly everywhere… it’s a pity… but well… i’ll test if it will break things…
so i use the placeholder cookbook recipe with just a simple change:
instead of Str::template() il use strtr() which seems to do the same but without start/end-triggers. So no need of preg_replace_callback() or similar.
i did not understand the options-thingy completly… i would like to have the blueprint that the cookbook recipe recommend to place inside site.yml to be in a separate file that i use for ressources.
Could you give me hint on that? i don’t understand the syntax of options() in this case
In the example plugin we use site(), but you can of course replace this with `page(‘resources’), that doesn’t matter. If you don’t want to hardcode it, you could set up another config option for that
The cookbook recipe has example code, depending on what you do, you can throw out the stuff that you don’t need and modify everything to your liking.
ok… project is down… fails are also helpfull… so i describe why the original idea was a bad one…
i oversaw, that automatic replacement will also replace parts of for example urls etc. on the site… also it does not reflect words in plural/singular or any grammar and on and on…
so for anyone with a similar idea:
a very intelligent matching algorythm would be needed for this… and that would be much more work than reworking text all over the website to use a kirbytag or placeholder-brackets…
well… much time lost… but i learned several things =)
@texnixe i am highly interested in the glossary kirbytag solution of the kirby-homepage… is this documented anywhere? or do i have to fish in the code?
so i try to reformat the output, but i always get the html tags of $tooltip rendered as text… not rendered as html… since i did not solve to add a non-associative attr to Html:span() (maybe you can help here, too) i try it plain like this: