Ejemplo n.º 1
0
 function actionAlter()
 {
     // Create the URL object
     $url = new YDUrl('http://www.yellowduck.be:8080/directory/test/?do=x&id=1#10');
     // Show the original URL
     YDDebugUtil::dump($url->getUrl(), 'The original URL');
     // Get the contents of a query variable
     $do = $url->getQueryVar('do', 'y');
     // Update a query variable
     $url->setQueryVar('do', 'y');
     // setQueryVar can also be used to add a query variable
     $url->setQueryVar('new', 'value');
     // Deleting a query variable
     $url->deleteQueryVar('new');
     // Set a named part
     $url->setNamedPart('host', 'yellowduck.be');
     $url->setNamedPart('user', 'pieter');
     $url->setNamedPart('pass', 'kermit');
     $url->setNamedPart('port', '8081');
     $url->setNamedPart('path', '/dir/index.php');
     $url->setNamedPart('fragment', '12');
     $url->setQueryVar('id', '22');
     // Show the new URL
     YDDebugUtil::dump($url->getUrl(), 'The new URL');
 }
Ejemplo n.º 2
0
 /**
  *  This function returns the path string to a node
  *
  *  @param $separator    Html separator string
  *  @param $classParents Html class for html links of parents
  *  @param $classCurrent Html class for span ( current element )
  *
  *  @returns    An html string
  */
 function getBreadcrum($separator, $classParents, $classCurrent)
 {
     // init array for results
     $res = array();
     // init url object
     $url = new YDUrl(YD_SELF_SCRIPT);
     // cycle elements to get titles
     foreach ($this->getPath() as $elements) {
         // set url var ID to this element
         $url->setQueryVar('id', $elements['component_id']);
         $url->setQueryVar('component', $elements['type']);
         // compute class name
         if ($this->_id != $elements['content_id']) {
             $res[] = '<a class="' . $classParents . '" href="' . $url->getUrl() . '">' . $elements['title'] . '</a>';
         } else {
             $res[] = '<span class="' . $classCurrent . '">' . $elements['title'] . '</span>';
         }
     }
     // return html string
     return implode($separator, $res);
 }