[PHP] Re: PHP, OOP and AJAX

2009-05-28 Thread Jo�o C�ndido de Souza Neto
Julian,

could you please show us an example of this problem?


-- 
João Cândido de Souza Neto
SIENS SOLUÇÕES EM GESTÃO DE NEGÓCIOS
Fone: (0XX41) 3033-3636 - JS
www.siens.com.br

Julian Muscat Doublesin opensourc...@gmail.com escreveu na mensagem 
news:5e0039ed0905280431o2e9d8036u217b0449eccd...@mail.gmail.com...
 Hi Everyone,

 This is the first time that I am posting in the PHP forum, so hope that I 
 am
 osting in the right place.

 I would like to say that before submitting to this forum I have done some
 research looking for a solution without success.

 I had been programming in ASP.NET for years using Object Oriented
 Princeliness but decided to walk away from that.  I am now researching and
 specialising in the open source world.

 I have started to develop a project using MySQL, PHP and OOP. So far I 
 have
 succeed. However I got stuck once I started implement AJAX using the AJAX
 tutorial from w3schools.com.

 What I have discovered is: for some reason when you call a file that
 requires other fies using the REQUIRE or INCLUDE it just does not work. I
 can conform this as I have tested with out the the functions.

 Has anyone ever meet such a situation can you give me some feedback 
 please.

 Thank you very much in advance for your support.

 Regards

 Julian
 



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



Re: [PHP] Re: PHP, OOP and AJAX

2009-05-28 Thread kranthi
i never faced such a problem and i can assure you that it will never
happen. try...

main.php
?php
require('second.php');
?

second.php
test

call main.php via AJAX and see the responseText.
many things can go wrong in your coding. dont come to the conclusion
that this particular thing is not working.

i recommend you firebug firefox adddon (just go to the net tab and you
can see all the details of the communication between client and
server)
and i find it helpful to use a standard javascript(jQuery in my case)
library instead of highly limited plain javascript  language

and for you case its difficult to comment without seeing your actual code.

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



Re: Re: [PHP] Re: PHP, OOP and AJAX

2009-05-28 Thread oorza2k5

Two things:

1. Try using the fully qualified path (ie /var/www/foo/bar.php instead of  
foo/bar.php)
2. Look at setting up autoloading so you don't need to manually include  
anyway. If you're going OOP, autoloading is a must!


On May 28, 2009 8:49am, kranthi kranthi...@gmail.com wrote:

i never faced such a problem and i can assure you that it will never



happen. try...





main.php




require('second.php');



?





second.php



test





call main.php via AJAX and see the responseText.



many things can go wrong in your coding. dont come to the conclusion



that this particular thing is not working.





i recommend you firebug firefox adddon (just go to the net tab and you



can see all the details of the communication between client and



server)



and i find it helpful to use a standard javascript(jQuery in my case)



library instead of highly limited plain javascript language





and for you case its difficult to comment without seeing your actual code.





--



