Giter Club home page Giter Club logo

pico-placing's Introduction

Pico-Placing

Provides Pico CMS with the ability to place the pages in any order according to a meta flag. The pages are sorted and iterated in the specified order, for example in the navigation. In case of same Placing-tag, first comes the page with the name first in alphabetical order.

  1. Place the 'pico_placing.php' to your Pico install 'plugins' folder.
  2. Add the following line to 'config.php' at the root of your Pico install:
config['pages_order_by'] = 'placing';
  1. Example page meta data:

/* Title: Example page
Author: Jack Jackson
Date: 2014/1/1
Placing: 4 */

pico-placing's People

Contributors

kstenschke avatar ollierik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

pico-placing's Issues

Undefined index on 404 page

The plugin produces errors on the 404 page:
Notice: Undefined index: in /some/path/pico/plugins/PicoPlacing/PicoPlacing.php on line 134
Notice: Undefined index: in /some/path/pico/plugins/PicoPlacing/PicoPlacing.php on line 135

Can be hotfixed by checking for $currentPage in onPagesLoaded:

if ( isset( $currentPage ) ) {
    $curr = $currentPage['placing'];
    
    $keys = array_keys($sorted_pages);
    $keyIndexes = array_flip( $keys );
    
    $prev = ( isset( $keys[ $keyIndexes[ $curr ] - 1 ] ) ) ? $prev = $keys[ $keyIndexes[ $curr ] - 1 ] : FALSE;
    $next = ( isset( $keys[ $keyIndexes[ $curr ] + 1 ] ) ) ? $next = $keys[ $keyIndexes[ $curr ] + 1 ] : FALSE;
    
    $nextPage = ( $next ) ? $sorted_pages[$next] : null;
    $previousPage = ( $prev ) ? $sorted_pages[$prev] : null;
}

not compatible with sitemap, make the plugin working on a level base

Hi,

the first thing, Ive recognized is, that the plugin is not compatible with the sitemap plugin (https://github.com/mcbSolutions/Pico-Plugins/tree/master/mcb_HtmlSitemap). There are pages not shown when Pico-Placing is activ.

The second thing is, that I want to suggest the plugin to work on a level basis not over all levels as it is now. That means the following setting

index.md (Home) Placing: 1
impress.md Placing: 3
verzeichnis/index.md Placing: 4
verzeichnis/test.md
anderes/index.md Placing: 2
anderes/anprobe.md Placing: 2
anderes/probe.md Placing: 3
anderes/wechsel.md Placing: 1

should lead to the following navigation / menu:

  • Home
  • Anderes
    -- Wechsel
    -- Anprobe
    -- Probe
  • Impress
  • Verzeichnis
    -- Test

Who can make this possible?

Regards,
Christian

Not compatible with Pico_Edit plugin Editor

Thanks very much for this plugin, excatly what i'm looking for :)

But if you don't specify any Placing it disapear from Pico_Edit Plugin Editor List.
My suggestion is adding an automatic Placing computation start from 9999 in onPagesLoaded function:

            $i = 1;
            foreach ($pages as $page) {
                
                $sortindex = $page['placing'];
                if (!$sortindex) $sortindex = 9999+$i;
                
                $sorted_pages[$sortindex] = $page;
                $i++;
            }

In this case, untagged "Placing" pages always comes after tagged pages, and will not be ignored by Pico_Edit.
And voila,
Thanks for your reading,
m4pleberry 8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.