Local host kirby subpage content not loading

Since taking my site down from the server and working on it locally the content on my subpages doesn’t load anymore.

Sub pages pull in header, footer and titles ok:

<?php snippet('page-header') ?>
<h1><?php echo $page->title()->html() ?></h1>
<?php snippet('page-footer') ?>

These parts do not work

<?php echo $page->text()->kirbytext() ?>

<!-- <?php foreach($page->images()->filterBy('filename', '!=', 'home-page.png')->sortBy('sort', 'asc') as $image): ?>
<figure>
  <img src="<?php echo $image->url() ?>" alt="<?php echo $page->title()->html() ?>">
</figure>
<?php endforeach ?> -->

Or these

    <?php foreach($page->children()->visible()->flip() as $article): ?>

    <article class="article articlethumb" role="article" itemscope itemtype="http://schema.org/Article">
      <h1 class="posttitle hover" itemprop="headline">
        <a href="<?php echo $article->url() ?>" rel="bookmark" class="hover"><?php echo html($article->title()) ?></a>
      </h1>
      <div class="postcontent" itemprop="articleBody">
        <a href="<?php echo $article->url() ?>" class="hover">
          <?php if($image = $article->image('main.jpg')): ?>
            <img src="<?php echo $image->url() ?>" alt="<?php echo $article->title()->html() ?>">
          <?php endif ?>
        </a>
        <p><?php echo excerpt($article->text(), 300) ?></p>
      </div>
      <ul class="postinfo">
        <li><time class="date" datetime="" itemprop="datePublished"><span>Published:</span> <?php echo $article->date('d/m/Y') ?></time></li>
        <li class="posttags"><span>Tagged:</span> <?php echo $article->tags() ?></li>
      </ul>
      <a href="<?php echo $article->url() ?>" class="readmore project-section-button hover transition">Read More</a>
    </article>

<?php endforeach ?>

I’m using mamp to host locally, I’m a little out of touch with this any help appreciated!

Are you certain that you brought eveything down from the server, including the .htaccess file which is in the root of the public html folder. If you did this with SFTP, it may have been missed since some FTP clients hide dot files by default. You may need to change the settings in your FTP program to see them.

This file deals with URL rewriting and i think its missing. I think what you are actually seeing is the error page (which hasnt been set properly and is trying to use the default template instead). This is why are still get the header and footer, but no middle part of the page.

The .htaccess file is in the root folder locally. Could there be another issue with the url rewriting locally using MAMP?
Also is there a way to see an error output more than just an error page?

If it is really the error page, then it’s not a PHP error and debugging PHP wouldn’t make sense.

Try and find out which template is actually used, e.g. by printing some characters into the default template.

Also, if the correct title is shown, then it’s not the error page.

Yes you are right the templates work and some of the snippets work. It seems to be a problem with kirbytext

<?php echo $page->text()->kirbytext() ?>

Above was working on the server but not locally

Hm, that’s weird.

Do you get a result if you do a dump($page->text())?

Sorry I’m a bit of a novice, what do I do with that? Just paste it into the template?

Yes

it just prints
dump($page->text())?

Ok, I probably should have mentioned that this needs to go within php tags, since it is PHP code:

<?php dump($page->text()) ?>

Ok great, it has dumped a lot of stuff but text from other pages too, what am I looking for here?

this is what I get on the page that the kirby text is missing:

    Page title
Field Object
(
    [page] => Page Object
        (
            [kirby] => Kirby Object
                (
                    [roots] => Kirby\Roots Object
                        (
                            [index] => /Users/alexdemes/Dropbox/_Sites/public_html/demetriades.co.uk
                        )

                    [urls] => Kirby\Urls Object
                        (
                            [index] => http://localhost:8888
                        )

                    [cache] => Cache\Driver\Mock Object
                        (
                            [options:protected] => Array
                                (
                                )

                        )

                    [path] => home/carjump
                    [options] => Array
                        (
                            [url] => 
                            [timezone] => UTC
                            [license] => K2-PERSONAL-94860ed48c0a2f3a4c909e1534633126
                            [rewrite] => 1
                            [error] => error
                            [home] => home
                            [locale] => en_US.UTF8
                            [routes] => Array
                                (
                                )

                            [headers] => Array
                                (
                                )

                            [languages] => Array
                                (
                                )

                            [roles] => Array
                                (
                                )

                            [cache] => 
                            [debug] => env
                            [ssl] => 
                            [cache.driver] => file
                            [cache.options] => Array
                                (
                                )

                            [cache.ignore] => Array
                                (
                                )

                            [cache.autoupdate] => 1
                            [tinyurl.enabled] => 1
                            [tinyurl.folder] => x
                            [markdown.extra] => 
                            [markdown.breaks] => 1
                            [smartypants] => 
                            [kirbytext.video.class] => video
                            [kirbytext.video.width] => 
                            [kirbytext.video.height] => 
                            [kirbytext.image.figure] => 1
                            [content.file.extension] => txt
                            [content.file.ignore] => Array
                                (
                                )

                            [thumbs.driver] => gd
                            [thumbs.filename] => {safeName}-{hash}.{extension}
                        )

                    [license] => 
                    [routes] => 
                    [router] => Router Object
                        (
                            [request:protected] => 
                            [route:protected] => Obj Object
                                (
                                    [pattern] => (:all)
                                    [https] => 
                                    [ajax] => 
                                    [filter] => 
                                    [method] => Array
                                        (
                                            [0] => GET
                                            [1] => POST
                                            [2] => HEAD
                                            [3] => PUT
                                            [4] => PATCH
                                            [5] => DELETE
                                        )

                                    [arguments] => Array
                                        (
                                            [0] => home/carjump
                                        )

                                    [action] => Closure Object
                                        (
                                            [static] => Array
                                                (
                                                    [site] =>

Hm, the output is a bit weird. There’s a lot of stuff there, but I’m missing the field content.

But at least I now know that we are dealing with a Kirby 2 project here… Let me check what you would normally get from a field dump.

Other question: What is the exact Kirby 2 version and what is your local PHP version?

Thanks for your help with this:

Version:
static public $version = '2.0.6';

local PHP: 7.2.10

Hm, that version is pretty old. Just guessing but I wonder if it is an issue with that old version and PHP 7.2. For a test, try and select an older php version like 5.6, you can easily change that in your Mamp environment. I have no other idea at them moment.

Hey! Ok great I managed to get it working locally by using PHP 5.6 with mamp :slight_smile:

Now the question is how can I convert this project into the latest version of kirby? Is it possible without rebuilding it?

That depends basically on your plugins. Plugins were the biggest change from Kirby 2 to 3, but of course, a lot of other stuff has changed, like blueprints for the Panel etc. You can read the migration guide to get an impression of the necessary changes:

And the sub-guides:

If that is all too much, I’d upgrade to the last Kirby 2 version (2.5.13) to get a version that is PHP 7.x ready and has the latest security updates. Using PHP 5.6 is not a good idea, because it has reached end of life a while ago and doesn’t get updates anymore.