PHP General Mailing List (http://www.php.net/)



To unsubscribe, visit: http://www.php.net/unsub.php






Re: [PHP] Re: PHP, OOP and AJAX

2009-05-28 Thread Lenin
2009/5/28 kranthi kranthi...@gmail.com



 i recommend you firebug firefox adddon (just go to the net tab and you
 can see all the details of the communication between client and
 server)
 and i find it helpful to use a standard javascript(jQuery in my case)
 library instead of highly limited plain javascript  language

I also recommend using FirePHP with FireBug here's a nicely written tutorial
on how to use them both together for Ajax'ed pages. http://tr.im/iyvl
Thanks
Lenin
www.twitter.com/nine_L


Re: [PHP] Re: PHP, OOP and AJAX

2009-05-28 Thread Olexandr Heneralov
Hi!
Do not use low-level AJAX.
There are many frameworks for ajax (JQUERY).
Try to use PHP frameworks like symfony, zend framework. They simplify your
work.


2009/5/28 Lenin le...@phpxperts.net

 2009/5/28 kranthi kranthi...@gmail.com

 
 
  i recommend you firebug firefox adddon (just go to the net tab and you
  can see all the details of the communication between client and
  server)
  and i find it helpful to use a standard javascript(jQuery in my case)
  library instead of highly limited plain javascript  language
 
 I also recommend using FirePHP with FireBug here's a nicely written
 tutorial
 on how to use them both together for Ajax'ed pages. http://tr.im/iyvl
 Thanks
 Lenin
 www.twitter.com/nine_L



Re: [PHP] Re: PHP, OOP and AJAX

2009-05-28 Thread Luke
2009/5/28 Olexandr Heneralov ohenera...@gmail.com

 Hi!
 Do not use low-level AJAX.
 There are many frameworks for ajax (JQUERY).
 Try to use PHP frameworks like symfony, zend framework. They simplify your
 work.


 2009/5/28 Lenin le...@phpxperts.net

  2009/5/28 kranthi kranthi...@gmail.com
 
  
  
   i recommend you firebug firefox adddon (just go to the net tab and you
   can see all the details of the communication between client and
   server)
   and i find it helpful to use a standard javascript(jQuery in my case)
   library instead of highly limited plain javascript  language
  
  I also recommend using FirePHP with FireBug here's a nicely written
  tutorial
  on how to use them both together for Ajax'ed pages. http://tr.im/iyvl
  Thanks
  Lenin
  www.twitter.com/nine_L
 



Moo, I would say learn to do PHP by itself before you go using frameworks.

AJAX is a bit different though because there will be few reasons that you
will ever need to write low level code when you're using a library like
Prototype =)

-- 
Luke Slater
:O)


Re: Re: [PHP] Re: PHP, OOP and AJAX

2009-05-28 Thread Tony Marston

oorza...@gmail.com wrote in message 
news:000e0cd6ad1a9f7d3d046af89...@google.com...
 Two things:

 1. Try using the fully qualified path (ie /var/www/foo/bar.php instead of
 foo/bar.php)
 2. Look at setting up autoloading so you don't need to manually include
 anyway. If you're going OOP, autoloading is a must!

I totally disagree. I have been doing OOP with PHP for years, and I have 
never used autoloading. It is just a feature that can be used, misused or 
abused just like any other. I choose not to use it, and my code does not 
suffer in the least!

-- 
Tony Marston
http://www.tonymarston.net
http://www.radicore.org




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



Re: Re: [PHP] Re: PHP, OOP and AJAX

2009-05-28 Thread Tony Marston
Eddie Drapkin oorza...@gmail.com wrote in message 
news:68de37340905280737t3e1ad844y188ab8fa08f17...@mail.gmail.com...
 Your code might not, but you sure do!  Spending all that time writing
 require statements = :(

If you are too lazy to write require statements then you are probably too 
lazy to write readable, well structured and efficient code. Besides, I don't 
use require statements, I use
$dbobject = singleton::getInstance('classname');

I don't use autoload because *I* want to be in control. I prefer not to rely 
on automatuic features which may not work as expected.

-- 
Tony Marston
http://www.tonymarston.net
http://www.radicore.org

 On Thu, May 28, 2009 at 9:49 AM, Tony Marston 
 t...@marston-home.demon.co.uk
 wrote:


 oorza...@gmail.com wrote in message
 news:000e0cd6ad1a9f7d3d046af89...@google.com...
  Two things:
 
  1. Try using the fully qualified path (ie /var/www/foo/bar.php instead 
  of
  foo/bar.php)
  2. Look at setting up autoloading so you don't need to manually include
  anyway. If you're going OOP, autoloading is a must!

 I totally disagree. I have been doing OOP with PHP for years, and I have
 never used autoloading. It is just a feature that can be used, misused or
 abused just like any other. I choose not to use it, and my code does not
 suffer in the least!

 --
 Tony Marston
 http://www.tonymarston.net
 http://www.radicore.org




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


 



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



Re: Re: [PHP] Re: PHP, OOP and AJAX

2009-05-28 Thread Eddie Drapkin
There's a huge difference between laziness and opting in to use an
incredibly useful (and easy to properly deploy) feature to save myself time
so that I can spend more time writing that structured and efficient code of
which you speak.  And the problem with what you're saying is that you still
have to include 'singleton.php' somewhere in order to call its static
methods, and I'd rather just spend 30 minutes writing an autoloader object
and letting it deal with finding any of the classes I use then trying to
keep track of legacy code I didn't write and require'ing them all over the
place.

The way I look at it, if you spend all your time handling things that you
could automate - and if written properly, will always work as expected (it's
called unit testing and debugging) - then you have no time to write that
structured and efficient code in order to meet your deadlines! :)

On Thu, May 28, 2009 at 10:53 AM, Tony Marston 
t...@marston-home.demon.co.uk wrote:

 Eddie Drapkin oorza...@gmail.com wrote in message
 news:68de37340905280737t3e1ad844y188ab8fa08f17...@mail.gmail.com...
  Your code might not, but you sure do!  Spending all that time writing
  require statements = :(

 If you are too lazy to write require statements then you are probably too
 lazy to write readable, well structured and efficient code. Besides, I
 don't
 use require statements, I use
$dbobject = singleton::getInstance('classname');

 I don't use autoload because *I* want to be in control. I prefer not to
 rely
 on automatuic features which may not work as expected.

 --
 Tony Marston
 http://www.tonymarston.net
 http://www.radicore.org

  On Thu, May 28, 2009 at 9:49 AM, Tony Marston
  t...@marston-home.demon.co.uk
  wrote:
 
 
  oorza...@gmail.com wrote in message
  news:000e0cd6ad1a9f7d3d046af89...@google.com...
   Two things:
  
   1. Try using the fully qualified path (ie /var/www/foo/bar.php instead
   of
   foo/bar.php)
   2. Look at setting up autoloading so you don't need to manually
 include
   anyway. If you're going OOP, autoloading is a must!
 
  I totally disagree. I have been doing OOP with PHP for years, and I have
  never used autoloading. It is just a feature that can be used, misused
 or
  abused just like any other. I choose not to use it, and my code does not
  suffer in the least!
 
  --
  Tony Marston
  http://www.tonymarston.net
  http://www.radicore.org
 
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 



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




Re: Re: [PHP] Re: PHP, OOP and AJAX

2009-05-28 Thread Tony Marston

Eddie Drapkin oorza...@gmail.com wrote in message 
news:68de37340905280801m6964d355l2d6d8ef773f3b...@mail.gmail.com...
 There's a huge difference between laziness and opting in to use an
 incredibly useful (and easy to properly deploy) feature to save myself 
 time
 so that I can spend more time writing that structured and efficient code 
 of
 which you speak.  And the problem with what you're saying is that you 
 still
 have to include 'singleton.php' somewhere in order to call its static
 methods,

I have a single general purpose include file which autmatically includes all 
other standard files, so I never have to explicity load my singleton class.

 and I'd rather just spend 30 minutes writing an autoloader object
 and letting it deal with finding any of the classes I use then trying to
 keep track of legacy code I didn't write and require'ing them all over the
 place.

I'd rather not waste 30 minutes of my time writing a feature that I don't 
need.

The difference between using and not using the autoload feature does not 
have any measurable impact on either my development times, nor the execution 
of my code, so I choose to not use it. That's my choice, and I'm sticking to 
it.

 The way I look at it, if you spend all your time handling things that you
 could automate - and if written properly, will always work as expected 
 (it's
 called unit testing and debugging) - then you have no time to write that
 structured and efficient code in order to meet your deadlines! :)

Not using autoload does not have any noticeable effect on my deadlines, so I 
have no incentive to use it. Just because you say that I *should* use it 
carries no weight at all.

