PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > php.general > include() and current working directory
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
include() and current working directory

Réponse
 
LinkBack Outils de la discussion
Vieux 09/03/2008, 03h47   #1
php@onsiteupdate.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut include() and current working directory

Hi,

I'm using include to display a html file from a different directory to
the current working directory.

This page displays, but is missing all the CSS formating.

I'm assuming this is because it can't find the CSS because it's in the
different directory to the CWD.

So, the easy way out is to move the CSS, but I've got heaps of these,
and it makes it really messy.

The PHP looks like this:

include("xxx/index.htm");

the css is saved in the xxx folder.

I'm open to any suggestions, ideas?

Many thanks
Matt

  Réponse avec citation
Vieux 09/03/2008, 05h25   #2
petersprc
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: include() and current working directory

Hi,

If you're linking to the style sheet in your HTML, then the path
should be relative to the current URL, e.g.:

<link rel="stylesheet" href="/xxx/xxx.css" type="text/css" />

The path can be absolute as in /home/xxx/xxx.css or relative as in xxx/
xxx.css.

Regards,

John Peters

On Mar 8, 8:47 pm, p...@onsiteupdate.com wrote:
> Hi,
>
> I'm using include to display a html file from a different directory to
> the current working directory.
>
> This page displays, but is missing all the CSS formating.
>
> I'm assuming this is because it can't find the CSS because it's in the
> different directory to the CWD.
>
> So, the easy way out is to move the CSS, but I've got heaps of these,
> and it makes it really messy.
>
> The PHP looks like this:
>
> include("xxx/index.htm");
>
> the css is saved in the xxx folder.
>
> I'm open to any suggestions, ideas?
>
> Many thanks
> Matt


  Réponse avec citation
Vieux 09/03/2008, 05h36   #3
Jim Lucas
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] include() and current working directory

php@onsiteupdate.com wrote:
> Hi,
>
> I'm using include to display a html file from a different directory to
> the current working directory.
>
> This page displays, but is missing all the CSS formating.
>
> I'm assuming this is because it can't find the CSS because it's in the
> different directory to the CWD.
>
> So, the easy way out is to move the CSS, but I've got heaps of these,
> and it makes it really messy.
>
> The PHP looks like this:
>
> include("xxx/index.htm");
>
> the css is saved in the xxx folder.
>
> I'm open to any suggestions, ideas?
>
> Many thanks
> Matt
>
>


I think your problem has to do with the difference between relative and
absolute URL references.

Do some googling about those and I think you might get your answer. If
you do not, and since this really has nothing to do with PHP, you can
email off list and I can assist you with the problem.

Thanks

Jim Lucas
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 04h08.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,08877 seconds with 11 queries