Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Finally refreshed my borked hydrogen repo ... #14

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions controller/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,7 @@ public function start() {
}
// Is this exact route cached?
if ($this->doRouteCache &&
$rule = $cm->get("Router:" . $this->name . ":$path")) {
$rule = $cm->get("Router:" . $this->name . ':' . $_SERVER['REQUEST_METHOD'] . ":$path")) {
$success = $this->passRequest($rule['controller'],
$rule['function'], $rule['args'], $rule['argProtect']);
if ($success)
Expand Down Expand Up @@ -880,7 +880,7 @@ public function start() {
if ($success) {
// Cache the route
if ($this->doRouteCache) {
$cm->set("Router:" . $this->name . ":$path", array(
$cm->set("Router:" . $this->name . ':' . $_SERVER['REQUEST_METHOD'] . ":$path", array(
'controller' => $vars[self::KEYWORD_CONTROLLER],
'function' => $vars[self::KEYWORD_FUNCTION],
'args' => $args,
Expand Down
25 changes: 25 additions & 0 deletions view/engines/hydrogen/nodes/AppendNode.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php
/*
* Copyright (c) 2009 - 2012, Frosted Design
* All rights reserved.
*/

namespace hydrogen\view\engines\hydrogen\nodes;

use hydrogen\view\engines\hydrogen\Node;
use hydrogen\view\engines\hydrogen\PHPFile;
use hydrogen\config\Config;

class AppendNode implements Node {
protected $variable;

public function __construct($variable) {
$this->variable = &$variable;
}

public function render($phpFile) {
$phpFile->addPageContent(file_get_contents($this->variable));
}
}

?>
35 changes: 35 additions & 0 deletions view/engines/hydrogen/tags/AppendTag.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
/*
* Copyright (c) 2009 - 2012, Frosted Design
* All rights reserved.
*/

namespace hydrogen\view\engines\hydrogen\tags;

use hydrogen\view\engines\hydrogen\Tag;
use hydrogen\view\engines\hydrogen\Lexer;
use hydrogen\view\engines\hydrogen\nodes\AppendNode;
use hydrogen\view\engines\hydrogen\nodes\VariableNode;
use hydrogen\view\engines\hydrogen\exceptions\TemplateSyntaxException;
use hydrogen\config\Config;

class AppendTag extends Tag {

public static function getNode($cmd, $args, $parser, $origin) {
if (empty($args) || strpos($args, ' ') !== false) {
throw new TemplateSyntaxException(
'Tag "append" in template "' . $origin .
'" requires a single file name as an argument.');
}
$file = Config::getBasePath() . '/' . Config::getVal("view", "folder") . '/' . $args;
if (!file_exists($file)) {
throw new TemplateSyntaxException(
'Tag "append" in template "' . $origin .
'" requires the file specified exists.');
}
return new AppendNode($file);
}

}

?>