update conduit and documentation on master
This commit is contained in:
parent
3666741755
commit
7d7f0166cf
11 changed files with 172 additions and 9 deletions
51
application/include/conduits/DocConduit.php
Normal file
51
application/include/conduits/DocConduit.php
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
<?php
|
||||
|
||||
use Michelf\MarkdownExtra;
|
||||
use MVC\Classe\Implement\Conduit;
|
||||
|
||||
class DocConduit extends Conduit
|
||||
{
|
||||
// Route('/docs')
|
||||
public function index()
|
||||
{
|
||||
|
||||
$files = array();
|
||||
|
||||
if ($handle = opendir(DATA_PATH . '/docs')) {
|
||||
|
||||
while (false !== ($entry = readdir($handle))) {
|
||||
|
||||
if ($entry != "." && $entry != "..") {
|
||||
|
||||
$files[] = $entry;
|
||||
}
|
||||
}
|
||||
|
||||
closedir($handle);
|
||||
}
|
||||
|
||||
asort($files);
|
||||
|
||||
$this->templateData['page_title'] = 'Foo';
|
||||
$this->templateData['description'] = 'DocConduit';
|
||||
$this->templateData['files'] = $files;
|
||||
|
||||
return $this->render('docs', $this->templateData);
|
||||
}
|
||||
|
||||
// Route('/docs/file/{file}')
|
||||
public function readfile()
|
||||
{
|
||||
|
||||
$markdown = file_get_contents(DATA_PATH . '/docs/' . $this->file);
|
||||
|
||||
$my_html = MarkdownExtra::defaultTransform($markdown);
|
||||
|
||||
$this->templateData['page_title'] = 'Foo';
|
||||
$this->templateData['description'] = 'DocConduit';
|
||||
$this->templateData['data'] = $my_html;
|
||||
|
||||
return $this->render('docs', $this->templateData);
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue