Displaying content from a single txt file

Hi,

In the snippets folder I created a zitat.php file which contains the following code:

<div class="highlights-container">
  <div class="highlights">
    <div class="card-one">
      <img src="<?php echo $site->find('images')->file('Team_Picture.jpg')->url() ?>">
    </div>
    <div class="card-two">
      <blockquote>
        <?php echo $page->Zitat(); ?>
        <p><strong><?php echo $page->Owners('team_picture'); ?></strong></p>
        <cite><?php echo $page->Position(); ?></cite>
      </blockquote>
    </div>
  </div>
</div>

Now, as I understand, the txt file acts as a database in Kirby. So logically, when I place <?php snippet('zitat') ?> in the soap.php file the content i.e. the text that is supposed to be echoed will not be echoed i.e. displayed unless I place the content that needs to be displayed in the soap.txt file like this:

Title: Soap


Name: Green Soap


Zitat: My quote about our boutique company.


While this does work, it’s not practical since I’ve to repeat this process for every soap.txt file. Is there a way to pull the information from one txt file? There is already a site.txt file that lives inside the content folder but when I added the content just as I did in the soap.txt file, nothing was displayed. Grateful for your support.

1 Like

Many thanks indeed. It worked beautifully :slight_smile: :tophat: