Forum Moderators: not2easy

Message Too Old, No Replies

Overriding the style sheet of a PHP include

CSS, php include

         

SugarSheila

3:09 am on Aug 24, 2009 (gmt 0)

10+ Year Member



Hello. Does anyone know of a method of overriding the associated style sheet of a PHP include?

My issue is that I will like to have a blog appear within the confines of an established layout. The layout file reads an external .css file. When I use the php include, the page comes out using the attributes associated with the CSS from the include. Is there a way to mandate that the CSS that I have established in the external css file be used?

D_Blackwell

4:07 am on Aug 24, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Short answer is almost certainly yes, but the how depends on what CSS is coming from where and the easiest way to get the needed results.

#1 - Why can't you get at the CSS from the include? If in the include itself, just edit that page. If calling an external CSS file, edit that file. Is there an access issue? If so, why?

#2 - Would be a lot uglier. My first choice would be to do everything to avoid 'overriding', but to simply edit the styles associated with the PHP include. Much cleaner now - and down the road it could save even worse hassles.

SugarSheila

3:37 pm on Aug 24, 2009 (gmt 0)

10+ Year Member



The issue is that Blogger's assosiated code has become far more complicated than it was say 5 years ago. Therefore, I used to be able to modify blogger's template and then tell blogger to upload to my server. After working on it for 3 hours, I looked into php includes which would require just one line of code, but the CSS from the include messes up everything else. I wonder if I try inline css, whether it will help.

D_Blackwell

12:40 am on Aug 25, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I looked into php includes which would require just one line of code, but the CSS from the include messes up everything else. I wonder if I try inline css, whether it will help.

1) If you just need to add one line of code to a PHP include, add the CSS inline there - rather than having to go though the hassle of adding to how many pages.
<div style="text-decoration: blink;">TEXT</div>

2) Yes, you could probably skip the PHP include and override with inline CSS or internal stylesheet on each page. If you can override inline, then I would do it with the PHP include. You probably wouldn't be suggesting it if this did not affect a bunch of pages.