[PHP] [PHP5] Super constructor?

2004-06-13 Thread FrzzMan
Hi guys, hey don't laugh at the subject, in fact I don't what to call 
it, so let's call it super constructor :D

Let's see following code...
class Base
{
__construct()
{
// Do something
}
}
class One extends Base
{
__construct()
{
// Do nothing
}
}
class OneMore extends One
{
__construct()
{
// Do things :D
}
}
So when I create an instance of OneMore class by:
$OneMoreInstance = new OneMore()
The __construct() method of class OneMore will be called, not the one of 
One and Base, right?

So is there any way around to make the Base class have a contructor that 
will be called everytime one of its child initialize?

My problem, I want all of the classes in my object are extend from one 
base class, so they are all have some common properties and function, 
but PHP won't implicit call the contructor (that's the right way)... 
btw, in my case, this is bad, as bad as every constructor would be called...

Well, hope you understand what I'm trying to say...
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: Best Lossless Hi-Res Photo Storage with PHP

2004-06-13 Thread Galen
On Jun 12, 2004, at 4:36 PM, Kim Steinhaug wrote:
well, there are formats that have impressed me. The Mpg-4 format
which requires plugins all over the place is really amazing, from 
e-vue.
They also provide a plugin atleast for IE to browse the images.

I dont know if you can compress images outside the windows platform
however.
That's a key problem. I don't touch Windows unless I have to, so I 
don't primarily run it at home and my servers _never_ run it, so this 
format is totally out of the running - I need to be able to 
compress/decompress on *nix based machines.

If your looking for supreme quality however, you would need to stay
away from the lossy formats and probably go for TIFF which is a great
format and is also supported by any major software. PNG however is
abit strange, woudnt sendt PNG images to a publisher...
You could ZIP the TIF images on the HD to same space, you often
get good results on this. This would also make the downloads better
for the user, and since all the browsing online would use thumbnails 
you
dont need to waste CPU do depack the images, since you all users
can depack a ZIP file (thats the least you would expect from a user 
that
purchase a High resolution image).
I've experimented, PNG is notably better than ZIP for compressing image 
material. PNG retains 100% quality and offers the smallest file sizes 
around in a file that can be read by almost any system (i.e. all 
half-recent browsers, photoshop, most other graphics applications, 
etc). There's no reason I can't also offer a TIFF file, but I'll 
primarily route the user to the PNG file because it's simply the 
smallest download yet retains 100% quality and is a completely free 
format.

Ive created such systems myself, and my sollution was another :
Plug in a new harddrive. We save the images as jpg, tif, eps, ai or 
whatever
the original image was created as, and create thumbnails at various
resolutions in high compressed jpg for fast browsing. Often I tend to
ZIP the lossless images aswell, but then again I dont need to since HD 
isnt
a problem atleast in my case.

I have a similar system implemented with thumbnails and caching and all 
sorts of things. Works great. But hard drive space is a major concern, 
so I have to be more conservative with the hi-res versions.

Hope this helps.
Well, it's good to know that somebody else works with this sort of 
thing. Although I was really hoping to hear from someone who's worked 
with JPEG 2000 lossless (much higher than PNG image compression ratio!) 
via ImageMagick or something similar to that. Or perhaps any other 
interesting solutions people have come up with that beat PNG for 
compression. More thoughts anybody?

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


[PHP] Problems compiling PHP 5 RC3

2004-06-13 Thread Luca Spiller
I am having a few problems compiling PHP 5 RC 3. I am following the
tutorial at http://uk.php.net/install.apache2 and everything works up
until I start to compile PHP. It all seems to work fine but then when
running make at the end I get:

ln: creating hard link 'libxml.o' to 'libxml.lo': Operation not
permitted 
make: *** [libphp5.la] Error 1

I am running this as root so I don't get why I am not permitted to do
this. I am also fairly new to Linux (about half a year) so please don't
reply with anything too compicated.

Thanks,
Luca Spiller

P.S. I have posted this here as well as in the installation problems
list as this seems much more active.

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.705 / Virus Database: 461 - Release Date: 12/06/2004
 

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



Re: [PHP] PHP pros and cons

2004-06-13 Thread Lester Caine
Chris Shiflett wrote:
--- Steve Douville [EMAIL PROTECTED] wrote:
I do like CF's ability to just name data sources on the server and
reference them that way.

You won't be able to reproduce the cfadmin stuff with PHP, simply
because PHP isn't a persistent process, but I think great strides will be
made on the database front with this:
http://pecl.php.net/package/PDO
One of ColdFusion's strengths has always been uniforum database access
within the code without the extra cost of a userland database abstraction
layer. PDO should give PHP developers that same mix of consistency and
performance.
PDO has a long way to go to catch up with ADOdb, and I think that 
demonstrates one of the strengths of PHP. There is a large developer 
base working on solutions to their own problems, but making the results 
freely available to everybody.

I did a couple of papers at the Firebird Conference last month, one of 
which was on PHP. While researching it I found a set of useful figures 
on the http://www.securityspace.com/sspace/index.html site
Todays figures
http://www.securityspace.com/s_survey/data/200405/index.html
Apache has 70% of the world market
http://www.securityspace.com/s_survey/data/man.200405/apachemods.html
PHP is installed on 52% of those machines ( and that does not include 
the IIS machines its running on ! )

I'd already standardised on PHP5, but those figures gave me a warm 
feeling when I confirmed them.

Add Firebird and you have a package of Webserver, Scripting and Database 
that is totally free and runs of Linux or Windows - which ever your 
customer insists on.

Objections - It's not compiled. This is both a good and bad thing. The 
advantage is that minor changes in a page can be made almost on the fly 
without having to rebuild the whole application. IF speed becomes a 
problem then one of the caching packages can be added, and if that is 
not good enough, then you can easily load share, by running two or more 
machines. One or more running Apache/PHP, and a second (or more ) 
running the database.

PHP5 is not released yet, but personally I've had no problems with the 
prerelease stuff in the last few months and no failures on the demo 
machine at all in that time. Try ibWebAdmin.lsces.co.uk to see what can 
be done.

--
Lester Caine
-
L.S.Caine Electronic Services
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] [PHP5] Super constructor?

2004-06-13 Thread Chris
FrzzMan wrote:
Hi guys, hey don't laugh at the subject, in fact I don't what to call 
it, so let's call it super constructor :D

Let's see following code...
class Base
{
__construct()
{
// Do something
}
}
class One extends Base
{
__construct()
{
// Do nothing
}
}
class OneMore extends One
{
__construct()
{
// Do things :D
}
}
So when I create an instance of OneMore class by:
$OneMoreInstance = new OneMore()
The __construct() method of class OneMore will be called, not the one 
of One and Base, right?

So is there any way around to make the Base class have a contructor 
that will be called everytime one of its child initialize?

My problem, I want all of the classes in my object are extend from one 
base class, so they are all have some common properties and function, 
but PHP won't implicit call the contructor (that's the right way)... 
btw, in my case, this is bad, as bad as every constructor would be 
called...

Well, hope you understand what I'm trying to say...
I'm not positive I understand you correctly, but I think this will 
answer your question.

Example Classes:
class ParentClass
{
   function __construct()
   {
   echo 'ParentClass::__construct()',\r\n;
   }
}
class ChildClass extends ParentClass
{
/*
   function __construct()
   {
   parent::__construct();
   echo 'ChildClass::__construct()',\r\n;
   }
//*/
}
class GrandChildClass extends ChildClass
{
   function __construct()
   {
   parent::__construct();
   echo 'GrandChildClass::__construct()',\r\n;
   }
}
__construct is just like any other method, if you overload it (redefine 
it in a child class), the parent method will not be called 
automatically, so, if you want the functionality of both, you can call 
the parent constructor from the childs constructor. If the direct parent 
doesn't have a constructor, the next parent's constructor is checked and 
so on.

In the above example when defining a GrandChildClass, its constructor 
and the ParentClass::__construct() are will both run. If you uncomment 
ChildClass::__construct(), it will run as well.

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


Re: [PHP] [PHP5] Super constructor?

