Re: PHP attaching css and JS files to current page

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

 



>
> >
> >         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?
> >
> >
> 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?
>
>
so we for sure misunderstood eachother :-)
let's say i have an index.php page in which i create an instance of my class
CTable.
to do that i need to include the CTable.php file into my index.php (till now
no problem)
for that : include_once 'Class/CTable.php';

in the CTable.php file i have my class definition and implementation as
following:
class CTable
{
  blah blah...
}

my CTable class has a Render function which will write html code into the
current index.php page.
within this code should be written some javascript command as also some css
classnames.

till now no problem.

the problem is that in this code (that write my class) into index.php there
are some javascrip command and css classnames, which are linked to external
(in the Class directory) files "CTable.js" and "CTable.css".
those 2 files should be loaded by the class CTable itself...and this is what
i do using echo and createElement.
it works well but it is not clean from my point of view...that's why i was
looking for another solution...more... let say "professional".

A.

[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