I would like to show same image in the footer, as in header. I am using this solution:
id="footer"
class="footer"
<?php if ($page->background()->isNotEmpty()): ?>
style="
background:url(<?= $page->background()->toFile()->url() ?>);
background-position: center center;
background-size: cover;
"
<?php endif ?>
On this page http://metalista.lt.grikis.serveriai.lt/en/paslaugos/technologines-irangos-gamyba I am showing header image of parent page. So for example this child also has the same header of parent: http://metalista.lt.grikis.serveriai.lt/en/paslaugos/subranga
If I am trying to get background of parent:
id="footer"
class="footer"
<?php if ($page->parent()->background()->isNotEmpty()): ?>
style="
background:url(<?= $page->parent()->background()->toFile()->url() ?>);
background-position: center center;
background-size: cover;
"
<?php endif ?>
then I am getting error on pages, that don’t have parent page with this field.
So how could I check both page and parent page, if it has this field, and then print this field in footer?