Kirby update breaks theme (2 Blocks)


#1

Hello,

I’m new to Kirby and currently migrating my site to Kirby. I bought the 2 Blocks theme, installed it locally (MAMP on OSX with PHP 7) and started it up. The theme comes bundled with Kirby 2.1.1.

The following url is a deep link coming from an archive site of the theme and does work in 2.1.1: http://localhost:8888/home/amsterdam2018

I then did an update to the current Kirby. I deleted the panel and kirby folders and copied the new version to that location. The website does work fine, but the mentioned link shows an error message:

This page is currently offline due to an unexpected error. We are very sorry for the inconvenience and will fix it as soon as possible.

Also some other pages like tag overviews for tags with a space in it show that error.

I enabled debug mode, but no php errors appear in the logfile.

Do you have any clue how I could fix that problem?

Bye
Oliver


#2

if you enable debug mode in the config file then you should see the error in the code when you visit a page.


#3

Debug mode is enabled and no error message is displayed on the page or in the php error logfile (which gets written when I test it with other erroneous pages, so the error logging itself works fine).


#4

When you put c::set('debug', true); in config.php, then you still get

This page is currently offline due to an unexpected error. We are very sorry for the inconvenience and will fix it as soon as possible.

? That shouldn’t be the case…

Is error logging enabled in your php.ini?


#5

Yes, debug mode is enabled as a default in that theme’s config.php.

Yes, the text on the webpage still appears,

display_errors is disabled in the php config, an error logfile set and logging of errors is enabled. The logfile gets written when I put an own php page containing errors into the kirby project folder and try to fetch that file.


#6

What exactly does or doesn’t work, a link to a file on localhost is not really that helpful.

You say that the website is working but some links don’t. What is “the website”? Do you mean the start page is working but other pages are not? If so, maybe rewriting is not enabled on your server?

Also, is the .htaccess file up to date? I’m not quite sure when it was changed, but make sure that you are using the latest version of that file as well.


#7

The start page does work, tag, author, category and month pages as well. The theme creates two kinds of links for content pages:

http://localhost:8888/2018/04/14/amsterdam2018
http://localhost:8888/home/amsterdam2018

Both do not work, or, to be more precisely, they did not work. They started working yesterday evening, then stopped working and then started working once again and keep working now in the morning. I did not change the configuration (I’m working with content management systems at my day job for the last 20 years and know how problematic that phrase is, but “did not change” really means that I did not change the configuration). I will check it again this evening. Maybe the problem just disappeared… :woman_shrugging:

One thing is still not working and I don’t know if that’s a limitation of Kirby or a bug in the theme: Tags with spaces in them.

The theme creates this link in its navigation layer which results in an error: http://test.taptoplay.de/tag/Amsterdam+2018

If I change it to this it works: http://test.taptoplay.de/tag/Amsterdam%202018

The theme creates the tag url with the following code:

<?php echo $site->url().$tag->url() ?>

and it uses a helper function to get all tags:

function getTagsArchive() {
  return tagcloud(page(c::get('posts-page')), array('field'   => 'tags',
                                       'param'   => 'tag',
                                       'baseurl' => ''));
}

There does not seem to be any kind of url encoding involved in the theme’s code, so the “+” seems to come directly from the kirby core (which is only a guess, since I’m new to Kirby).


#8

To make tags with spaces work, you have to urlencode() and urldecode()them. But the tag cloud actually uses url encoding (hence the +), so that’s a bit strange.

What seems to be missing here is the urldecodign.

In the controller or template, it should therefore be decoded:

if($tag = urldecode(param('tag'))) {
  // filter collection of posts
}

#9

I also got a reply from the theme devs. Their fix was to use rawurlencode. That works as well!

How do I mark this topic as solved?


#10

You can mark a topic as solved by changing its category. If you click on the pen icon next to the headline of the topic, you can change it.


#11

Hi Truhe,

I´ve got the same issue, would it be possible to get the detailed information from you what the dev guys had done to fix the issue with the 2 blogs theme? I don´t know how what to do with the rawurlencode - information in your post.

Thank in advance for your support,
Udo