Be a Supporter!

PHP include acceptable for css?

  • 413 Views
  • 16 Replies
New Topic Respond to this Topic
DarkScythes
DarkScythes
  • Member since: May. 20, 2005
  • Offline.
Forum Stats
Member
Level 10
Blank Slate
PHP include acceptable for css? 2007-07-30 15:43:52 Reply

I know the way you are supposed to include external css is <link>, but it's been conflicting with my php code when I use the <link> tag for some reason.

Would I be breaking some standard or something by using <? include('cssfile.css'); ?> instead of just importing it through <link>?

I don't think it would be inefficient or wouldn't work right, but I haven't heard of anyone doing it like that before and I wanted to check before I base an entire site's style off of that method of importing.

authorblues
authorblues
  • Member since: Jun. 21, 2005
  • Offline.
Forum Stats
Member
Level 12
Blank Slate
Response to PHP include acceptable for css? 2007-07-30 15:45:34 Reply

At 7/30/07 03:43 PM, DarkScythes wrote: I don't think it would be inefficient or wouldn't work right, but I haven't heard of anyone doing it like that before and I wanted to check before I base an entire site's style off of that method of importing.

please explain how its conflicting with your PHP, and give us a sample of your code. css files are done externally so that they can be cached. its much quicker to load a page when the viewer has already saved all of the pertinent stylistic information.


BBS Signature
DarkScythes
DarkScythes
  • Member since: May. 20, 2005
  • Offline.
Forum Stats
Member
Level 10
Blank Slate
Response to PHP include acceptable for css? 2007-07-30 15:50:34 Reply

<h2>ShoutBox</h2>
<p>
<form method = 'post' action = 'index.php'>
Name: <input type = 'text' name = 'name' class = 'textarea' /><br />
Msg: <textarea name = 'msg' rows = '4' cols = '15' class = 'textarea'></textarea><br />
<input type = 'submit' value = 'Submit' name = 'submitBtn' class = 'submitBtn' onClick = '<? shoutbox(); ?>' ><br />
</form>
</p>
<p>
<? echo($fData); ?>
</p>

that's the form code. and when I click the submit button to run the shoutbox function which adds the user input into a flat file. $fData is the information from the file.

When I click the button sometimes it'll (normally only in firefox) strip the <link> tag for some reason and the entire page will just be pure html.

authorblues
authorblues
  • Member since: Jun. 21, 2005
  • Offline.
Forum Stats
Member
Level 12
Blank Slate
Response to PHP include acceptable for css? 2007-07-30 15:54:14 Reply

At 7/30/07 03:50 PM, DarkScythes wrote: <h2>ShoutBox</h2>
that's the form code. and when I click the submit button to run the shoutbox function which adds the user input into a flat file. $fData is the information from the file.

lovely form and all, but that didnt contain what shoutbox() was, nor where your <link> was, nor really the overlying structure of your page.

When I click the button sometimes it'll (normally only in firefox) strip the <link> tag for some reason and the entire page will just be pure html.

that may have something to do with the javascript youre using in the onClick (should be onclick) property. that may be any number of things, but im confused if youre aware of what the onclick is meant for, since it seems to ME like you have no clue. you can only use that handler for js.


BBS Signature
DarkScythes
DarkScythes
  • Member since: May. 20, 2005
  • Offline.
Forum Stats
Member
Level 10
Blank Slate
Response to PHP include acceptable for css? 2007-07-30 16:05:58 Reply

the <link> is in the head

and as to what the function does "that's the form code. and when I click the submit button to run the shoutbox function which adds the user input into a flat file."

I can tell I doubt I'm going to get much help on this one :/ I'll just rewrite the entire code in a different way and hope it works.

