INCLUDE Page Shortcode

Plugin Name:shortcodes.include (INCLUDE FILE)
Version:0.5
Description:Include other files in current files shortcode for Phile Markup.
Last Update:2013/10/23
Author:jacmgr
Comments: See Comment Section Tags:

Include another page in current page

Requires the shortcodes plugin to be active.

Let's say there exists another file in your site called testinclude.md and it has content that looks like this:


## This is The test include File ### MenuHeading * Item 1 * Item 2 * Item 3 This is the included content...

You can include that page or any other page using the markup:


## This is The test include File
### MenuHeading
* Item 1
* Item 2
* Item 3

This is the included content...

Note that this requires using the pagename with it's extension (this case ".md").

The result of the above markup is:

This is The test include File

MenuHeading

  • Item 1
  • Item 2
  • Item 3

This is the included content...

Basically it merges the two pages before they are passed through the parser.

Break a long Document to sub pages

   **included file: docs/part1 not found** 
   **included file: docs/part2 not found** 
   **included file: docs/part3 not found** 

Core Changes

I added one function to the \Phile\Model\Page class. Needed to get the raw content without the meta for a page object. Here are the 3 methods I added, but this shortcode only uses the getContentRaw() method.

//jacmgr: set some meta
public function setMeta($key, $value) {
    $this->meta->set($key, $value);
}      
    //jacmgr: Get the Content section of file without parsing
public function getContentRaw() {
    return $this->content;
}
    //jacmgr: Get the full page content
public function getRawData() {
    return $this->rawData;
}   

Other formats

WARNING: This is a dangerous shortcode. It can include any file you want into the page. You should not have it active if someone is able to modeify any of your markdown files.

Include php snippet

If the file is not found as a phile markdown file, the shortcode will try to include the file from the php filesystem. You must provide a FULL PATH to the file. To do this I added a config variable for the folder path and allowed it to be used in the parser.

Suppose you have a folder in your content where you store snippets of php that you display in your pages as source php. In the page you can

 **included file: %CONTENT_DIR%/codesnips/sample.01.php not found** 
    or
 **included file: %SYSTEMFOLDER%plugins/jacshortcodes/Classes/Plugin.php not found** 

Results in

<?php

if( (isset ($_GET['source'])) && ($_GET['source'] == 'true')) 
{
    $config['theme'] = $config['editor']['theme'];
}       

// ===========================================================
// it is important to return the $config array!
return $config;

Or include a markdown from another non-content location. AS long as it is a markdown file, we don't have to include the full path.

 Phile-Blog-Theme
================

This is a theme developed to showcase how blogging works on [Phile](https://github.com/PhileCMS).

### Disclaimer

Please use a fresh Phile installation in order to avoid errors not associated with this theme/demo.

### Installation

First, [download this repo](https://github.com/james2doyle/Phile-Blog-Theme/archive/master.zip) and drop the folder into the root directory that Phile was installed into.

The following changes need to be made to your config.php file in order for this theme to work normally:

```php
// set the theme for this installation
$config['theme'] = 'blog';

// set some defaults for the pages
$config['date_format'] = 'jS F, Y'; // 11th November, 2013
$config['pages_order_by'] = 'date'; // this is a blog so date ordering
$config['pages_order'] = 'desc';

// disable the cache for this theme since we are in development
$config['plugins'] = array(
  'philePhpFastCache' => array('active' => false),
  'phileSimpleFileDataPersistence' => array('active' => false)
);

return $config;
```

Results in

Phile-Blog-Theme

This is a theme developed to showcase how blogging works on Phile.

Disclaimer

Please use a fresh Phile installation in order to avoid errors not associated with this theme/demo.

Installation

First, download this repo and drop the folder into the root directory that Phile was installed into.

The following changes need to be made to your config.php file in order for this theme to work normally:

// set the theme for this installation
$config['theme'] = 'blog';

// set some defaults for the pages
$config['date_format'] = 'jS F, Y'; // 11th November, 2013
$config['pages_order_by'] = 'date'; // this is a blog so date ordering
$config['pages_order'] = 'desc';

// disable the cache for this theme since we are in development
$config['plugins'] = array(
  'philePhpFastCache' => array('active' => false),
  'phileSimpleFileDataPersistence' => array('active' => false)
);

return $config;