Permalink
Browse files

Modify 'absolute' twig method to work from subdirs

  • Loading branch information...
1 parent dfd30f6 commit c117adf738974c54cbe95aeb8588ef830554df9f @kolber committed Apr 27, 2012
Showing with 4 additions and 4 deletions.
  1. +4 −4 extensions/twig-extensions.inc.php
View
8 extensions/twig-extensions.inc.php
@@ -40,7 +40,7 @@ public function getFunctions() {
public function var_dumper($input) {
var_dump( $input );
}
-
+
#
# dump out our var for easy debugging ++ Now with Extra Pre's
#
@@ -131,13 +131,13 @@ function sortby($object, $value) {
uasort($sorted, array($this, 'custom_str_sort'));
return $sorted;
}
-
+
#
# transforms relative path to absolute
#
function absolute($relative_path) {
- # assume that all content lies in http://something.com/content/
- return (($_SERVER['HTTPS'] ? 'https://' : 'http://')).$_SERVER['HTTP_HOST'].strstr($relative_path, '/content');
+ $server_name = (($_SERVER['HTTPS'] ? 'https://' : 'http://')).$_SERVER['HTTP_HOST'];
+ return $server_name.str_replace('/index.php', strstr($relative_path, '/content'), $_SERVER['SCRIPT_NAME']);
}
}

0 comments on commit c117adf

Please sign in to comment.