Really simple PHP (sorta) question - Page 2

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

Re: Really simple PHP (sorta) question

Mike Silva wrote:
Quoted text here. Click to load it

Well I take the site seriously...but yes.

Ive written thousands of lines of very serious software in well.

Now that is a 'text editor'

A lot depends on whether your site is 'flashy HTML, with a few calls to
a simple database' in which case Dreamweaver, once you can drive it
well, works.

Or if your site is  a 'massive calls to a database, with a few form
boxes an a lot of lists'

Which mine is.

Even if its both, you would be likeley to e.g. code the compute
intensive bits with a  text editor, an then incorporate them in a
separate file and do the arty bits in dreamweaver.

Quoted text here. Click to load it

Re: Really simple PHP (sorta) question

The Natural Philosopher wrote:
Quoted text here. Click to load it

Don't take me wrong I am not a DW apologist, but I don't understand the
reluctance to using DW code editor as opposed to a text editor.  I have
been using it for several years and it does not add any extra code, no
more then an IDE formatting does.
Just curious.


Re: Really simple PHP (sorta) question

Quoted text here. Click to load it

This is beginning to make more sense now.  I can certainly see the
benefits to editing code in a text editor, especially a language-aware
editor.  And it seems most productive for somebody like me to get the
"arty bits" going with WYSIWYG.  And I need to get productive here

So would I be drawing valid conclusions to conclude that I should be
editing "traditional code" (data manipulation stuff) with traditional
code editing tools, and HTML look-and-feel stuff with WYSIWYG tools?


Re: Really simple PHP (sorta) question

Mike Silva wrote:
Quoted text here. Click to load it

You can do HTML with look-and-feel stuff, but be prepared to go back and
clean it up.  I have yet to see one which does a good job, especially
when the CSS gets a bit complicated.

Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.

Re: Really simple PHP (sorta) question

Jerry Stuckle wrote:
Quoted text here. Click to load it

This is essentially down to who is  the master.

My wife writes dreamweaver stuff, and it needs huge cleanups. Because
she doesnt really understand HTML, and just frigs till things look good.
Which they do.

Then you find its full of empty blocks, and there is a style statement
in every one.

So you try and build a style sheet..

I go the other way.

I have a library of not especial;y good coded nits like this

function check_box($x,$y,$label,$name,$value,$width)
<div class=" menu" style="position: absolute; left: <?echo $x;?>px;
top:<?echo ($y);?>px; width:<?echo $x1;?>px; height: 19px;
text-align:right; font-weight: bold;">
<?echo $label?>:</div>
<div style="position: absolute; left: <?echo ($x+$x1+14);?>px;top:<?echo
($y+4);?>px; width:<?echo ($width-$x1);?>px; height:19px;">
<input type="checkbox" name="<?echo $name;?>" value="yes" <? echo
($value? checked:"") ?>></div>    

which draws a tickable box with a standard label at preset coordinates
in a specified style, sets up a name for it and a value..

Instead of using a mouse to drag my elements around, I simply vary x and
y to get it lined up and do a save/reload on the screen in question to
check it

Its no slower ;-)

I you are building forms I really recommend this sort of approach. You
could probably do it more object oriented and elegant, but it works for me.

Re: Really simple PHP (sorta) question

The Natural Philosopher wrote:
Quoted text here. Click to load it

   I have a simple class I wrote where I just initialize it with field
names. Optionally field types, sizes, labels, and whatever other
properties a form element may have.

   That creates an editible form in a two column table with the labels
in the first column and the form elements in the second. Usually I just
style everything as a descendant of that table. Sometimes I'll need to
rearrange the html, so I'll just copy the html out of the generated page
and do that.

   I've expanded this enough so that I can account for image and file
uploads and generate thumbs and change paths as needed, just by changing
the object initialization.

   Works for me and my clients. I can set up a complex form and have all
the database backend in a matter of minutes. It's my third or fourth
generation form maker (the others are in perl) and I expand it as
needed, for example I can display all data in a table with suitable
headers and make any or all fields ajax editable.

   Everyone has their own needs, but making the tools you need will save
enormous amounts of time in creation and debugging, down the road.

   Form making is one of those tasks that programmers have to do over
and over again.

Quoted text here. Click to load it

Re: Really simple PHP (sorta) question

Quoted text here. Click to load it

I used to let my team choose the tools/OS they wanted to use when
doing dev work. Typically the web designers used dreamweaver but the
PHP programmers were split (mostly) between those using vi on linux
and Zend IDE on Windows (there were a couple of Windows users with
other code editors - notepad++ and another one I can't remember the
name of). What was interesting was seeing the differences resulting in
the development process and the code being produced.

Those using text editors (vi(m) does do syntax highlighting and code
prompting) tended to produce cleaner code and incorporated more
instrumentation into their code to see how it was behaving - this was
particularly useful when analysing how the code was behaving post-
deployment, while those using IDEs tended to rely on the code debugger
far more. Although the results were far from clear-cut, the IDE users
seemed to work on a far more empirical level and seemed to spend
longer resolving unit-tests. The differences in productivity overall
were not significant. Unfortunately I did not have the opportunity to
refine metrics or to measure thelong term effect of forcing the
developers to use a different environment. So I can't say if this was
a result of the tools they were using or whether they chose tools
which aligned with their thinking processes.

I guess that if you are a team of one, then the solution is to use the
tool that works for you.