2004-06-13 Thread FrzzMan
Yeah you understood me, thanks god :D but not fully :(
But the problem is right in your code (sorry :D)
What if I create an instance of ChildClass, its constructor won't be 
called (since it commented out), but if I un-comment its constructor, it 
will be called even if I create an instance of GrandChildClass?

Let me make some simple diagram ;)
Class1 -- Class2 -- Class3 -- Class4
If I create an instance of Class4, then Class4's constructor and 
Class1's constructor must be called, neither Class3 nor Class2.

You can see that Class1's constructor will always be called, and the 
constructor of the lowest class in the class tree will be called.

I think this is a bit complex, I can define a final function in Class1, 
and call it in every deriver class constructor, it will solve the 
problem (I think) but it's not convenience, I want it done automatically...

Any idea are welcome :D
Chris wrote:
FrzzMan wrote:
Hi guys, hey don't laugh at the subject, in fact I don't what to call 
it, so let's call it super constructor :D

Let's see following code...
class Base
{
__construct()
{
// Do something
}
}
class One extends Base
{
__construct()
{
// Do nothing
}
}
class OneMore extends One
{
__construct()
{
// Do things :D
}
}
So when I create an instance of OneMore class by:
$OneMoreInstance = new OneMore()
The __construct() method of class OneMore will be called, not the one 
of One and Base, right?

So is there any way around to make the Base class have a contructor 
that will be called everytime one of its child initialize?

My problem, I want all of the classes in my object are extend from one 
base class, so they are all have some common properties and function, 
but PHP won't implicit call the contructor (that's the right way)... 
btw, in my case, this is bad, as bad as every constructor would be 
called...

Well, hope you understand what I'm trying to say...
I'm not positive I understand you correctly, but I think this will 
answer your question.

Example Classes:
class ParentClass
{
   function __construct()
   {
   echo 'ParentClass::__construct()',\r\n;
   }
}
class ChildClass extends ParentClass
{
/*
   function __construct()
   {
   parent::__construct();
   echo 'ChildClass::__construct()',\r\n;
   }
//*/
}
class GrandChildClass extends ChildClass
{
   function __construct()
   {
   parent::__construct();
   echo 'GrandChildClass::__construct()',\r\n;
   }
}
__construct is just like any other method, if you overload it (redefine 
it in a child class), the parent method will not be called 
automatically, so, if you want the functionality of both, you can call 
the parent constructor from the childs constructor. If the direct parent 
doesn't have a constructor, the next parent's constructor is checked and 
so on.

In the above example when defining a GrandChildClass, its constructor 
and the ParentClass::__construct() are will both run. If you uncomment 
ChildClass::__construct(), it will run as well.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: Best Lossless Hi-Res Photo Storage with PHP

2004-06-13 Thread Kim Steinhaug
Hei,

Regarding the jpg compression, we did some testing along with our customers
press buereu's (I think thats the name, the ones that do all the prints and
designs the logoes and such). Here we did som testing on the images
and the quality.

What we experienced was that if we converted the images to JPG with
a quality of 10 it was good enough for most people. I however still use
11 just to be safe. (We are ofcourse talking about 300DPI images)

So there you have it, quality 10 is still good enough quality for print.
However - be aware of another stupid fact - people expecting high resolution
downloads wont download a 4-5mb jpg image, since it cant (?) be good
enough quality... They are simply expecting a 50MB tif image since this
is what they are working with normally. This is infact a huge problem!

So much depending on you customers, but saving as a jpg should be just fine.

--
--
Kim Steinhaug
--
There are 10 types of people when it comes to binary numbers:
those who understand them, and those who don't.
--
www.steinhaug.com - www.easywebshop.no - www.webkitpro.com
--

