Every now and then when I include one of my snippets, Kirby is randomly printing number 1 on the page.
I have had this since the beginning and I don’t know what causes it, it comes and goes randomly.
Atm I am including the exact same snippet on 2 pages and on one page the number 1 is being printed and on the other the problem doesn’t occur.
Totally clueless …
Could you post the snippet, please? I think you are probably outputting a boolean somewhere in your snippet, that prints 1 if true and nothing if false.
<?= require_once($kirby->root('site') . '/functions/fetch' . $page->twitterFetch() . '.php'); ?>
<?php $tweets = json_decode($twitter->setGetfield($getfield)->buildOauth($url, $requestMethod)->performRequest()); ?>
<div class="max-width-wrapper">
<section class="default-section tweet-section">
<h2 class="default-section-title"><?= $page->LatestNews() ?></h2>
<div class="flex-row">
<?php foreach ($tweets as $tweet) : ?>
<div class="tweet-container">
<a href="https://twitter.com/DavisCup?ref_src=twsrc%5Egoogle%7Ctwcamp%5Eserp%7Ctwgr%5Eauthor" target="_blank" class="link-to-twitter">@<?= $tweet->user->screen_name ?> tweets</a>
<p><?= substr($tweet->text, 0, 70) . ' ' ?>...</p>
<a href="https://twitter.com/DavisCup?ref_src=twsrc%5Egoogle%7Ctwcamp%5Eserp%7Ctwgr%5Eauthor" class="read-more-tweet">Read more</a>
</div>
<?php endforeach ?>
</div>
</section>
Brunelli:
<?= require_once($kirby->root('site') . '/functions/fetch' . $page->twitterFetch() . '.php'); ?>
It’s this first line, you are echoing the require function, which doesn’t make sense. Should be:
<?php require_once($kirby->root('site') . '/functions/fetch' . $page->twitterFetch() . '.php'); ?>
<?=
is a short echo tag, the same as <?php echo
Allright, clear! Strange that it doesn’t output the int in every page.
Thanks again!