Welcome Guest, Not a member yet? Register   Sign In
[CLOSED] Custom Url Library Class Sub Folder Pickup
#1

[eluser]riwakawd[/eluser]
I am trying to be able to get my custom url library class to pick up link in any folder but can not get it to work.

It works fine like $this->url->link('user);

But will not pick up controller in sub folder $this->link->url('user/user); it shows link OK but not going to it.

Code:
<?php

class Url {

private $host;
private $rewrite = array();

public function __construct($host = '', $ssl = '') {
  $this->host = $host;
  $this->ssl = $ssl;
}

public function addRewrite($rewrite) {
  $this->rewrite[] = $rewrite;
}

public function link($route, $args = '', $secure = false) {
  if (!$secure) {
   $url = $this->host;
  } else {
   $url = $this->ssl;
  }

  $url .= 'index.php' . $route;
  foreach ($this->rewrite as $rewrite) {
   $url = $rewrite->rewrite($url);
  }

  return $url;
}
}




Theme © iAndrew 2016 - Forum software by © MyBB