picocms / Pico

Pico is a stupidly simple, blazing fast, flat file CMS.
http://picocms.org/
MIT License
3.81k stars 615 forks source link

Pages plugin incompatible? #551

Closed youcantryreachingme closed 3 years ago

youcantryreachingme commented 4 years ago

New to picocms. Downloaded the pages plugin, modified my template to reference

for page in pages_pages|sort_by("time")|reverse

and got the error:

Fatal error: Uncaught exception 'Twig_Error_Runtime' with message 'The sort_by filter only works with arrays or "Traversable", got "NULL"'

Of course, removing the filter doesn't solve it, because the call is returning null.

I note in the plugin's documentation it includes the below note:

For reference, these values are set in config.php using the following format:

$config['pagination_limit'] = 10;
$config['pagination_output_format'] = "list"

I saw this reference to $config['some value'] in another plugin's documentation too - but it doesn't correlate with the syntax I find in my config file. I am guessing these plugins were developed for version 1 of picocms (and I am using version 2)?

If so, perhaps the picoCMS website should be cleaned up, with regard to the plugins page, to clarify exactly which plugins are/aren't available for the latest version of the CMS?

Lomanic commented 4 years ago

Looks like you are talking about this plugin https://github.com/rewdy/Pico-Pagination

The wiki is more explicit about the versions plugins support https://github.com/picocms/Pico/wiki/Pico-Plugins

Did you remove or disable the PicoDeprecated plugin?

PhrozenByte commented 4 years ago

for page in pages_pages|sort_by("time")|reverse

I assume it's supposed to be:

{% for page in paged_pages|sort_by("time")|reverse %}
youcantryreachingme commented 4 years ago

Did you remove or disable the PicoDeprecated plugin?

Thanks for the wiki link - I will take a look around. There are certainly more plugins here than listed on the picocms homepage - and a few look very useful from their names..

My plugins folder has a folder named PicoDeprecated which contains several files. I actually didn't know what it was until I started reading the info following your link. The two plugins I've tried have both said to simply drop a single PHP file into the plugins folder - but I had issues getting either to work. Was I doing this correctly (ie. even though this PicoDeprecated pugin has a folder within the plugins directory)?

youcantryreachingme commented 4 years ago

I assume it's supposed to be:

{% for page in paged_pages|sort_by("time")|reverse %}

Yes - I meant the opening and closing characters as implied.

PhrozenByte commented 4 years ago

I assume it's supposed to be:

{% for page in paged_pages|sort_by("time")|reverse %}

Yes - I meant the opening and closing characters as implied.

This was rather about your typo, pages_pages instead of paged_pages :wink:

Lomanic commented 4 years ago

I would suggest to use my own fork of the Pico-Pagination plugin as my pull request https://github.com/rewdy/Pico-Pagination/pull/14 was never merged. Otherwise, even non-existing pages will be served with a 200 HTTP status.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in two days if no further activity occurs. Thank you for your contributions! :+1: