Hi,
I am working on a website and I am having trouble with the index bar. Perhaps this is the way it's supposed to be but I though a PHP meant only having to have one file for all the pages. So,

When I click to a link that gets me to a page inside a folder, the page opens but the menu will not contain the CSS style. Only the raw links.

So I noticed if I include the menu_bar.php inside that folder it will show perfectly with CSS. But now, if I add a new link, I also have to modify the copy of menu_bar.php inside each folder.

I was thinking there may be a problem importing the CSS but not sure what's going on.

bottom line, bar_menu.php will execute CSS in any page in the main HTML directory, but when going to a page that is inside a folder, CSS disappears.

Any ideas?!

Thank you!

Recommended Answers

All 7 Replies

Member Avatar for diafol

Do you have a relative referenced CSS file?
If so, perhaps making it absolute referenced will help:

href="/css/main.css" instead of "css/main.css"

Can you tell me how should it go here?
this is what I got currently

type="text/css">@import url('href="menu/menu_style.css"');</style

Do you have a relative referenced CSS file?
If so, perhaps making it absolute referenced will help:

href="/css/main.css" instead of "css/main.css"

Can you tell me how should it go here?
this is what I got currently

type="text/css">@import url('menu/menu_style.css"');</style

Thank you!

this type="text/css">@import url('menu/menu_style.css"');</style means load the css file inside the menu subfolder of the current folder
doesnt work when you are in a subfolder because the menu folder is no longer a subfolder

<style type="text/css">@import url('/menu/menu_style.css"');</style> 
<style type="text/css">@import url('http://www.yoursite.com/menu/menu_style.css');</style>
<style type="text/css">@import url("<?php echo $_server['document_root']; ?>/menu/menu_style.css");</style>
<link rel="stylesheet" type="text/css" href="http://www.yoursite.com/menu/menu_style.css">
<link rel="stylesheet" type="text/css" href="<?php echo $_server['document_root']; ?>/menu/menu_style.css">
<link rel="stylesheet" type="text/css" href="/menu/menu_style.css">

all work
take your pick

Awesome! thank you

this type="text/css">@import url('menu/menu_style.css"');</style means load the css file inside the menu subfolder of the current folder
doesnt work when you are in a subfolder because the menu folder is no longer a subfolder

<style type="text/css">@import url('/menu/menu_style.css"');</style> 
<style type="text/css">@import url('http://www.yoursite.com/menu/menu_style.css');</style>
<style type="text/css">@import url("<?php echo $_server['document_root']; ?>/menu/menu_style.css");</style>
<link rel="stylesheet" type="text/css" href="http://www.yoursite.com/menu/menu_style.css">,
<link rel="stylesheet" type="text/css" href="<?php echo $_server['document_root']; ?>/menu/menu_style.css">
<link rel="stylesheet" type="text/css" href="/menu/menu_style.css">

all work
take your pick

take your pick

My Fav is this one

<link rel="stylesheet" type="text/css" href="/menu/menu_style.css">
Member Avatar for diafol

Mark as solved?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.