I’m finding myself all to often resorting to embedding an entirely new template, simply because I need something parsed with PHP on input (usually to inject segments, GET/POST, Date, Session/User data into parameters), when other parts of my template require output processing, or vice versa.
Performance wise, it seems wasteful to have to embed an entirely new template, and is also cumbersome to have a chain of embedded templates.
Is it conceivable to have a plugin that would parse it’s contents on input or output depending on a parameter?
I’m happy to dig in to developing one, but I wanted to know if anyone has tried, if its even possible with a plugin, or if the parsing already too late to be done by a plugin?
Example:
{exp:weblog:entries entry_id="{exp:php parse="input"}<?= $_GET['country'] ;?>{/exp:php}">
{exp:php parse="output"}
<?php $states[] = '{state_code}'; ?>
{/exp:php}
{/exp:weblog:entries}
{exp:php parse="output"}
<?php
$states_str = implode('|', $states);
echo($states_str);
?>
{/exp:php}