Galen [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 On Jun 12, 2004, at 4:36 PM, Kim Steinhaug wrote:

  well, there are formats that have impressed me. The Mpg-4 format
  which requires plugins all over the place is really amazing, from
  e-vue.
  They also provide a plugin atleast for IE to browse the images.
 
  I dont know if you can compress images outside the windows platform
  however.
 

 That's a key problem. I don't touch Windows unless I have to, so I
 don't primarily run it at home and my servers _never_ run it, so this
 format is totally out of the running - I need to be able to
 compress/decompress on *nix based machines.

  If your looking for supreme quality however, you would need to stay
  away from the lossy formats and probably go for TIFF which is a great
  format and is also supported by any major software. PNG however is
  abit strange, woudnt sendt PNG images to a publisher...
 
 
  You could ZIP the TIF images on the HD to same space, you often
  get good results on this. This would also make the downloads better
  for the user, and since all the browsing online would use thumbnails
  you
  dont need to waste CPU do depack the images, since you all users
  can depack a ZIP file (thats the least you would expect from a user
  that
  purchase a High resolution image).

 I've experimented, PNG is notably better than ZIP for compressing image
 material. PNG retains 100% quality and offers the smallest file sizes
 around in a file that can be read by almost any system (i.e. all
 half-recent browsers, photoshop, most other graphics applications,
 etc). There's no reason I can't also offer a TIFF file, but I'll
 primarily route the user to the PNG file because it's simply the
 smallest download yet retains 100% quality and is a completely free
 format.

 
  Ive created such systems myself, and my sollution was another :
  Plug in a new harddrive. We save the images as jpg, tif, eps, ai or
  whatever
  the original image was created as, and create thumbnails at various
  resolutions in high compressed jpg for fast browsing. Often I tend to
  ZIP the lossless images aswell, but then again I dont need to since HD
  isnt
  a problem atleast in my case.
 

 I have a similar system implemented with thumbnails and caching and all
 sorts of things. Works great. But hard drive space is a major concern,
 so I have to be more conservative with the hi-res versions.

  Hope this helps.
 

 Well, it's good to know that somebody else works with this sort of
 thing. Although I was really hoping to hear from someone who's worked
 with JPEG 2000 lossless (much higher than PNG image compression ratio!)
 via ImageMagick or something similar to that. Or perhaps any other
 interesting solutions people have come up with that beat PNG for
 compression. More thoughts anybody?

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



Re: [PHP] session.use_trans_sid = 0 does not work!!!

2004-06-13 Thread Marcus Merz
Hi James,

James Harrell [EMAIL PROTECTED] schrieb im Newsbeitrag
news:[EMAIL PROTECTED]

[...]

 If you want to forcefully remove this PHPSESSION (which is sometimes
 a good idea since search engine spiders will catalog the links with
 the session id if you don't remove it), try this:

 ini_set(session.use_only_cookies,1);

If this is not an option and you still want to not have session id's
appended when a searchengine robot comes to your site, you could detect the
UA and just do not start a session in that case.

 James

Regards,
Marcus

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



[PHP] Password protected downloads

2004-06-13 Thread Maldiv
Hello,

I want to make a password protected download possibility on my site. I know
how can I handle normal user login, but how can I protect a download from
guests?
I mean if user navigate to www.demo.com/mydownload.zip than he can download
the file without login. How can I prevent this downloads?

Thanks for your help!

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



Re: [PHP] Password protected downloads

2004-06-13 Thread raditha dissanayake
Maldiv wrote:
Hello,
 

hi
I want to make a password protected download possibility on my site. I know
how can I handle normal user login, but how can I protect a download from
guests?
 

This question has been often asked in the past, the archives are rich 
with solutions. One solution is NOT to create a direct download link but 
to deliver the file via a php script (fpassthru) that can check login 
status. Another is to use .htpasswd protection you will find lots of 
details in the archives.

--
Raditha Dissanayake.
-
http://www.raditha.com/megaupload/upload.php
Sneak past the PHP file upload limits.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Problems compiling PHP 5 RC3

2004-06-13 Thread raditha dissanayake
Luca Spiller wrote:
I am having a few problems compiling PHP 5 RC 3. I am following the
tutorial at http://uk.php.net/install.apache2 and everything works up
until I start to compile PHP. It all seems to work fine but then when
running make at the end I get:
ln: creating hard link 'libxml.o' to 'libxml.lo': Operation not
permitted 
 

Possibly because creating a hard link between two partitions is not 
allowed you will have to use a symbolic link instead. (ln -s)

--
Raditha Dissanayake.
-
http://www.raditha.com/megaupload/upload.php
Sneak past the PHP file upload limits.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Password protected downloads

2004-06-13 Thread Torsten Roehr
Maldiv [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hello,

 I want to make a password protected download possibility on my site. I
know
 how can I handle normal user login, but how can I protect a download from
 guests?
 I mean if user navigate to www.demo.com/mydownload.zip than he can
download
 the file without login. How can I prevent this downloads?

One way is to store all your download files outside of the webroot and/or
protect the directory with .htacces. Then use PEAR's HTTP_Download to serve
the files as a download to the user:
http://pear.php.net/package/HTTP_Download

Hope this helps. Regards,

Torsten Roehr

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



Re: [PHP] [PHP5] Super constructor?

2004-06-13 Thread Chris
Well, when you instantiate Class4 PHP will check for it's constructor. 
If it has one, it will call it. If not it will check Class3, then 
Class2, then Class1.

Once it finds a constructor, it stops looking for more, but if you want 
it to resume checking the the parents for constructors you must call 
parent::_construct() from  the one it found.

If you define a constructor in Class4, It will run in all but one 
circumstance. If a child has a constructor, but does not call 
parent::_construct() from it. That would stop this waterfall effect.

FrzzMan wrote:
Yeah you understood me, thanks god :D but not fully :(
But the problem is right in your code (sorry :D)
What if I create an instance of ChildClass, its constructor won't be 
called (since it commented out), but if I un-comment its constructor, 
it will be called even if I create an instance of GrandChildClass?

Let me make some simple diagram ;)
Class1 -- Class2 -- Class3 -- Class4
If I create an instance of Class4, then Class4's constructor and 
Class1's constructor must be called, neither Class3 nor Class2.

You can see that Class1's constructor will always be called, and the 
constructor of the lowest class in the class tree will be called.

I think this is a bit complex, I can define a final function in 
Class1, and call it in every deriver class constructor, it will solve 
the problem (I think) but it's not convenience, I want it done 
automatically...

Any idea are welcome :D
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] [PHP5] Super constructor?

2004-06-13 Thread Chris
Because /$GrandChildClass;/ Is an object. So when you go to echo it, PHP 
tries to convert it to a string.

Pham Cong Dinh wrote:
Hi all,
I tested Chris's code:
?php
class *ParentClass*
{
   function __construct()
   {
   echo 'ParentClass::__construct()',\r\n;
   }
}
class *ChildClass *extends ParentClass
{
/*
   function __construct()
   {
   parent::__construct();
   echo 'ChildClass::__construct()',\r\n;
   }
//*/
}
class *GrandChildClass *extends ChildClass
{
   function __construct()
   {
   parent::__construct();
   echo 'GrandChildClass::__construct()',\r\n;
   }
}
$GrandChildClass = new GrandChildClass();
echo $GrandChildClass;
?
It resulted:
ParentClass::__construct()
GrandChildClass::__construct()
Object id #1
Could anyone kindly tell me why the string Object id #1 is printed?
Thanks
Dinh
Chris wrote:
FrzzMan wrote:
Hi guys, hey don't laugh at the subject, in fact I don't what to 
call it, so let's call it super constructor :D

Let's see following code...
class Base
{
__construct()
{
// Do something
}
}
class One extends Base
{
__construct()
{
// Do nothing
}
}
class OneMore extends One
{
__construct()
{
// Do things :D
}
}
So when I create an instance of OneMore class by:
$OneMoreInstance = new OneMore()
The __construct() method of class OneMore will be called, not the 
one of One and Base, right?

So is there any way around to make the Base class have a contructor 
that will be called everytime one of its child initialize?

My problem, I want all of the classes in my object are extend from 
one base class, so they are all have some common properties and 
function, but PHP won't implicit call the contructor (that's the 
right way)... btw, in my case, this is bad, as bad as every 
constructor would be called...

Well, hope you understand what I'm trying to say...
I'm not positive I understand you correctly, but I think this will 
answer your question.

Example Classes:
class ParentClass
{
   function __construct()
   {
   echo 'ParentClass::__construct()',\r\n;
   }
}
class ChildClass extends ParentClass
{
/*
   function __construct()
   {
   parent::__construct();
   echo 'ChildClass::__construct()',\r\n;
   }
//*/
}
class GrandChildClass extends ChildClass
{
   function __construct()
   {
   parent::__construct();
   echo 'GrandChildClass::__construct()',\r\n;
   }
}
__construct is just like any other method, if you overload it 
(redefine it in a child class), the parent method will not be called 
automatically, so, if you want the functionality of both, you can 
call the parent constructor from the childs constructor. If the 
direct parent doesn't have a constructor, the next parent's 
constructor is checked and so on.

In the above example when defining a GrandChildClass, its constructor 
and the ParentClass::__construct() are will both run. If you 
uncomment ChildClass::__construct(), it will run as well.


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


Re: [PHP] [PHP5] Super constructor?

2004-06-13 Thread FrzzMan
Try var_dump($GrandChildClass) or print_r($GrandChildClass) everytime 
you need to inspect variable content. Not echo...

PS: Hi there Vietnamese guy, same here ;)
Chris wrote:
Because /$GrandChildClass;/ Is an object. So when you go to echo it, PHP 
tries to convert it to a string.

