you're right if you want to write them directly in the index.php.
but in my case i want the class to do it by itself.

On Sun, Nov 30, 2008 at 3:49 PM, Ashley Sheridan
<[EMAIL PROTECTED]>wrote:

> On Sun, 2008-11-30 at 15:08 +0100, Alain Roger wrote:
> > >
> > > >
> > > >         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.
> I still don't see the problem then with having some output that looks
> like this:
>
> print <<<EOS
> <script language="javascript" type="text/javascript"
> href="CTable.js"></script>
> <link rel="stylesheet" type="text/css" href="CTable.css"/>
> EOS;
>
> (there should be 4 lines of code there, but line-breaks crept in!)
>
>
> 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

Reply via email to