eclipse: need example code, or any OO example code – PHP

  php

Q(Question):

I’ve downloaded and am now studying the Eclipse class libary. It looks
very elegant and well done. But as I am somewhat new to OO, I’d like
to see some example code. Documentation is thin, save that generated
by PHPdocs.

Can anyone show me some sample code? I’m mostly interested in how
other people set up their software – what objects call what objects?
What are other programmers doing in their web projects? Is it common
for people to mix OO and procedural code in their web projects? Those
who’ve gone the pure OO route, can I see the constructor for your main
object?

A(Answer):

"rush" <pi**@rush.avalon.hr> wrote in message

Where MySitePage defines, things that are common fro every page on your
site, UserPage adds things specific to the part of the site for users, etc..
You can also use classes to define components that get used on many pages,
like page counters, or menu.

You could find some simple examples of the pages on the TT page. (maybe I
will add some more describing some possible organizations of the app, it
sounds like a good idea).

I like the sound of your IDE, but what language is it in? Will it run
on a Windows PC?

A(Answer):

"lawrence" <lk******@geocities.com> wrote in message
news:da**************************@posting.google.c om…

"rush" <pi**@rush.avalon.hr> wrote in message
I like the sound of your IDE, but what language is it in? Will it run
on a Windows PC?

IDE runs on windows, and let’s you use and generate PHP 4.x code, and you do
not need anything speciall on the server besides regular html server with
PHP support.

On the windows development machine you will also need html server with php,
and Internet explorer if you would like to preview generated pages. The IDE
itself is written in Smalltalk (but this is just language it is implemented
in, like for instance your favouriute editor is perhaps implemented in C but
it lets you write php source code).

If youhave any further questions please do not hesitate to contact me,

rush

http://www.templatetamer.com/

A(Answer):

"rush" <pi**@rush.avalon.hr> wrote in message news:<be***********@as201.hinet.hr>…

"lawrence" <lk******@geocities.com> wrote in message
news:da*************************@posting.google.co m…

"rush" <pi**@rush.avalon.hr> wrote in message
I’ve tried it out some. I like its complete listing of all functions
and classes. But it lacks certain basic text editing abilities, like
to indent a block of code.

hm.., you select the code and press the tab (or shift tab if you would like
to un-indent), if that is what you need? Also columl selection (rectangular)
can be done by holting an alt key and selecting with mouse. Maybe it is not
bad idea to add this to the faq.

Ah, I was looking around for a button or something. Thanks much. I’m
testing it out today. What is in the professional version?

A(Answer):

"lawrence" <lk******@geocities.com> wrote in message
news:da**************************@posting.google.c om…

"rush" <pi**@rush.avalon.hr> wrote in message
news:<be***********@as201.hinet.hr>… Ah, I was looking around for a button or something. Thanks much. I’m
testing it out today. What is in the professional version?

functionality wide it is a same thing, the only difference is that it does
not include promo dialog box for pro version, and it does not include TT
footer on the generated pages.

rush

http://www.templatetamer.com/

A(Answer):

With total disregard for any kind of safety measures
lk******@geocities.com (lawrence) leapt forth and uttered:

I’ve downloaded and am now studying the Eclipse class libary. It
looks very elegant and well done. But as I am somewhat new to
OO, I’d like to see some example code. Documentation is thin,
save that generated by PHPdocs.

Can anyone show me some sample code? I’m mostly interested in
how other people set up their software – what objects call what
objects? What are other programmers doing in their web projects?
Is it common for people to mix OO and procedural code in their
web projects? Those who’ve gone the pure OO route, can I see the
constructor for your main object?

Are you referring to the Eclipse library by Vincent Oostindie?

Its not particularly hard to use as the Iterator and Database
classes work the same way across the board.

Heres an example using a MySQL database:

<?php

include_once(‘./MyDatabase.php’);
include_once(‘./QueryIterator.php’);

$db =& new MyDatabase(‘db_name’, ‘localhost’);

if (!$db->connect(‘db_user’, ‘db_pass’)) {
die(‘Database error: ‘ . $db->getErrorMessage());
}

$query =& $db->query(‘SELECT * FROM table’);

if($query->isSuccess()) {
for($it =& new QueryIterator($query); $it->isValid(); $it->next()) {
$data =& $it->getCurrent();
echo $data[‘column_name’];
}
} else {
die(‘Query error: ‘ . $query->getErrorMessage());
}

?>

Using the array iterator is the same sort of thing:

<?php

include_once(‘./ArrayIterator.php’);

$array = $_SERVER; // Just as an example

for($it =& new ArrayIterator($array); $it->isValid(); $it->next()) {
$data =& $it->getCurrent();
echo $data[‘key’];
}

?>


There is no signature…..

A(Answer):

Phil Roberts <ph*****@HOLYflatnetSHIT.net> wrote in message

A good place to go to pick up information about the Eclipse library
is http://sitepointforums.com/, as until recently the author was a
fairly regular poster there. Heres one particular thread where he
goes into a lot of detail about OOP in general and throws some
examples from Eclipse into the mix:

http://sitepointforums.com/showthrea…threadid=59898

Outstanding information on that page, especially by the Eclipse
author. I find that looking at the code of Eclipse is like getting a
free education in truly good OOP thinking. I often have trouble
reading other people’s code, but his code is unusually simple and
elegant.

Thanks for the tip.

LEAVE A COMMENT