Skip to content

Commit

Permalink
Fix URL generation
Browse files Browse the repository at this point in the history
  • Loading branch information
bergie committed Oct 4, 2010
1 parent f94cf14 commit 678704c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
6 changes: 3 additions & 3 deletions controllers/cache.php
Expand Up @@ -13,9 +13,9 @@
*/
class midgardmvc_core_controllers_cache
{
public function __construct()
public function __construct($request)
{
$this->configuration = midgardmvc_core::get_instance()->configuration;
$this->request = $request;
}

public function get_invalidate(array $args)
Expand All @@ -25,7 +25,7 @@ public function get_invalidate(array $args)
midgardmvc_core::get_instance()->context->cache_enabled = false;
midgardmvc_core::get_instance()->head->relocate
(
midgardmvc_core::get_instance()->dispatcher->generate_url($this->request, 'page_read', array())
midgardmvc_core::get_instance()->dispatcher->generate_url('page_read', array(), $this->request)
);
}

Expand Down
6 changes: 5 additions & 1 deletion request.php
Expand Up @@ -91,12 +91,16 @@ public function resolve_node($path)
/**
* Get the request path
*/
public function get_path()
public function get_path($include_arguments = true)
{
if (substr($this->path, -1, 1) !== '/')
{
$this->path .= '/';
}
if (!$include_arguments)
{
return $this->path;
}
return $this->path . implode('/', $this->argv);
}

Expand Down
2 changes: 1 addition & 1 deletion services/dispatcher/midgard3.php
Expand Up @@ -321,7 +321,7 @@ public function generate_url($route_id, array $args, $intent)

//echo ("Deleting context " . $this->midgardmvc->context->get_current_context());
$this->midgardmvc->context->delete();
return preg_replace('%/{2,}%', '/', $request->get_path() . $link);
return preg_replace('%/{2,}%', '/', $request->get_path(false) . $link);
}

public function get_midgard_connection()
Expand Down

0 comments on commit 678704c

Please sign in to comment.