+ added the tsurl object that we'll use for url generating
[vsc.git] / _res / _libs / tsurl.class.php
blobbf26fcd5d9acb440fe26ce5b5291fd3a3a07f42b
1 <?php
2 /**
3 * TODO: if (stristr ($topic, '~')) {
4 * $topic = ??; // TBD
5 * $major = 'user';
6 * $title = substr($topic, 1);
7 * }
8 */
9 // will generate : http://base_url/topic/major/title/minor1/1/minor2/2
10 define ('FRIENDLY' , 1);
11 // will generate : http://base_url/?NAV_VAR=topic&major=title&minor1=1&minor2=2
12 define ('REGULAR' , 2);
14 /**
15 * Object to generate URLs
18 class tsUrl {
19 public $options = array ();
20 private $method = REGULAR;
22 /**
23 * The URL components
25 protected $topic, // REGULAR : NAV_VAR=$topic | FRIENDLY : /$topic/
26 $major, // REGULAR : &amp;$major=$title
27 $title, // FRIENDLY : ../$major/$title
28 $minor; // TBD
30 public function __construct ($opt = null) {
31 if (is_null ($opt)) {
32 if (defined('BASE_URL'))
33 $options['base'] = BASE_URL;
34 else
35 $options['base'] = '';
40 public function __destruct () {
44 /**
45 * method to return the url as a string
48 public function __toString () {
52 /**
53 * method to generate an friendly URL slug
55 public function buildSlug () {
59 /**
60 * method to return the URL based on $method
62 * TODO: find a method to overlook folders
64 public function setRequest () {
65 // generating friendly URLs
66 if ($this->method == FRIENDLY) {
68 } else {