Jump to content

share content between pages


DarsVaeda
 Share

Recommended Posts

Hi,

what is the common way to share content between pages? It would be best if they would be editable from all pages and even further, if I could overwrite the main instance with subinstances aka page specific content.

Say I have a header that includes my support number. Now I have this field on the main page to be editable. But of course the header is the same on all pages. So I want to have the same content of that main page field in all pages.
But maybe there is a subpage for say a specialized section in my company that has a special number. So that page would overwrite the default value from the main page.

I thought I do this with HannaCode but just figured that when creating a new page, these fields need to be filled with the HannaCode.
So I guess I could program this into the template referencing the main page and so on but maybe there is a mechanism included to do this.

Link to comment
Share on other sites

Just for reference, programmatically it is fairly easy:

<?php
$frontpage = $pages->get(1); // 1 is the root page
?>
<!DOCTYPE html>
<html lang="en">
<head>
    ...
</head>
<body>
    <header>
      ...
      <p class="support_hotline"><?= (!empty($page->field_support_hotline) ? $page->field_support_hotline : $frontpage->field_support_hotline) ?></p>

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...