Permalink
Please sign in to comment.
Showing
with
138 additions
and 36 deletions.
- +2 −1 composer.json
- +13 −0 docs/index.md
- +38 −35 lib/Frontend.php
- +22 −0 lib/Model/Menu.php
- +63 −0 page/gui.php
@@ -0,0 +1,13 @@ | ||
+Agile Toolkit Demonstration | ||
+=== | ||
+ | ||
+This demo website is designed to help you learn Agile Toolkit by focusing on a practical examples. Examples are surrounded by a extensive commentary. | ||
+ | ||
+How to use this website | ||
+--- | ||
+ | ||
+Left-side navigation contains links to some of the most popular examples stored here. There are many hidden examples, so do not forget to search the site. | ||
+ | ||
+Below is an interactive demonstration. It contains the PHP source code and result produced by that code. [You can run this example in your local installation of Agile Toolkit](<?link?>learn/install/how<?/link?>). | ||
+ | ||
+You can also download Codepad alltogether with all it's examples and run it on your local computer. [Full sources of codepad are available as open-source](https://github.com/atk4/atk4-codepad). |
63
page/gui.php
@@ -0,0 +1,63 @@ | ||
+<?php | ||
+/** | ||
+ * Created by JetBrains PhpStorm. | ||
+ * User: vadym | ||
+ * Date: 7/19/13 | ||
+ * Time: 4:13 PM | ||
+ * To change this template use File | Settings | File Templates. | ||
+ */ | ||
+class page_gui extends Page { | ||
+ function init() { | ||
+ parent::init(); | ||
+ | ||
+ list($this->md_file,$junk)=explode('.',$_GET['gui']); | ||
+ | ||
+ if ($this->md_file == '') { | ||
+ $this->md_file = 'index'; | ||
+ } | ||
+ | ||
+ $parser = new dflydev\markdown\MarkdownExtraParser(); | ||
+ $html = $parser->transformMarkdown(file_get_contents( | ||
+ $this->api->locatePath('docs',$this->md_file.'.md') | ||
+ )); | ||
+ | ||
+ | ||
+ | ||
+ $html=str_replace('<pre><code>','<?Code?>',$html); | ||
+ $html=str_replace('</code></pre>','<?/Code?>',$html); | ||
+ $html=preg_replace( | ||
+ '/<p><img src="([^"]*)" alt="([^"]*)" \/><\/p>/', | ||
+ '<?Image?>\\1 \\2<?/?>', | ||
+ $html | ||
+ ); | ||
+ | ||
+ | ||
+ $this->template->loadTemplateFromString($html); | ||
+ | ||
+ | ||
+ $page=$this; | ||
+ $page->template->eachTag('Code',function($a,$b) use($page){ | ||
+ $page->add('romaninsh/documenting/View_Example',null,$b)->set($a,true); | ||
+ }); | ||
+ $page->template->eachTag('Example',function($a,$b) use($page){ | ||
+ $page->add('romaninsh/documenting/View_Example',null,$b)->set($a); | ||
+ }); | ||
+ $page->template->eachTag('Image',function($a,$b) use($page){ | ||
+ list($file,$title)=explode(' ',$a,2); | ||
+ $page->add('View',null,$b) | ||
+ ->setElement('image') | ||
+ ->setAttr('src',$page->api->locateURL('public','images/doc/'.dirname($page->page).'/'.$file)) | ||
+ ->setAttr('alt',$title) | ||
+ ->setAttr('title',$title); | ||
+ }); | ||
+ | ||
+ // relative links | ||
+// $page->template->eachTag('link', | ||
+// function(&$a,$b) use ($page) { | ||
+// var_dump($a); | ||
+// var_dump($b); | ||
+// $page->template->set($b,$page->api->url($a)); | ||
+// } | ||
+// ); | ||
+ } | ||
+} |
0 comments on commit
25697e3