Boycce
April 3, 2015, 5:04am
1
Hey there,
Am trying to get a simple blog up and running but cannot seem to get the article listing (blog page) to display relative images using kirbytext()
inside each article.
Blog Page:
<?php
// foreach...
echo $article->text()->kirbytext()
?>
Content in the article:
Blah blah (image: myprettyimage.jpg) blah blah
Thanks
What is the result you get? An empty figure/image tag? First thing that comes to mind is that there is no such image in the article folder …
Is the name of the picture accurately identical to
[quote=“Boycce, post:1, topic:687”]
myprettyimage.jpg
[/quote] ???
That means no capital letter in the whole name and extension!
Boycce
April 3, 2015, 9:29am
4
Thanks for your replies @texnixe @anon77445132 !
This is the output I am receiving on the blog page which is incorrect:
http://domain.me/blog/
<figure>
<img src="http://domain.me/myprettyimage.jpg">
</figure>
And the correct output looks like this on the article page.
http://domain.me/blog/my-pretty-images/
<figure>
<img src="http://domain.me/public/content/blog/all-pretty-images/prettyimage.jpg">
</figure>
Is that on the new Kirby 2.1 beta? That should usually work without any problem, so I wonder if you use any routes or rewrite doesn’t work properly?
Boycce
April 3, 2015, 6:23pm
6
Hey there,
no routes or special htaccess other than the defaults. I am work offing Kirby 2.0.6
Thanks!
Which version of apache and which version of PHP do you use there?
Is the .htaccess
file in the root of your Kirby root?
Boycce
April 4, 2015, 10:27am
8
Hey there, yes the .htaccess is in root.
Apache 2.4.7
PHP 5.4.16
My site.php
<?php
$kirby = kirby();
$domain = server::get('server_name');
$kirby->urls->index = url::scheme() . '://' . $domain;
// custom roots
$kirby->roots->site = __DIR__ . DS . 'server';
$kirby->roots->content = __DIR__ . DS . 'public' . DS . 'content';
$kirby->roots->assets = __DIR__ . DS . 'public' . DS . 'assets';
$kirby->roots->avatars = __DIR__ . DS . 'public' . DS . 'avatars';
$kirby->roots->thumbs = __DIR__ . DS . 'public' . DS . 'thumbs';
// custom urls
$kirby->urls->content = $kirby->urls->index . '/public/content';
$kirby->urls->assets = $kirby->urls->index . '/public/assets';
$kirby->urls->avatars = $kirby->urls->index . '/public/avatars';
$kirby->urls->thumbs = $kirby->urls->index . '/public/thumbs';
?>
Boycce
April 4, 2015, 8:04pm
11
Solved!
I had a simple excerpt condition which I stupidly didn’t mention to you guys:
$text = $article->text();
if (strpos($text, '(more:)') === FALSE) {
echo kirbytext($text);
} else {
echo kirbytext(strstr($text, '(more:)', true));
}
I changed this line below, and now all images work as normal.
```echo strstr(kirbytext($text), ‘(more:)’, true);````