PHP Classes

File: system/modules/url/info.xml

Recommend this page to a friend!
  Classes of Mihajlo Siljanoski  >  Xmodule  >  system/modules/url/info.xml  >  Download  
File: system/modules/url/info.xml
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Xmodule
Modular Web application development framework
Author: By
Last change:
Date: 7 years ago
Size: 2,139 bytes
 

Contents

Class file image Download
<module>
    <name>URL</name>
    <description>URL module can be used for URL helping, redirections, handling URI segments etc.</description>
    <example>
        <init>$url=module('url');</init>
        <return>$url will return object with a lot methods.</return>
        <code>
            <pre>
<?php
    
    //init url module
    $url=module('url');
    
    //example of use base_url() method
    $url->base_url();
    
    //will return base path of framework instalation ex. http://localhost/mysite/
                
?>
            </pre>
        </code>
        
        <code>
            <pre>
<?php
    
    //init url module
    $url=module('url');
    
    //example of use current_url() method
    $url->current_url();
    
    //will return current url path of currently opened page 
    //ex. http://localhost/mysite/products/school/notebook?id=1
                
?>
            </pre>
        </code>
        <code>
            <pre>
<?php
    
    //init url module
    $url=module('url');
    
    //example of use site_url() method
    $url->site_url('products/school');
    
    //will return base path with page URI path 
    //ex. http://localhost/mysite/products/school
                
?>
            </pre>
        </code>
        
        <code>
            <pre>
<?php
    
    //init url module
    $url=module('url');
    
    //example of use redirect() method
    if(/* check for logged user */){
        //some code
    }
    else{
        $url->redirect('user/login');
    }
                
?>
            </pre>
        </code>
        
        
        <code>
            <pre>
<?php
    
    //init url module
    $url=module('url');
    
    //example of use segment() method
    $url_segment=$url->segment(4);
    
    //if we have url like this http://mypage.com/category/products/school/notebook/cart
    //$url_segment will be notebook , 5 will be cart, 2 will be products etc...
    
                            
?>
            </pre>
        </code>
        
    </example>
</module>
<author>
    <name>Mihajlo Siljanoski</name>
    <web>https://mk.linkedin.com/in/msiljanoski</web>
</author>
For more information send a message to info at phpclasses dot org.