Pham Cong Dinh wrote:
Hi all,
I tested Chris's code:
?php
class *ParentClass*
{
   function __construct()
   {
   echo 'ParentClass::__construct()',\r\n;
   }
}
class *ChildClass *extends ParentClass
{
/*
   function __construct()
   {
   parent::__construct();
   echo 'ChildClass::__construct()',\r\n;
   }
//*/
}
class *GrandChildClass *extends ChildClass
{
   function __construct()
   {
   parent::__construct();
   echo 'GrandChildClass::__construct()',\r\n;
   }
}
$GrandChildClass = new GrandChildClass();
echo $GrandChildClass;
?
It resulted:
ParentClass::__construct()
GrandChildClass::__construct()
Object id #1
Could anyone kindly tell me why the string Object id #1 is printed?
Thanks
Dinh
Chris wrote:
FrzzMan wrote:
Hi guys, hey don't laugh at the subject, in fact I don't what to 
call it, so let's call it super constructor :D

Let's see following code...
class Base
{
__construct()
{
// Do something
}
}
class One extends Base
{
__construct()
{
// Do nothing
}
}
class OneMore extends One
{
__construct()
{
// Do things :D
}
}
So when I create an instance of OneMore class by:
$OneMoreInstance = new OneMore()
The __construct() method of class OneMore will be called, not the 
one of One and Base, right?

