Welcome Guest, Not a member yet? Register   Sign In
URI Rerouting? Page staying the same
#1

[eluser]BlackstoneDigital[/eluser]
Hey guys, I can't really explain the problem very well, so I'll just show you!

If you go to my page, http://www.blackstonedigital.co.uk and click the navigation links, you will see the page is staying the same even though the URL is changing.

My index() function (in cms.php, which is the class being called):
Code:
function index() {
                
            if( $this->uri->segment(3) == FALSE ) {
        
                $this->staticpage( 'home' );
            
            }
            
            else {
            
                $this->staticpage( $this->uri->segment(3) );
            
            }
        
        }

I really don't know where I'm going wrong here, any ideas guys?

EDIT: interestingly, if you use /index.php/cms/staticpage/solutions, for example.. it works fine.

My .htaccess file looks like this (this is probably the problem):
Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|common|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]
#2

[eluser]Unknown[/eluser]
When you are using a boolean in the if, you always need 3 =
So:
function index() {

if( $this->uri->segment(3) === FALSE ) {

$this->staticpage( 'home' );

}

else {

$this->staticpage( $this->uri->segment(3) );

}

}

Should work then....

Or just do this:

function index() {

if( !$this->uri->segment(3)) {

$this->staticpage( 'home' );

}

else {

$this->staticpage( $this->uri->segment(3) );

}

}
#3

[eluser]BlackstoneDigital[/eluser]
Thanks for the response, it doesnt explain why it works on my local machine.. I'm convinced its something to do with the .htaccess file that I am using.




Theme © iAndrew 2016 - Forum software by © MyBB