PHP code example of michalsn / codeigniter-markdown-pages

1. Go to this page and download the library: Download michalsn/codeigniter-markdown-pages library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

michalsn / codeigniter-markdown-pages example snippets


$markdownPages = services('markdownpages', ROOTPATH . 'content');

$dir = $markdownPages->dirs()->first();

echo $dir->getName()
// prints: Quick Start

echo $dir->getSlug()
// prints: quick-start

foreach($dir->getFiles()->items() as $file) {
    echo $file->getName();
    // prints: Installation

    echo $file->getSlug();
    // prints: installation

    echo $file->getPath();
    // prints: quick-start/installation

    echo $content->parse()->getContent();
    // prints: parsed markdown from file

    echo $content->parse()->getMeta();
    // prints: parsed YAML as key -> value
}