i have a general snippet that will pull misc data from the database and display. Is it possible to modify the [*pagetitle*] or any other page content or template variables via a snippet? Does it matter if the snippet is called before or after the TV-to-be-changed in the template?
Thank you,
Yehosef
You could specify a TV tag or placeholder tag in the pagetitle value. Then have an @EVAL in the TV, a plugin on an appropriate event, or a snippet on the page set the value of the placeholder. As long as it’s not nested within too many other tags, it shouldn’t matter what order they are called.
The real question is, do you want to just change the value occasionally so that it is reflected to the next person (i.e. actually change the value in the database), or is it just a personalization of the value for every request? You can change the pagetitle in the db, but that isn’t very efficient to do when requesting and processing the page. It’s much more efficient to put a dynamic placeholder there and set it on each request in a snippet (or plugin).
1) Can I understand from your answer that you cannot modify these variables via a snippet - even using the MODx API or the document parser class?
2) You mentioned a placeholder - how would I use a placeholder in a template? - placeholders are [+something+] - right? If I put a [+title+] in my template, how would I set that value?
$modx->setPlaceholder('title', $newTitleValue);