Child of page with specific template

Hi everyone. I鈥檓 trying to create an If that comprehends a page with an specific template and all its childs. Now I鈥檓 achieving this behavior with the following code, but is not a good solution.

<?php if ($page->template() == 'edici贸n' or $page->parent()->template() == 'edici贸n'): ?>
<?php endif ?>

Anyone knows a better way to do this?

Thanks in advance.

You could probably achieve this with a filter rather than your if statement, but I鈥檓 not sure what pages your are trying to fetch here and in what context.