Blog Sections Open

Passing Placeholder Values into a Custom Snippet

A small debugging guide for passing placeholder output into custom snippets and avoiding empty values caused by parser timing or quoting mistakes.

Passing a value from a template placeholder into a custom snippet looks simple, but parser timing can make it fail in subtle ways. A classic example is sending [+introtext+] into a helper snippet and receiving either an empty value or the raw placeholder text back.

The original call

[[library_prev? &v='[+introtext+]']]

And a simplified snippet:

<?php
$replText = $v;
echo mb_strimwidth($replText, 0, 10, '...');

Why this breaks

The placeholder may not be ready at the time the snippet is parsed, or the quoting style may force the parser to treat it as a plain string rather than a resolved value.

Safer options

  • generate the placeholder earlier in the request
  • pass the raw field directly when possible
  • do the trimming in the list/controller layer instead of chaining parser stages
[[library_prev? &v=`[*introtext*]`]]

Or better, prepare the short version before it reaches the snippet at all.

Rule of thumb

If a snippet depends on data created by another parser stage, check the order in which placeholders are populated. Most “empty parameter” bugs in Evolution CMS turn out to be parser-order bugs, not PHP bugs.

Newer post

Building a NewsController with DLMenu, DocLister, and Blade in Evolution CMS

A practical controller pattern for a news section in Evolution CMS, combining DLMenu, DocLister, Blade partials, and paginator data.

Older post

Sending FormLister Submissions to Telegram

Use a prepare snippet to forward FormLister submissions to Telegram in a clean, maintainable way.