Thanks for explaining the onclick/javascript thing though (:

DarkScythes
DarkScythes
  • Member since: May. 20, 2005
  • Offline.
Forum Stats
Member
Level 10
Blank Slate
Response to PHP include acceptable for css? 2007-07-30 16:29:45 Reply

okok, disregard my last post. I made a little example of what happens. (You might need firefox for it to work).

http://jelix.heliohost.org/testing/index .php

Just click the submit button on that page. It's just a simple form with not even any code or anything in it, but when you use it, it strips the <link> out and makes the CSS code on the page not import.

That's what I was trying to explain.

different
different
  • Member since: Jul. 8, 2004
  • Offline.
Forum Stats
Member
Level 35
Blank Slate
Response to PHP include acceptable for css? 2007-07-30 16:30:56 Reply

Side note: As echo is a language construct and not a function, it doesn't need the parentheses.


> twitter.

DarkScythes
DarkScythes
  • Member since: May. 20, 2005
  • Offline.
Forum Stats
Member
Level 10
Blank Slate
Response to PHP include acceptable for css? 2007-07-30 16:31:50 Reply

sorry for the triple post (really >>;) but you might have to refresh the page once before it strips the tag.

DannyIsOnFire
DannyIsOnFire
  • Member since: Apr. 14, 2005
  • Offline.
Forum Stats
Member
Level 21
Movie Buff
Response to PHP include acceptable for css? 2007-07-30 16:31:51 Reply

Works fine for me.
Using latest version of Firefox by the way.


|| Portfolio || Facebook || Twitter ||

BBS Signature
DannyIsOnFire
DannyIsOnFire
  • Member since: Apr. 14, 2005
  • Offline.
Forum Stats
Member
Level 21
Movie Buff
Response to PHP include acceptable for css? 2007-07-30 16:33:32 Reply

At 7/30/07 04:31 PM, DarkScythes wrote: sorry for the triple post (really >>;) but you might have to refresh the page once before it strips the tag.

Ah... disregard my last post.


|| Portfolio || Facebook || Twitter ||

BBS Signature
elbekko
elbekko
  • Member since: Jul. 23, 2004
  • Offline.
Forum Stats
Member
Level 16
Blank Slate
Response to PHP include acceptable for css? 2007-07-30 16:33:57 Reply

Apart from the, obivously automatically prepended, ad, the style seems to be before the html, not in the head.


"My software never has bugs. It just develops random features. " - Unknown

[ FluxBB developer | Quickmarks 0.5.1 | Strings & Ints - my blog ]

BBS Signature
DarkScythes
DarkScythes
  • Member since: May. 20, 2005
  • Offline.
Forum Stats
Member
Level 10
Blank Slate
Response to PHP include acceptable for css? 2007-07-30 16:36:11 Reply

Works fine for me.

try refreshing the page after you submit. It normally will pop up with a message telling me that I am using POSTDATA and when I click ok it refreshes the page but deactivates the <link> tag.

Side note: As echo is a language construct and not a function, it doesn't need the parentheses.

I know, but it just is easier for me to use parentheses because it seems more organized for me :/

DarkScythes
DarkScythes
  • Member since: May. 20, 2005
  • Offline.
Forum Stats
Member
Level 10
Blank Slate
Response to PHP include acceptable for css? 2007-07-30 16:38:05 Reply

I tried moving it above the html to see if that fixed anything and it didn't :/ It's back in the head now though.

Do you think it's the ad that's doing it or something?

different
different
  • Member since: Jul. 8, 2004
  • Offline.
Forum Stats
Member
Level 35
Blank Slate
Response to PHP include acceptable for css? 2007-07-30 16:40:00 Reply

At 7/30/07 04:36 PM, DarkScythes wrote: I know, but it just is easier for me to use parentheses because it seems more organized for me :/

It's not wrong. ;-)

Usually syntax highlighters do a good job of organising.. and you can also use comment blocks to separate your code out, they're nice.


> twitter.

authorblues
authorblues
  • Member since: Jun. 21, 2005
  • Offline.
Forum Stats
Member
Level 12
Blank Slate
Response to PHP include acceptable for css? 2007-07-30 16:47:51 Reply

At 7/30/07 04:29 PM, DarkScythes wrote: That's what I was trying to explain.

PLEASE tell me why you are listing properties as propertyname = "something"?
there are to be no spaces around the equal sign. (propertyname="something")


BBS Signature
DarkScythes
DarkScythes
  • Member since: May. 20, 2005
  • Offline.
Forum Stats
Member
Level 10
Blank Slate
Response to PHP include acceptable for css? 2007-07-30 22:53:29 Reply

once again. Organization.
Apparently I've been doing a lot of bad coding techniques for the sake of organization D:

I'll fix it.

DarkScythes
DarkScythes
  • Member since: May. 20, 2005
  • Offline.
Forum Stats
Member
Level 10
Blank Slate
Response to PHP include acceptable for css? 2007-07-30 22:55:03 Reply

._.
I fixed the space problem but still my css is messed up every time I submit the form and refresh.