- documentation
This commit is contained in:
Emmanuel ROY 2021-07-12 16:10:05 +02:00
commit d69e72165d
2 changed files with 40 additions and 6 deletions

View file

@ -26,8 +26,8 @@ class DocConduit extends Conduit
asort($files);
$this->templateData['page_title'] = 'Foo';
$this->templateData['description'] = 'DocConduit';
$this->templateData['page_title'] = 'Sommaire de la documentation du Framework';
$this->templateData['description'] = 'Sommaire, Documentation, SAND, Framework';
$this->templateData['files'] = $files;
return $this->render('docs', $this->templateData);
@ -37,13 +37,39 @@ class DocConduit extends Conduit
public function readfile()
{
\MVC\Object\Session::createAndTestSession();
$files = array();
if ($handle = opendir(DATA_PATH . '/docs')) {
while (false !== ($entry = readdir($handle))) {
if ($entry != "." && $entry != "..") {
$files[] = $entry;
}
}
closedir($handle);
}
asort($files);
$key_file = array_search($this->file,$files);
$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['page_title'] = 'Documentation du Framework';
$this->templateData['description'] = 'Documentation, SAND, Framework';
$this->templateData['data'] = $my_html;
if(isset($files[$key_file - 1])) {
$this->templateData['previous'] = $files[$key_file - 1];
}
if(isset($files[$key_file + 1])) {
$this->templateData['next'] = $files[$key_file + 1];
}
return $this->render('docs', $this->templateData);

View file

@ -6,14 +6,22 @@
@section('content')
@if (isset($files))
<h1>Sommaire:</h1>
@foreach( $files as $file)
<a href="{{ \MVC\Classe\Url::link_rewrite( false, 'docs', ['file'=>$file]) }}">{{ $file }}</a> <br/>
@endforeach
@endif
@if (isset($data))
<div style="display:block;position:relative;width:450px;margin:auto;">
@if (isset($previous))<a href="{{ \MVC\Classe\Url::link_rewrite( false, 'docs', ['file'=>$previous]) }}" class="btn btn-outline-info"> &laquo; Précedent</a>@endif
<a href="{{ \MVC\Classe\Url::link_rewrite( false, 'docs', []) }}" class="btn btn-info">Sommaire</a>
@if (isset($next))<a href="{{ \MVC\Classe\Url::link_rewrite( false, 'docs', ['file'=>$next]) }}" class="btn btn-outline-info">Suivant &raquo; </a>@endif
</div>
{{$data}}
<div style="display:block;position:relative;width:450px;margin:auto;">
@if (isset($previous))<a href="{{ \MVC\Classe\Url::link_rewrite( false, 'docs', ['file'=>$previous]) }}" class="btn btn-outline-info"> &laquo; Précedent</a>@endif
<a href="{{ \MVC\Classe\Url::link_rewrite( false, 'docs', []) }}" class="btn btn-info">Sommaire</a>
@if (isset($next))<a href="{{ \MVC\Classe\Url::link_rewrite( false, 'docs', ['file'=>$next]) }}" class="btn btn-outline-info">Suivant &raquo; </a>@endif
</div>
@endif
@endsection