-- 
Tony Marston
http://www.tonymarston.net
http://www.radicore.org

 On Thu, May 28, 2009 at 10:53 AM, Tony Marston 
 t...@marston-home.demon.co.uk wrote:

 Eddie Drapkin oorza...@gmail.com wrote in message
 news:68de37340905280737t3e1ad844y188ab8fa08f17...@mail.gmail.com...
  Your code might not, but you sure do!  Spending all that time writing
  require statements = :(

 If you are too lazy to write require statements then you are probably 
 too
 lazy to write readable, well structured and efficient code. Besides, I
 don't
 use require statements, I use
$dbobject = singleton::getInstance('classname');

 I don't use autoload because *I* want to be in control. I prefer not to
 rely
 on automatuic features which may not work as expected.

 --
 Tony Marston
 http://www.tonymarston.net
 http://www.radicore.org

  On Thu, May 28, 2009 at 9:49 AM, Tony Marston
  t...@marston-home.demon.co.uk
  wrote:
 
 
  oorza...@gmail.com wrote in message
  news:000e0cd6ad1a9f7d3d046af89...@google.com...
   Two things:
  
   1. Try using the fully qualified path (ie /var/www/foo/bar.php 
   instead
   of
   foo/bar.php)
   2. Look at setting up autoloading so you don't need to manually
 include
   anyway. If you're going OOP, autoloading is a must!
 
  I totally disagree. I have been doing OOP with PHP for years, and I 
  have
  never used autoloading. It is just a feature that can be used, misused
 or
  abused just like any other. I choose not to use it, and my code does 
  not
  suffer in the least!
 
  --
  Tony Marston
  http://www.tonymarston.net
  http://www.radicore.org
 
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 



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


 



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



Re: [PHP] Re: PHP, OOP and AJAX

2009-05-28 Thread Ashley Sheridan
On Thu, 2009-05-28 at 16:17 +0300, Olexandr Heneralov wrote:
 Hi!
 Do not use low-level AJAX.
 There are many frameworks for ajax (JQUERY).
 Try to use PHP frameworks like symfony, zend framework. They simplify your
 work.
 
 
 2009/5/28 Lenin le...@phpxperts.net
 
  2009/5/28 kranthi kranthi...@gmail.com
 
  
  
   i recommend you firebug firefox adddon (just go to the net tab and you
   can see all the details of the communication between client and
   server)
   and i find it helpful to use a standard javascript(jQuery in my case)
   library instead of highly limited plain javascript  language
  
  I also recommend using FirePHP with FireBug here's a nicely written
  tutorial
  on how to use them both together for Ajax'ed pages. http://tr.im/iyvl
  Thanks
  Lenin
  www.twitter.com/nine_L
 
Real coders use low-level ajax... and code with rocks too ;)


Ash
www.ashleysheridan.co.uk


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



[PHP] Re: PHP OOP

2009-02-10 Thread Ondrej Kulaty
I don't think that PHP is good language for teaching OOP as many folks above 
said. I have never programmed in OOP style but i plan to learn it. I started 
in PHP but i was little confused and i am used to program in procedural way 
in PHP, so i've decided to learn some pure OOP language. I am reading a book 
OOP Demystified, there are examples in both C++ and Java. And imo Java code 
is much more readable and understandable. So i think that Java is the best 
for learning OOP. I am also considering learning C#, if you dont mind that 
it's closely related to windows, it might be also a good choice.
-- 

tedd t...@sperling.com píse v diskusním príspevku 
news:p0624080dc5b5fff1c...@[192.168.1.101]...
 Hi gang:

 At the college where I teach, they are considering teaching OOP, but they 
 don't want to settle on a specific language.

 My thoughts are it's difficult to teach OOP without a language -- 
 while the general concepts of OOP are interesting, people need to see how 
 concepts are applied to understand how they work -- thus I think a 
 specific language is required

 I lean toward C++ because I wrote in it for a few years AND C++ appears to 
 be the most common, widespread, and popular OOP language.

 However, while I don't know PHP OOP, I am open to considering it because 
 of the proliferation of web based applications. My personal opinion is 
 that's where all programming is headed anyway, but that's just my opinion.

 With that said, what's the differences and advantages/disadvantages 
 between C++ and PHP OOP?

 Cheers,

 tedd


 -- 
 ---
 http://sperling.com  http://ancientstones.com  http://earthstones.com 



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



[PHP] Re: PHP OOP x Procedural Performance

2003-05-30 Thread rush
William N. Zanatta [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]

   It is a known issue that function calls are expensive for the processor.

   The OOP let us better organize the code but, thinking in function (or
 method) calls it may be more expensive than in the procedural form.

   My question is, has anyone made any tests regarding the performance of
 OOP versus procedural language? Is it a good choice to code in OOP with
 PHP ?