Both camps of PHP developers used PHP MySQLAdmin for SQL work.

Certainly, I'd say that you should use different tools for graphical
layout, code editing and database work.


Re: Really simple PHP (sorta) question

Mike Silva schreef:
Quoted text here. Click to load it

I'm using Notepad++ here.

Re: Really simple PHP (sorta) question

Mike Silva wrote:
Quoted text here. Click to load it

In my case, a bad assumption.

Re: Really simple PHP (sorta) question

Mike Silva schreef:
Quoted text here. Click to load it

ZDE here: Zend Development Environment.
But you'll have to pay for it, and it is not really worth it considering
the amount of nice IDEs out there for free...

If you pick your IDE, pay attention to:
1) syntax highlighting (This gives you visual/color clues: eg:
functionname, Classdefinition, simple variable, etc etc)
2) Nice to have: Function integration. EG: If I type:
my IDE will show up a bunch of functions/constants definined in my
project and in PHP itself. I can simply pick the one I need.
This avoids typos, but what is more, it also shows WHICH variables I
should pass to the function. I like that. Increases productivity because
it saves me a trip to (or my own functions) to look up the function.
An IDE that offer this will also scan the files in your project and
build a list of functions/classes defined in there, ready for you to use.

ZDE has that all, and that is why I bought it. ($100 or so).

Above all: Be sure you know your way around at:
When in doubt, come back here. :-)
comp.lang.php is a friendly group and you can easily get expertadvise if
you post the right way (polite and show us all what you tried. Some
people post here to get us doing their homework. ;-) We spot them right

Enjoy your PHP career. :-)

Erwin Moller

"There are two ways of constructing a software design: One way is to
make it so simple that there are obviously no deficiencies, and the
other way is to make it so complicated that there are no obvious
deficiencies. The first method is far more difficult."
-- C.A.R. Hoare

Re: Really simple PHP (sorta) question

First, when it comes to actually installing a server for testing,
DON'T use one of the bundles (like XAMPP)... install MySQL, Apache,
and PHP seperately from their respective websites and take the extra
effort to learn to configure them to work together.

Second, try the free ActiveState Komodo Edit - I've been through
Eclipse and Zend Studio and fancy IDEs as well as text editors, and I
keep coming back to Komodo... I use it for PHP, Python, straight SQL
coding, ActionScript... it supports numerous languages.

Also, NetBeans recently added PHP support and a live debugging
feature, though I've just taken a peek and have not worked with it

Quoted text here. Click to load it

Re: Really simple PHP (sorta) question

(Sorta-off-topic question not about PHP but about editing HTML source.)
Quoted text here. Click to load it

I personally *do* just use a text editor:
  [Macintosh] = McSink
  [Unix, Linux] = emacs
  [MS-Windows] = NotePad
The key to avoiding mismatched tags is *always*, and I mean
*always*, whenver you type in the open tag, *immediately* type in
the matching close tag, and **then** start filling the stuff
between. Never fill in the middle before typing the close tag,
because you'll forget it, and then your HTML won't nest properly!!
In fact, after typing the open tag, press RETURN/ENTER twice to
make a blank line under it, sweep the open tag with mouse, copy and
paste down two lines (after the blank line), manually fill in the /
needed, and you'll never have a close tag that is mis-spelled
relative to the open tag.

Also, make liberal use of copy-and-paste of entire templates that
have matching open/close tags already. Copy the template once,
alternately paste and RETURN/ENTER to put multiple copies on
consecutive lines, then manually replace the dummy components
within each copy of the template.

Alternately if you get a table of data values in some regular
format, convert the various boilerplate parts of it to HTML by
search-and-replace command. For example, I often list a GeoCities
directory like this:
   [_]   PortlandOregonViewE.JPG View Aug 19 10:24pm   4
   [_]   SafewayLogoE.GIF View Aug 19 10:24pm   3
   [_]   Singapore-skylineE.JPG View Aug 19 10:24pm   5
   [_]   SingaporeLocateEJ.JPG View Aug 19 10:24pm   12
   [_]   SingaporeViewE.JPG View Aug 19 10:24pm   6
   [_]   SunnyvaleLocateE.GIF View Aug 19 10:24pm   8
and I want to convert it to look like this sample line (from an
earlier line of HTML):
href=" ">(8)</a>
so I split that sample line into boilerplate pieces like this:
<a href=" /
and then those three pieces are replaced within the new data lines as follows:
'   [_]   '                -->  '<a
href=" /'
' View Aug 19 10:24pm   '  -->  '">('
<newline>                  -->  ')</a>'<newline>

Of course if I ever had time to write a HTML parser, I'd just
download the GeoCities directory in source (HTML) format, parse it
to DOM, and then write a script that traversed the DOM to
automatically find all the pieces I need, and the automatically use
those pieces in the DOM to construct the HTML I need. Maybe I'll do
that next week.

Back to manually-constructed HTML via text editor: When I write the
opening PHP-scriptlet tag, I immediately write the closing tag that
matches it, so I have a valid PHP file even if it doesn't do what I
want yet (the scriptlet is currently empty), and I don't accidently
forget to end my scriptlet. Also, when I use inverted in/out logic,
dropping out of a scriptlet temporarily to block-echo some text, I
write the closing tag then immediately write the
get-back-into-script opening tag after it, some of the time anyway.

Site Timeline