[limb-svn] r6822 - in 3.x/examples/macro: . examples/expressions examples/tags/core/insert examples/tags/core/repeat examples/tags/form/basic examples/tags/form/select examples/tags/list examples/tags/pager src templates
svn at limb-project.com
svn at limb-project.com
Wed Mar 5 12:24:59 MSK 2008
Author: serega
Date: 2008-03-05 12:24:59 +0300 (Wed, 05 Mar 2008)
New Revision: 6822
URL: http://fisheye.limb-project.com/changelog/limb/?cs=6822
Added:
3.x/examples/macro/compiled.php
Modified:
3.x/examples/macro/examples/expressions/desc.ini
3.x/examples/macro/examples/tags/core/insert/desc.ini
3.x/examples/macro/examples/tags/core/repeat/desc.ini
3.x/examples/macro/examples/tags/form/basic/desc.ini
3.x/examples/macro/examples/tags/form/select/desc.ini
3.x/examples/macro/examples/tags/list/desc.ini
3.x/examples/macro/examples/tags/pager/desc.ini
3.x/examples/macro/showsource.php
3.x/examples/macro/src/examples_utils.inc.php
3.x/examples/macro/templates/example.html
Log:
-- now it's possible to look at the compiled versions of example template
Added: 3.x/examples/macro/compiled.php
===================================================================
--- 3.x/examples/macro/compiled.php (rev 0)
+++ 3.x/examples/macro/compiled.php 2008-03-05 09:24:59 UTC (rev 6822)
@@ -0,0 +1,36 @@
+<?php
+// Crude.
+require './setup.php';
+
+function contains($str, $sub) {
+ return gettype(strpos($str, $sub)) == "integer";
+}
+
+if(!isset($_GET['file']))
+ die('file param is not set!');
+
+$file = $_GET['file'];
+
+if (contains($file, "..") || contains($file, "//") || (substr($file, 0, 1) == '/'))
+ exit;
+
+$filename = './examples/' . $file;
+
+if(!file_exists($filename))
+ exit;
+
+$filename = realpath($filename);
+
+$dir = substr($filename, 0, strpos($filename, 'templates'));
+set_include_path($dir . PATH_SEPARATOR . get_include_path());
+
+$page = new lmbMacroTemplate('phpfile.html');
+$page->set('Filename', $file);
+
+list($compiled_name, ) = $page->compile(realpath($filename));
+
+$highlighted_string = highlight_string(file_get_contents($compiled_name), true);
+
+$page->set('SourceCode', $highlighted_string);
+echo $page->render();
+?>
Modified: 3.x/examples/macro/examples/expressions/desc.ini
===================================================================
--- 3.x/examples/macro/examples/expressions/desc.ini 2008-03-03 11:01:56 UTC (rev 6821)
+++ 3.x/examples/macro/examples/expressions/desc.ini 2008-03-05 09:24:59 UTC (rev 6822)
@@ -3,10 +3,12 @@
[dbes]
description=Complex output expressions
php=array_index.php
+template=templates/1/page.html
0=templates/1/page.html
[php_vars]
description=Output expressions with PHP-variables
php=php_vars.php
+template=templates/2/page.html
0=templates/2/page.html
Modified: 3.x/examples/macro/examples/tags/core/insert/desc.ini
===================================================================
--- 3.x/examples/macro/examples/tags/core/insert/desc.ini 2008-03-03 11:01:56 UTC (rev 6821)
+++ 3.x/examples/macro/examples/tags/core/insert/desc.ini 2008-03-05 09:24:59 UTC (rev 6822)
@@ -3,18 +3,21 @@
[include]
description="Including a file into the current template"
php=include.php
+template=templates/include/page.html
0=templates/include/page.html
1=templates/include/include_file.html
[simple_wrap]
description="Wrapping the contents of the current template into a single slot of other template"
php=simple.php
+template=templates/simple_wrap/page.html
0=templates/simple_wrap/page.html
1=templates/simple_wrap/simple.html
[dynamic]
description="Dynamic wrapping"
php=dynamic.php
+template=templates/simple_wrap/simple.html
0=templates/dynamic/simple.html
4=templates/dynamic/page1.html
4=templates/dynamic/page2.html
@@ -22,12 +25,14 @@
[multiple_wrap]
description="Wraping parts of the current template into multiple slots of other template"
php=multiple.php
+template=templates/multiple_wrap/multiple.html
0=templates/multiple_wrap/multiple.html
1=templates/multiple_wrap/page.html
[nested_wrap]
description="Nested wrapping example"
php=nested.php
+template=templates/nested_wrap/wrap.html
0=templates/nested_wrap/wrap.html
1=templates/nested_wrap/layout.html
2=templates/nested_wrap/page.html
@@ -35,6 +40,7 @@
[wrap_with_include]
description="Example of moving child {{into}} tags into a separate template"
php=multiple_with_include.php
+template=templates/wrap_with_include/wrap.html
0=templates/wrap_with_include/wrap.html
1=templates/wrap_with_include/zones.html
2=templates/wrap_with_include/layout.html
Modified: 3.x/examples/macro/examples/tags/core/repeat/desc.ini
===================================================================
--- 3.x/examples/macro/examples/tags/core/repeat/desc.ini 2008-03-03 11:01:56 UTC (rev 6821)
+++ 3.x/examples/macro/examples/tags/core/repeat/desc.ini 2008-03-05 09:24:59 UTC (rev 6822)
@@ -3,5 +3,6 @@
[simple]
description= "{{repeat}} tag usage example"
php=repeat.php
+template=templates/page.html
1=templates/page.html
Modified: 3.x/examples/macro/examples/tags/form/basic/desc.ini
===================================================================
--- 3.x/examples/macro/examples/tags/form/basic/desc.ini 2008-03-03 11:01:56 UTC (rev 6821)
+++ 3.x/examples/macro/examples/tags/form/basic/desc.ini 2008-03-05 09:24:59 UTC (rev 6822)
@@ -3,9 +3,11 @@
[simple]
description="Basic usage of MACRO form tags."
php=form.php
+template=templates/1/page.html
0=templates/1/page.html
[errors]
description="<form:errors> and <form:field_errors> tags example"
php=form_errors.php
+template=templates/2/page.html
0=templates/2/page.html
Modified: 3.x/examples/macro/examples/tags/form/select/desc.ini
===================================================================
--- 3.x/examples/macro/examples/tags/form/select/desc.ini 2008-03-03 11:01:56 UTC (rev 6821)
+++ 3.x/examples/macro/examples/tags/form/select/desc.ini 2008-03-05 09:24:59 UTC (rev 6822)
@@ -3,9 +3,11 @@
[simple]
description="{{select}} tags usage. Demonstates how to fill options for {{select}} tag"
php=select.php
+template=templates/1/page.html
0=templates/1/page.html
[errors]
description="{{select_options_export}} tag example. This tag allows to create options list for {{select}} tag right in MACRO template"
php=select_options_export.php
+template=templates/2/page.html
0=templates/2/page.html
Modified: 3.x/examples/macro/examples/tags/list/desc.ini
===================================================================
--- 3.x/examples/macro/examples/tags/list/desc.ini 2008-03-03 11:01:56 UTC (rev 6821)
+++ 3.x/examples/macro/examples/tags/list/desc.ini 2008-03-05 09:24:59 UTC (rev 6822)
@@ -3,19 +3,23 @@
[simple]
description="Basic {{list}} and {{list:item}} tags usage example."
php=list.php
+template=templates/simple/page.html
0=templates/simple/page.html
[decorated]
description="{{list}} tag extra variables like parity and counter usage example. This example also shows how to use {{list:even}} and {{list:odd}} tags."
php=list_decorated.php
+template=templates/decorated/page.html
0=templates/decorated/page.html
[separated]
description="{{list:glue}} and {{list:fill}} tags example . These tags allow to output multicolumn lists"
php=list_separated.php
+template=templates/separated/page.html
0=templates/separated/page.html
[default]
description="{{list:empty}} tag example"
php=list_default.php
+template=templates/default/page.html
0=templates/default/page.html
Modified: 3.x/examples/macro/examples/tags/pager/desc.ini
===================================================================
--- 3.x/examples/macro/examples/tags/pager/desc.ini 2008-03-03 11:01:56 UTC (rev 6821)
+++ 3.x/examples/macro/examples/tags/pager/desc.ini 2008-03-05 09:24:59 UTC (rev 6822)
@@ -3,15 +3,18 @@
[elipses]
description=Pager with elipses example.
php=pager_with_elipses.php
+template=templates/elipses/page.html
0=templates/elipses/page.html
[sections]
description=Pager with sections example
php=pager_with_sections.php
+template=templates/sections/page.html
0=templates/sections/page.html
[paginage]
description="{{paginate}} tag example. This tag allows to link pager and list right in MACRO template"
php=paginate_in_template.php
+template=templates/paginate/page.html
0=templates/paginate/page.html
Modified: 3.x/examples/macro/showsource.php
===================================================================
--- 3.x/examples/macro/showsource.php 2008-03-03 11:01:56 UTC (rev 6821)
+++ 3.x/examples/macro/showsource.php 2008-03-05 09:24:59 UTC (rev 6822)
@@ -19,8 +19,6 @@
if(!file_exists($filename))
exit;
-$filecontents = file_get_contents($filename);
-
$page = new lmbMacroTemplate('phpfile.html');
$page->set('Filename', $file);
Modified: 3.x/examples/macro/src/examples_utils.inc.php
===================================================================
--- 3.x/examples/macro/src/examples_utils.inc.php 2008-03-03 11:01:56 UTC (rev 6821)
+++ 3.x/examples/macro/src/examples_utils.inc.php 2008-03-05 09:24:59 UTC (rev 6822)
@@ -178,6 +178,7 @@
$newData['examples'][] = array('description' => $row['description'],
'exec' => "./run.php?file=$root{$row['php']}",
+ 'compiled' => "./compiled.php?file=$root{$row['template']}",
'php_file' => array('path' => "./showsource.php?file=$root{$row['php']}",
'file' => $row['php']),
'templates' => $srcfiles);
Modified: 3.x/examples/macro/templates/example.html
===================================================================
--- 3.x/examples/macro/templates/example.html 2008-03-03 11:01:56 UTC (rev 6821)
+++ 3.x/examples/macro/templates/example.html 2008-03-05 09:24:59 UTC (rev 6822)
@@ -9,6 +9,7 @@
<th>Description</th>
<th>Templates</th>
<th>Php file</th>
+ <th>Generated PHP code</th>
</tr>
</thead>
<tbody>
@@ -27,6 +28,9 @@
<td>
<a href='{$example.php_file.path}'>{$example.php_file.file}</a>
</td>
+ <td>
+ <a href='{$example.compiled}'>Generated PHP code</a>
+ </td>
</tr>
{{/list:item}}
</tbody>
More information about the limb-svn
mailing list