2017 © Pedro Peláez
 

icanboogie-module module-pages

Manages Icybee pages

image

icybee/module-pages

Manages Icybee pages

  • Tuesday, March 13, 2018
  • by olvlvl
  • Repository
  • 1 Watchers
  • 0 Stars
  • 323 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 10 Versions
  • 0 % Grown

The README.md

Pages Build Status

The Pages module (pages) introduces the "Page" content type to the CMS Icybee. Pages are used to created the website tree, display contents and views. The module provides a request dispatcher to serve the pages it manages., (*1)

Blueprint

A blueprint is a simplified data structure representing the relashionship between pages. It provides child/parent relations, parent/children relations, an index, and a tree representation. The blueprint can be created from a Query or can be obtained from the pages model:, (*2)

<?php

#
# Obtain a cached blueprint with only the properties required to build the blueprint: `nid`,
# `parentid`, `is_online`, `is_navigation_excluded`, `pattern`.
#

$blueprint = $core->models['pages']->blueprint($site_id = 1);

$blueprint->relations; // child/parent relations
$blueprint->children;  // parent/children relations
$blueprint->index;     // index
$blueprint->tree;      // pages nested in a tree
$blueprint->model;     // the model associated with the blueprint

Obtaining a subset of a blueprint

A subset can be created from a blueprint, this is interesting when you whish to work with a particuliar branch, or only the nodes that have a maximum depth of 2, or maybe only the online nodes., (*3)

The following example demonstrates how a subset of a blueprint with only the branch of a particuliar branch can be obtained:, (*4)

<?php

$subset = $core->models['pages']->blueprint($site_id = 1)->subset(123);

The following example demonstrates how a subset of a blueprint with nodes that have a maximum depth of 2 can be obtained:, (*5)

<?php

$subset = $core->models['pages']->blueprint($site_id = 1)->subset(null, 2);

The following example demonstrates how subset of a blueprint with only the online nodes can be obtained:, (*6)

<?php

use Icybee\Modules\Pages\BlueprintNode;

$subset = $core->models['pages']
->blueprint($site_id = 1)
->subset(null, null, function(BlueprintNode $node) {

    return !$node->is_online;

});

Populating the blueprint

Once you have obtained a blueprint you might want to populate it with the actual records. The populate() method populates the blueprint by loading the records associated, and updates the nodes of the blueprint with these records. Don't worry about performance, the records are obtained with a single query to the database., (*7)

<?php

$blueprint->populate();

foreach ($blueprint->index as $node)
{
    var_dump($node->record);
}

Obtening and ordered array of nodes or records

Through the ordered_nodes and ordered_records read-only properties you can obtain an array of nodes or records. They are ordered according to their weight and relation., (*8)

<?php

$blueprint->ordered_nodes;   // an array of BluePrintNodes instances
$blueprint->ordered_records; // an array of Page instances

Prototype methods

Icybee\Modules\Sites\Site::lazy_get_home

The home getter is added to instances of Icybee\Modules\Sites\Site. It returns the home page of the instance:, (*9)

<?php

echo "Home page URL: " . $core->site->home->url;

ICanBoogie\Core::get_page

The page getter is added to instances of ICanBoogie\Core. It returns the page currently being displayed. The getter is a shortcut to $core->request->context->page., (*10)


Requirement

The package requires PHP 5.4 or later., (*11)

Installation

The recommended way to install this package is through Composer. Create a composer.json file and run php composer.phar install command to install it:, (*12)

{
    "minimum-stability": "dev",
    "require":
    {
        "icybee/module-pages": "2.x"
    }
}

Cloning the repository

The package is available on GitHub, its repository can be cloned with the following command line:, (*13)

$ git clone git://github.com/Icybee/module-pages.git pages

Testing

The test suite is ran with the make test command. Composer is automatically installed as well as all the dependencies required to run the suite. The package directory can later be cleaned with the make clean command., (*14)

The package is continuously tested by Travis CI., (*15)

Build Status, (*16)

Documentation

The documentation for the package and its dependencies can be generated with the make doc command. The documentation is generated in the docs directory using ApiGen. The package directory can later by cleaned with the make clean command., (*17)

License

This package is licensed under the New BSD License - See the LICENSE file for details., (*18)

The Versions

13/03 2018

4.0.x-dev

4.0.9999999.9999999-dev

Manages Icybee pages

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

page sitemap

29/08 2015
12/09 2014

v2.0.0

2.0.0.0

Manages pages.

  Sources   Download

BSD-3-Clause

The Requires

 

page sitemap

26/06 2014

dev-master

9999999-dev

Manages pages.

  Sources   Download

BSD-3-Clause

The Requires

 

page sitemap

28/10 2013

1.0.x-dev

1.0.9999999.9999999-dev

Manages pages.

  Sources   Download

BSD-3-Clause

The Requires

 

page sitemap