Skip to content

Commit

Permalink
Add setContentUri
Browse files Browse the repository at this point in the history
  • Loading branch information
g105b committed Jan 12, 2015
1 parent 4160bf6 commit c1e04b2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Dispatcher/Dispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ public function process() {

// Instantiate the response content object, for manipulation in Code.
$content = $this->createResponseContent($source, $this->response->config);
$this->setContentUri($this->request->uri, $content);
$this->cleanBuffer();

// Only execute Logic if the response is a success.
Expand Down Expand Up @@ -163,7 +164,6 @@ public function process() {
}
}


$manifest = $content->createManifest($this->request, $this->response);
$fileOrganiser = new FileOrganiser($this->response, $manifest);
$fileOrganiser->organise($manifest->pathDetails);
Expand Down
14 changes: 14 additions & 0 deletions src/Dispatcher/PageDispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use \Gt\Core\Path;
use \Gt\Response\NotFoundException;
use \Gt\Page\Transformer;
use \Gt\Response\ResponseContent;

class PageDispatcher extends Dispatcher {

Expand Down Expand Up @@ -197,4 +198,17 @@ public function createResponseContent($html, $config) {
return $domDocument;
}

/**
*
*/
public function setContentUri($uri, ResponseContent $content) {
if(strrpos($uri, "/") === strlen($uri) - 1) {
$uri .= "index";
}
$uri = trim($uri, "/");
$uri = str_replace("/", "_", $uri);
$idUri = $uri;
$content->querySelector("body")->id = $idUri;
}

}#

0 comments on commit c1e04b2

Please sign in to comment.