So is there any way around to make the Base class have a contructor 
that will be called everytime one of its child initialize?

My problem, I want all of the classes in my object are extend from 
one base class, so they are all have some common properties and 
function, but PHP won't implicit call the contructor (that's the 
right way)... btw, in my case, this is bad, as bad as every 
constructor would be called...

Well, hope you understand what I'm trying to say...
I'm not positive I understand you correctly, but I think this will 
answer your question.

Example Classes:
class ParentClass
{
   function __construct()
   {
   echo 'ParentClass::__construct()',\r\n;
   }
}
class ChildClass extends ParentClass
{
/*
   function __construct()
   {
   parent::__construct();
   echo 'ChildClass::__construct()',\r\n;
   }
//*/
}
class GrandChildClass extends ChildClass
{
   function __construct()
   {
   parent::__construct();
   echo 'GrandChildClass::__construct()',\r\n;
   }
}
__construct is just like any other method, if you overload it 
(redefine it in a child class), the parent method will not be called 
automatically, so, if you want the functionality of both, you can 
call the parent constructor from the childs constructor. If the 
direct parent doesn't have a constructor, the next parent's 
constructor is checked and so on.

In the above example when defining a GrandChildClass, its constructor 
and the ParentClass::__construct() are will both run. If you 
uncomment ChildClass::__construct(), it will run as well.


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


[PHP] creating a nested multidimensional array from a query

2004-06-13 Thread grahama
Hi :)
I am on my second week of php so be gentle
I am creating an XML file out of a mysql query with nested arrays.
Currently I can get 1 element and 1 child with a properly formatted XML 
file with the below script .

