Answer the question
In order to leave comments, you need to log in
Embed code on some pages of a modx site?
Good afternoon!
First time working with modx. I'm trying to accomplish the following task:
on some pages (not all), I need to set the code in the head section.
With a cursory study, I realized that you can make a new template = old + new code to be inserted. But it seems to me that the solution is not the best.
Please tell me how can I solve my problem?
That is, it is desirable to prescribe some kind of condition that is triggered on certain pages and inserts the desired code.
Answer the question
In order to leave comments, you need to log in
You can make a snippet like this:
<?php
$resources = explode(',', $resources);
if (in_array($modx->resource->get('id'), $resources)) {
return 'block of code';
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question