I would say, that web app model is so inefficient in itself, that you can
hardly do anything to make things significantly worse or better performance
wise. Also OOP is extensively used in other environments, and unless you are
coding critical device drivers, it is rarely to expensive in terms of
processing time.

So my advice would be use OOP, and take benefit of better organization of
your code.

Just my 2c.

rush
--
http://www.templatetamer.com/





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



RE: [PHP] Re: PHP OOP x Procedural Performance

2003-05-30 Thread Joe Stump
In my experience OOP isn't any faster/slower. I've used it on sites that get
30M hits a month; so if it's gonna break I'd have seen it by now.

One thing I'd like to abundantly point out is that NOT EVERYTHING BELONGS IN
OOP! For instance, if you're building classes that output HTML - you've
skipped a few chapters in your OOP design books.

OOP with PHP is lacking as far as complex application development (PHP5
looks to fix this), but it works great for base classes. I usually program
CORE functionality in OOP (ie. Basket for e-commerce which keeps track of
users' baskets). The rest of the code is procedural (ie. code that does
basic math and organizes the page).

--Joe

--
Joe Stump [EMAIL PROTECTED]
http://www.joestump.net
Label makers are proof God wants Sys Admins to be happy.

-Original Message-
From: rush [mailto:[EMAIL PROTECTED]
Sent: Thursday, May 29, 2003 8:02 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Re: PHP OOP x Procedural Performance


William N. Zanatta [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]

   It is a known issue that function calls are expensive for the processor.

   The OOP let us better organize the code but, thinking in function (or
 method) calls it may be more expensive than in the procedural form.

   My question is, has anyone made any tests regarding the performance of
 OOP versus procedural language? Is it a good choice to code in OOP with
 PHP ?

I would say, that web app model is so inefficient in itself, that you can
hardly do anything to make things significantly worse or better performance
wise. Also OOP is extensively used in other environments, and unless you are
coding critical device drivers, it is rarely to expensive in terms of
processing time.

So my advice would be use OOP, and take benefit of better organization of
your code.

Just my 2c.

rush
--
http://www.templatetamer.com/





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



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



RE: [PHP] Re: PHP OOP x Procedural Performance

2003-05-30 Thread Johnson, Kirk
 One thing I'd like to abundantly point out is that NOT 
 EVERYTHING BELONGS IN
 OOP! For instance, if you're building classes that output 
 HTML - you've
 skipped a few chapters in your OOP design books.

Joe,

I am curious about this opinion, could you elaborate a bit, please? I am not
an OOP programmer, and I'm just interested in your thoughts on this, if you
have time.

Kirk


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



RE: [PHP] Re: PHP OOP x Procedural Performance

2003-05-30 Thread Joe Stump
Sure ...

I'm of the belief that OOP (in PHP anyways) has great use for core
libraries. Core libraries, by their nature, generally don't output HTML.
It's a core libraries job to separate logic and presentation. How portable
is your library that outputs HTML for a guy who wants PDF/WAP/XML output?

For instance, I have a product class that does various things to format
product *data* prior to my procedural scripts putting it into my Smarty
templates. If that product class outputted the data in HTML it would be
useless to me for WAP users or a script that generated PDF versions of our
online catalog.

--Joe

--
Joe Stump [EMAIL PROTECTED]
http://www.joestump.net
Label makers are proof God wants Sys Admins to be happy.

-Original Message-
From: Johnson, Kirk [mailto:[EMAIL PROTECTED]
Sent: Thursday, May 29, 2003 8:21 AM
To: 'Joe Stump'; [EMAIL PROTECTED]
Subject: RE: [PHP] Re: PHP OOP x Procedural Performance


 One thing I'd like to abundantly point out is that NOT
 EVERYTHING BELONGS IN
 OOP! For instance, if you're building classes that output
 HTML - you've
 skipped a few chapters in your OOP design books.

Joe,

I am curious about this opinion, could you elaborate a bit, please? I am not
an OOP programmer, and I'm just interested in your thoughts on this, if you
have time.

Kirk



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



RE: [PHP] Re: PHP OOP x Procedural Performance

2003-05-30 Thread Michael Sweeney
Joe, 

I mostly agree with your opinion. But remember that a method in an
object that has output doesn't have to print the output - it can return
it instead and the calling function can then either display the output
or do something else with it. And if it makes sense to have a method
return HTML, another developer can override that method so that it
returns XML. Or yet another method could take the HTML output of the
first one and convert it to PDF. 

The question, I think, is about figuring out the most effective place to
do what solves the problems. I'm afraid that saying You should never
ever ever write an OOP method that has HTML in it's output is so rigid
that it might make the development process more difficult and complex
than it needs to be.

Michael

On Thu, 2003-05-29 at 11:28, Joe Stump wrote:
 Sure ...
 
 I'm of the belief that OOP (in PHP anyways) has great use for core
 libraries. Core libraries, by their nature, generally don't output HTML.
 It's a core libraries job to separate logic and presentation. How portable
 is your library that outputs HTML for a guy who wants PDF/WAP/XML output?
 
 For instance, I have a product class that does various things to format
 product *data* prior to my procedural scripts putting it into my Smarty
 templates. If that product class outputted the data in HTML it would be
 useless to me for WAP users or a script that generated PDF versions of our
 online catalog.
 
 --Joe
 

 
 -Original Message-
 From: Johnson, Kirk [mailto:[EMAIL PROTECTED]
 Sent: Thursday, May 29, 2003 8:21 AM
 To: 'Joe Stump'; [EMAIL PROTECTED]
 Subject: RE: [PHP] Re: PHP OOP x Procedural Performance
 
 
  One thing I'd like to abundantly point out is that NOT
  EVERYTHING BELONGS IN
  OOP! For instance, if you're building classes that output
  HTML - you've
  skipped a few chapters in your OOP design books.
 
 Joe,
 
 I am curious about this opinion, could you elaborate a bit, please? I am not
 an OOP programmer, and I'm just interested in your thoughts on this, if you
 have time.
 
 Kirk



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



Re: [PHP] Re: PHP OOP x Procedural Performance

2003-05-30 Thread rush
Joe Stump [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Sure ...

 I'm of the belief that OOP (in PHP anyways) has great use for core
 libraries. Core libraries, by their nature, generally don't output HTML.
 It's a core libraries job to separate logic and presentation. How portable
 is your library that outputs HTML for a guy who wants PDF/WAP/XML output?

 For instance, I have a product class that does various things to format
 product *data* prior to my procedural scripts putting it into my Smarty
 templates. If that product class outputted the data in HTML it would be
 useless to me for WAP users or a script that generated PDF versions of our
 online catalog.

Core libraries are of course first candidate for OOP, but I think there are
many other places where you can use it successfully. Take for instance how
it is used in TemplateTamer.

In it, you define a class responsible for the generation of the page. In
typicall usage you have a common class that all page classes inherit from,
and which defines elements of page common to all pages on the site, and
specific page classes implement only the parts they differ in. When the site
grows, it is common to refine the hierarchy of page classes, so you have one
page class on the top, then a few below it describing main sections of the
site, and then on the bottom concrete page classes.

Another OOP usage in TT can be in creating classes that represent GUI
components. For instance on one site I have worked, I have created a
JobAdForm object, that handles for reponsible displaying form and editing of
JobAd object. Than when I needed similar but litle more extended version for
superuser pages, I have just created a subclass SuperuserJobAdForm, and
overided necessary parts, but inhertied 95% of code.

So I think there is usage for OOP also in gui parts of the code, where it
can also help better organization of code, and reuse between the pages or
components on the same site.

rush
--
http://www.templatetamer.com/




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



RE: [PHP] Re: PHP OOP x Procedural Performance

2003-05-30 Thread Dan Joseph
Hi,

From my personal recent experience, I can tell you that processing a lot of
echo's thru classes is a heck of a lot slower than just doing it the normal
way.  Although I wouldn't have done this particular project any other way, I
do with that I could get it to display faster.  Its not a big deal, just
bugs me.  Its really personal preference though.

-Dan Joseph


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



[PHP] Re: PHP OOP design question

2003-03-04 Thread neko
Answer - use PEAR for both your database connection and as a data modeling
layer:

http://pear.php.net

check the documentation for more info.

neko

Joseph Szobody [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
I have several web projects that are all database driven. I have recently
been diving into OOP, and rewriting a lot of procedural code in OOP. I have
a design question about handling the MySQL connection.





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



Re: [PHP] Re: PHP OOP

2002-09-04 Thread René Moonen

Rodrigo Dominguez wrote:

I made a mistake while I was writting the example, in my original code I
wrote it as you did, with $this-b[0] = new one(); but it doesn't work.
Thank you.

Philip Hallstrom [EMAIL PROTECTED] escribió en el mensaje
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  

Not tested, but what if you change

 $b[0] = new one();
 $b[1] = new one();

to:

 $this-b[0] = new one();
 $this-b[1] = new one();

On Tue, 3 Sep 2002, Rodrigo Dominguez wrote:



I have a problem, I can't create an array of classes into a class, for
example:

class one {
var $a;

function foo() {
echo foo;
}
}

class two {
var $b;

function initialize() {
$b[0] = new one();
$b[1] = new one();
}
}

$test = new two();
$test-initialize();

$test-b[0]-foo();  //It doesn't work
$test-b[1]-foo();  //It doesn't work

Any suggestion?




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

  




  


Eh.. unchecked code, but what about:

$this-b[0] = new one;
$this-b[1] = new one;

$test = new two;


Instead of
$this-b[0] = new one();
$this-b[1] = new one();

$test = new two();

If no luck try to include 
error_reporting(E_ALL);
as first line of your script.


Good luck


René



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




[PHP] Re: PHP OOP

2002-09-03 Thread Philip Hallstrom

Not tested, but what if you change

 $b[0] = new one();
 $b[1] = new one();

to:

 $this-b[0] = new one();
 $this-b[1] = new one();

On Tue, 3 Sep 2002, Rodrigo Dominguez wrote:

 I have a problem, I can't create an array of classes into a class, for
 example:

 class one {
 var $a;

 function foo() {
 echo foo;
 }
 }

 class two {
 var $b;

 function initialize() {
 $b[0] = new one();
 $b[1] = new one();
 }
 }

 $test = new two();
 $test-initialize();

 $test-b[0]-foo();  //It doesn't work
 $test-b[1]-foo();  //It doesn't work

 Any suggestion?




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



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




[PHP] Re: PHP OOP

2002-09-03 Thread Rodrigo Dominguez

I made a mistake while I was writting the example, in my original code I
wrote it as you did, with $this-b[0] = new one(); but it doesn't work.
Thank you.

Philip Hallstrom [EMAIL PROTECTED] escribió en el mensaje
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Not tested, but what if you change

  $b[0] = new one();
  $b[1] = new one();

 to:

  $this-b[0] = new one();
  $this-b[1] = new one();

 On Tue, 3 Sep 2002, Rodrigo Dominguez wrote:

  I have a problem, I can't create an array of classes into a class, for
  example:
 
  class one {
  var $a;
 
  function foo() {
  echo foo;
  }
  }
 
  class two {
  var $b;
 
  function initialize() {
  $b[0] = new one();
  $b[1] = new one();
  }
  }
 
  $test = new two();
  $test-initialize();
 
  $test-b[0]-foo();  //It doesn't work
  $test-b[1]-foo();  //It doesn't work
 
  Any suggestion?
 
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 




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




[PHP] Re: PHP OOP list

2002-07-23 Thread Manuel Lemos

Hello,

On 07/23/2002 02:35 PM, Mathieu Dumoulin wrote:
 Is there a newsgroup list for PHP and OOP?
 It would be great to split up this large topic and create an OOP specific
 list.

Sure, just send a message to [EMAIL PROTECTED] or 
subscribe in this page:

http://groups.yahoo.com/group/php-objects/join


-- 

Regards,
Manuel Lemos


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