My question is: How do  I  add 3 to 4 more child elements to the below 
'playlist' array ?
Currently ,I have one parent 'Artist' and one child 'english' ...
I need to add more child elements to the 'Artist' array like urlPath, 
spanish, biography, etc

Do I have to add another dimension to the 'playlist' array? Do I need 
another  foreach loop ?
Is there an easier more efficient way to do this?
Be nice to spell out the schema in some way in the script...in case you 
need to add more levels...like a 'subCategory'

I am a bit new to this so any help would be greatly appretiated  
head is spinning a bit

$sql = 'SELECT artist.artist_name, media.english, media.path ';
$sql .= 'FROM media, artist ';
$sql .= 'WHERE artist.artist_id = media.artist_id LIMIT 0, 30 ';
$result = mysql_query($sql);
while ($row = mysql_fetch_array($result))
{
$playlist[$row['artist_name']] [] = $row['english'];
//would like to add more children here...
}
$xml = sirenreels\n;
foreach ($playlist as $artist = $media)
{
$num_media = count($media);
$xml .= artist\n;   

$xml .= \tmeta\n;   
$xml .= \t\ttitle.$artist./title\n;
$xml .= \t/meta\n;  

$xml .= \tcontent\n;
foreach ($media as $mediaVal)
{
$xml .= \t\tmedia\n;
$xml .= \t\t\tenglish_name.$mediaVal./english_name\n;
///add more children
///add more children
$xml .= \t\t/media\n;   

}

$xml .= \t/content\n;   
$xml .= /artist\n;  
}
$xml .= /sirenreels\n;
print $xml
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Expedia.com

2004-06-13 Thread Rainer Mller
Red Wingate wrote:
Allmost, after having a quick look at the source i tell you they
do it like that:
div id=loading style=display:block
... loading stuff here ...
/div
. page loading here 
done?
JS: document.getElementByid('loading').display='none';
take a look for yourself :-)
The idea is great IMHO. But what if someone has javascript disabled?
Rainer
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] RE:[PHP] file knowing its own directory

2004-06-13 Thread Dennis Gearon
Just for the record, (and archives), This can be accomplished by:
dirname( __FILE__);
This allowes me to put the following into an application's config file, 
to be included via the prepend, the following localized, global values:
(assuming the application's files are kept OUT of the document root for 
security's sake)

$APPLICAITON_NAME_VALUES[MAIN_DIR]= dirname(__FILE__)./; //on linux 
anyway.
$APPLICAITON_NAME_VALUES[NEEDED_VALUE_1]= 'VALUE_1;
$APPLICAITON_NAME_VALUES[NEEDED_VALUE_2]= 'VALUE_2;
blah blah

causing VERY little global name pollution.
[EMAIL PROTECTED] wrote:
please CC me 'cause I am on digest
the scenario:
   three files:
  .htaccess
 has line saying php_prepend 
'true_filesystem_location_php_prepend_file' 
  prepend.php (aforementioned prepend file)
 has line saying include file_a.php
  file_a.php
 has line saying$my_true_file_system_location = 
I_NEED_A_FUNCTION_HERE;

So, what do I replace I_NEED_A_FUNCTION_HERE with?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] connecting remote host ..

2004-06-13 Thread gowthaman ramasamy
hello list,
My php script works fine with local mysql database.
however when try to use some remote database it fails and gives follwing
error ..

Warning: mysql_connect(): Unknown MySQL Server Host 'http' (2) in
/usr/local/apache2/htdocs/gowtham/forphp/db_qry_4repeat.php on line 86


the mysql_connect() syntax is as follows ..
$db=mysql_connect(192.168.1.109, root, password); 
192.168.1.109 is the ip (internal IP on LAN) of the machine hosting the
database.

thanx a lot in advance ..

-- 
Ra. Gowthaman,
Graduate Student,
Bioinformatics Lab,
Malaria Research Group,
ICGEB , New Delhi.
INDIA

Phone: 91-9811261804
   91-11-26173184; 91-11-26189360 #extn 314

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