Re: PHP attaching css and JS files to current page

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 2008-11-30 at 14:55 +0100, Alain Roger wrote:
> In fact my class has for purpose to be used in several projects and
> therefore, to write the css/js files from the web page using the class
> would be a mistake in the way that could not be redistributed without
> missing those files.
> 
> On Sun, Nov 30, 2008 at 2:55 PM, Ashley Sheridan
> <ash@xxxxxxxxxxxxxxxxxxxx> wrote:
>         On Sun, 2008-11-30 at 14:23 +0100, Alain Roger wrote:
>         > Hi,
>         >
>         > is there a way how a PHP class can attach JS (javascript)
>         and CSS documents
>         > to current web page in which the class is instanced ?
>         > till now i used an "echo" which "write" a <script></script>
>         code into
>         > current document.
>         > in this javascript, i used to have a createElement function
>         to attache
>         > C\other CSS or JS file.
>         >
>         > it's not so clean and maybe a better possibility exists.
>         Thanks to let me
>         > know.
>         >
>         
>         Can you not just write all of the CSS/Javascript that you need
>         right
>         from the get-go in the same place you're writing out your
>         Javascript
>         now?
>         
>         
>         Ash
>         www.ashleysheridan.co.uk
>         
> 
> 
> 
> -- 
> Alain
> -----------------------------------------------------------
> Windows XP x64 SP2
> PostgreSQL 8.3.5 / MS SQL server 2005
> Apache 2.2.10
> PHP 5.2.6
> C# 2005-2008
I'm not sure I follow you then. You say you want your class to be able
to include those files, then you say that you don't want to.

Have you considered having PHP check for the existence of the files
you're trying to include before outputting the HTML that includes them?

Also, if you are outputting Javascript code that then uses a
createElement to include more code, how does the Javascript know it can
include the files if they don't exist for every installation?


Ash
www.ashleysheridan.co.uk


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux