Jump to content

Need help with switch/case


gaza165

Recommended Posts

I have a switch/case page included in my index.php to load all the different pages of the site from one page based on the url so like this.

 

 

www.domain.com?case=showblog

www.domain.com?case=default

 

i am also using mod_rewrite to make the urls prettier

 

www.domain.com/showblog

 

the problem i am having is with the navigation. if my a href is index.php that should take me to the home page.

 

however, if im on www.domain.com/showblog,

 

it shows the page correctly but the navigation is wrong as it tries to find.... showblog/index.php and doesnt go back to the root index.php

 

can anyone help??

Link to comment
https://forums.phpfreaks.com/topic/138014-need-help-with-switchcase/
Share on other sites

is there any reason why my css is not showing.. it seems to be referencing the file wrong..

 

this is my htaccess file.

 

 

Options -Indexes
RewriteEngine On

RewriteRule ^([_\+A-Za-z0-9]+)/([_\+A-Za-z0-9]+)?$ index.php?c=$1&title=$2  

is there any reason why my css is not showing.. it seems to be referencing the file wrong..

 

this is my htaccess file.

 

 

Options -Indexes
RewriteEngine On

RewriteRule ^([_\+A-Za-z0-9]+)/([_\+A-Za-z0-9]+)?$ index.php?c=$1&title=$2  

 

Look at what ProjectFear wrote. Use the Absolute Paths not Relative.

 

If you want it to still be dynamic,

$siteURL = "http://" . $_SERVER['HTTP_HOST'] . "/";

 

gives you the full path to the initial folder and use that instead of ../ it would be

echo '<link href="' . $siteURL . 'css/style.css" />';

 

Or you can place the $siteURL in the base HTML tag path and remove any ../ in the code.

 

An absolute path

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.