Forum Moderators: coopster

Message Too Old, No Replies

includes wont read stylesheet

includes/stylesheet

         

meanweaver

8:42 pm on Feb 3, 2004 (gmt 0)

10+ Year Member



I am totally new to php, To make upkeep easy I have added the navigation my pages as an include, Now this appears fine and works well, However I also have a stylesheet to change the color of the links on mouseover, but the includes file does nothing when rolled over, I know the the rest of the page reads the stylesheet ok as a couple of links not connected with the incude file work as they should. I wonder if I am having some php begineer trouble here.
Any ideas welcome.

Regards Ian

henry0

10:23 pm on Feb 3, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



where is your CSS? is it set as external or embeded
I had better results with external and it is easier to use.

in the head:
<<<
<link rel=stylesheet href="idx1.css" type="text/css">
>>> where idx1 is my sheet's name

then do not include your div within your nav bar and try
<<<
<div class="intro15">
<?php
include("includes/what_is.inc.php");
?>
</div>
>>>
as is the whole include is driven by the div class

hope it helped
Henry

Edit:
sorry: should have told you that "what_is.inc.php"
will be your nav_bar.inc.php

meanweaver

11:47 pm on Feb 3, 2004 (gmt 0)

10+ Year Member



hi there,

Yes I am using an external css, the include file is in html and has the extension of nav.php only.

I dont really understand this bit

<<<
<div class="intro15">
<?php include("includes/what_is.inc.php");
?>
</div>

Not sure where the div tag comes in, do i put it on the html page where the php include command is, not sure how this fits in the stylesheet.

Regards Ian

ksponline

1:13 am on Feb 4, 2004 (gmt 0)

10+ Year Member



I'm sure as my knowledge of php grows (hopefully), I will improve on things, but I did mine this way...

I called out my navigation like so:

<!-- Begin Left Navigation -->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr align="left" valign="top">
<?php require ("nav.php");?>
etc.

and I did my <div class="nav"> in the include file (because it's a mixture of graphics and links), so the div is for the links.

but, in other websites I've set up, just text is in the include file, and the text (and link behavior) is styled by an external style sheet.

Maybe you can post a little but of your style sheet and your code surrounding the include?

henry0

11:58 am on Feb 4, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



<<<
I dont really understand this bit

<<<
<div class="intro15">
<?php
include("includes/what_is.inc.php");
?>
</div>

Not sure where the div tag comes in, do i put it on the html page where the php include command is, not sure how this fits in the stylesheet.
>>>

Yes this snippet of code goes in the html.
You are surrounding the php script with the <div>
that will provide CSS action to the whole nav bar
again in the example my div is named "intro15"
and yours is whatever name you came with.
what do you mean by "not sure how this fits in the stylesheet"

could you post a sample of the html that includes the
PHP nav_bar include.

meanweaver

11:24 pm on Feb 4, 2004 (gmt 0)

10+ Year Member



Things are starting to make sense (slowly) Being so new to php it was putting the div tag in with the php code which confused me, but here what i am putting inside the table where i want the nav to appear,

<?PHP include("includes/menu.php")?>

Then in my external stylesheet i have this,

A {font-weight: normal; background: none; color: #0000FF; text-decoration: none;}
A:hover {font-weight: normal; background: none; color: #FFFFFF; text-decoration: none;}

And this is all I have done, so the menu appears and works fine but ut would be nice to get the rollover effect, Thanks for all reply so far,

Regards Ian

henry0

12:09 am on Feb 5, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Ian, are you sure that your external sheet is ref to in the head as:

<<<
<link rel=stylesheet href="idx1.css" type="text/css">
>>> where idx1 is my sheet's name

and that your div starts above the include
and end after the include

you might have a CSS problem
please post in the CSS forum
good luck
Henry

meanweaver

9:37 pm on Feb 5, 2004 (gmt 0)

10+ Year Member



my external style sheet does start <link rel=ect.

As of yet i had no div at all in the code. I am hoping thats the missing link i need to make my include page start reading the stylesheet, I have just been so busy wont have time to play with that site untill the weekend, but will let you know if it works.
I will add a div class of say <div class="nav"> in my file then in my style sheet put div.nav followed by my stlye rules and then the php include knows to look at the stylesheet.
I think this is what your all telling me, so this is kind of a php/css borderline case.
Will let you know how i get on soon. Thanks for your support all the grateful.

Reflection

12:50 am on Feb 6, 2004 (gmt 0)

10+ Year Member



I would suggest forgetting about php for a minute. Have a look at the source code from your browser(view source). This will give you what the browser is receiving. You can then check the html for what might be causing the problem.

g1smd

9:58 pm on Feb 6, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Run the page through: [validator.w3.org...] and [jigsaw.w3.org...] and see what you get.