commit 807aa2ef2546c9163f79287d05e6507db7133299
parent 673944a4a974d5d9328797b9c65e7361aff02077
Author: markseu <mark2011@mayberg.se>
Date: Thu, 2 May 2013 20:28:02 +0200
Hello application interface (remix by Datenberater Mark)
Diffstat:
6 files changed, 19 insertions(+), 11 deletions(-)
diff --git a/system/core/core.php b/system/core/core.php
@@ -1,11 +1,11 @@
<?php
-// Copyright (c) 2013 Datenstrom, http://www.datenstrom.se
+// Copyright (c) 2013 Datenstrom, http://datenstrom.se
// This file may be used and distributed under the terms of the public license.
-
+
// Yellow main class
class Yellow
{
- const Version = "0.1.1";
+ const Version = "0.1.2";
var $page; //current page data
var $pages; //current page tree from file system
var $toolbox; //toolbox with helpers
@@ -158,14 +158,21 @@ class Yellow
}
// Execute a template snippet
- function snippet($snippet)
+ function snippet($name, $args = NULL)
{
- $fileName = $this->config->get("snippetDir").$snippet.$this->config->get("systemExtension");
- if(!is_file($fileName)) die("Snippet '$snippet' does not exist!");
+ $this->page->args = func_get_args();
+ $fileName = $this->config->get("snippetDir").$name.$this->config->get("systemExtension");
+ if(!is_file($fileName)) die("Snippet '$name' does not exist!");
global $yellow;
require($fileName);
}
+ // Return template snippet arguments
+ function getSnippetArgs()
+ {
+ return $this->page->args;
+ }
+
// Return extra HTML header lines generated from plugins
function getHeaderExtra()
{
@@ -217,6 +224,7 @@ class Yellow_Page
var $metaData; //meta data of page
var $rawData; //raw data of page (unparsed)
var $rawTextOffsetBytes; //raw text of page (unparsed)
+ var $args; //arguments for template snippet
var $pages; //access to file system
var $active; //page is active?
var $hidden; //page is hidden in navigation?
diff --git a/system/core/core_markdown.php b/system/core/core_markdown.php
@@ -1,5 +1,5 @@
<?php
-// Copyright (c) 2013 Datenstrom, http://www.datenstrom.se
+// Copyright (c) 2013 Datenstrom, http://datenstrom.se
// This file may be used and distributed under the terms of the public license.
// Markdown parser core plugin
diff --git a/system/core/core_rawhtml.php b/system/core/core_rawhtml.php
@@ -1,5 +1,5 @@
<?php
-// Copyright (c) 2013 Datenstrom, http://www.datenstrom.se
+// Copyright (c) 2013 Datenstrom, http://datenstrom.se
// This file may be used and distributed under the terms of the public license.
// Raw HTML parser core plugin
diff --git a/system/core/core_webinterface.js b/system/core/core_webinterface.js
@@ -1,4 +1,4 @@
-// Copyright (c) 2013 Datenstrom, http://www.datenstrom.se
+// Copyright (c) 2013 Datenstrom, http://datenstrom.se
// This file may be used and distributed under the terms of the public license.
// Yellow main API
diff --git a/system/core/core_webinterface.php b/system/core/core_webinterface.php
@@ -1,5 +1,5 @@
<?php
-// Copyright (c) 2013 Datenstrom, http://www.datenstrom.se
+// Copyright (c) 2013 Datenstrom, http://datenstrom.se
// This file may be used and distributed under the terms of the public license.
// Web interface core plugin
diff --git a/system/plugins/example.php b/system/plugins/example.php
@@ -1,5 +1,5 @@
<?php
-// Copyright (c) 2013 Datenstrom, http://www.datenstrom.se
+// Copyright (c) 2013 Datenstrom, http://datenstrom.se
// This file may be used and distributed under the terms of the public license.
// Example plugin