ernst
May 2, 2019, 1:28pm
1
Hello,
The content of my website no longer displays. I have all my content in the content folder. Nothing shows.
<?php echo $page->jobs_intro_1() ?></h1>
must become:
<?= $page->jobs_intro_1() ?>
Correct? Unfortunately this doesn’t work.
Kind regards,
Ernst
The upgrade.php
must be created as explained in the upgrade guide, the content of the file is displayed in the upgrade guide.
ernst
May 2, 2019, 1:45pm
3
@texnixe - yes, I followed those steps. I updated my first post. I’m now stuck at the part where the index.php file needs to be corrected.
Old index.php
define('DS', DIRECTORY_SEPARATOR);
// load kirby
require(__DIR__ . DS . 'kirby' . DS . 'bootstrap.php');
// check for a custom site.php
if(file_exists(__DIR__ . DS . 'site.php')) {
require(__DIR__ . DS . 'site.php');
} else {
$kirby = kirby();
}
// render
echo $kirby->launch();
New one:
<?php
include __DIR__ . '/kirby/bootstrap.php';
$kirby = new Kirby([
'roots' => [
'index' => __DIR__,
'site' => __DIR__ . '/',
'content' => __DIR__ . '/content'
],
'debug' => true
]);
echo (new Kirby)->render();
Non of the content is still displaying .
since you have redefined kirby, it should be
echo $kirby->render();
ernst
May 2, 2019, 1:50pm
5
@texnixe - changed. I have changed the echo
statement.
/content/home.en.md
to /content/home.txt
and now the page renders without the text. But my CSS/divs are rendering.
Is there an additional step to support .md
files?
Just like in Kirby 2, you have to set that in your config, default is txt
:
BTW, what is that debug statement doing there? That should go into your config.php file.
Are you using a custom folder setup at all?
ernst
May 2, 2019, 2:04pm
9
Yes! I tackled that one too. Removed that statement and moved it in to the config file.
My text content is now rendering from the .md
files.
Images are not being displayed, nor are the global language translations. I’ll report back here if needed. Thanks so far!
ernst
May 2, 2019, 2:12pm
10
@texnixe
Image issue. Images are located in the content/home/
folder. Where they have a name like image.en.png
.
I used to get these images with:
<?php echo $page->image('image.en.png')->url() ?>
I ran:
<img src="<?= $file->url() ?>">
<?php endforeach ?>
This returns broken image links like:
http://localhost:9000/media/pages/home/1727030122-1543310673/image.png
Is there a new way to get images from the content/home/
folder?
Language definitions are now in language files in /site/languages/de.php
etc. The translations can be defined in the translations array. To get them, you the t()
helper, no longer l::get()
.
As regards the images, looks like there’s a problem with the image filenames. Are the images copied to the media folder?
ernst
May 2, 2019, 2:19pm
12
@texnixe :
Images: They are not copied to the media folder, yet. It contains empty folders. How do I fix this?
Languages: I’ll get back on that later.
Hm, I tested with the dots in the filename and don’t have a problem, so that doesn’t seem to be the problem. Although I wonder why your image.en.png
becomes image.png
, without the en
bit.
What is your local server environment?
ernst
May 2, 2019, 2:28pm
14
PHP 7.1.23 (cli) (built: Feb 22 2019 22:08:13) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
I didn’t mean your PHP version, but your development environment, MAMP, XAMPP, Valet, PHPs built-in server…
ernst
May 2, 2019, 2:30pm
16
macOS, and I just run the local PHP server through the command line.
With the router?
php -S localhost:8000 kirby/router.php
ernst
May 2, 2019, 2:44pm
19
When I run: php -S localhost:8000 kirby/router.php
the images are loaded.
When I push the code to my staging enviroment (server), I have the same problem as before where the images are not loaded. Do I have to setup kirby/router.php
in a config file? How do I make this always work?
No, the router is only needed when you use the built-in server, not in a normal server environment.
Make sure the media folder is writable and do not deploy the files inside it.
1 Like
ernst
May 2, 2019, 3:40pm
21
Thank you Sonja! I learned A LOT.