includes and css

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
bloodl
Forum Commoner
Posts: 48
Joined: Thu Jun 21, 2007 12:33 am

includes and css

Post by bloodl »

Hi,

I have a php include which happens to be an external URL. It loads fine, but the css isn't there. I can see why that happened, because the include file is including other files which are relative (such as the css). What do people usually do to get around this? PHP setting? Adidtional includes?

Cheers,
Doug
User avatar
aceconcepts
DevNet Resident
Posts: 1424
Joined: Mon Feb 06, 2006 11:26 am
Location: London

Re: includes and css

Post by aceconcepts »

You could set an "include from" variable and use it in a conditional statement within the included file.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: includes and css

Post by John Cartwright »

preg_replace() on all the urls, and replacing the relative links to absolute links.

However, if you use PCRE I recall there being a a fairly hittable limit to the input size you can input (especially if it's an html page). In that case, I would recommend you split the file into chunks, using file(), array_chunk(), and implode() to reassemble the string.
bloodl
Forum Commoner
Posts: 48
Joined: Thu Jun 21, 2007 12:33 am

Re: includes and css

Post by bloodl »

aceconcepts wrote:You could set an "include from" variable and use it in a conditional statement within the included file.
I don't have access to the external file. Are you suggesting that I would need access to the external file to communicate the conditional statement?

Why do frames work so well, but php includes have very slight issues. Can anyone shed some light on this for me :dubious:

Originally I had a frameset that needed to be dynamic, but i discovered that php includes could do the same thing. Although I think that when the url is external, it encounters complications (so far anyway?)

Confused and frayed
Jcart wrote:preg_replace() on all the urls, and replacing the relative links to absolute links.

However, if you use PCRE I recall there being a a fairly hittable limit to the input size you can input (especially if it's an html page). In that case, I would recommend you split the file into chunks, using file(), array_chunk(), and implode() to reassemble the string.
Im not sure I understand what this would look like? Can you shoot me any code? Im a bit of a newbie

Thanks for your help everyone. Im getting there.

Cheers,
Doug
Post Reply