Merge content.txt with $page object

Let’s say I got a string with Kirby content txt file data inside it.

Can I merge it with the $page object? How? Are there any good functions I can use for it?

Tab1: 

----

Rent-500-30-days: 

-
  active: true
  source: "wqewqeqwerwe"
  value: "wqeqwewrwrwe"

----

Rent-1000-30-days: 

-
  active: true
  source: "eewrewerewrwe"
  value:

The “Kirby way” would be:

  1. That content should live in your page’s main txt file. That way it can be edited in the panel, is already “merged” in the $page object, etc.

  2. If that’s not desirable, create a child page:
    /my/page/child/module.txt
    And maybe create a module.php controller that redirects HTTP requests to the parent page, so that this child page cannot be shown.

1 Like

I’m experimenting with transporting data between two Kirby installations and I see now that your idea would probably be the best one.

My plan now would be something like this:

  1. From the other installation add routes to make the txt files accessible from the outside.
  2. Download the content to the main Kirby installation content folder.
  3. Let the content be in a special folder like data that shows an error page for normal users, but accessable from the templates.
  4. Access the content with like echo site()->page('data/whatever')->title().

Thanks!