You are here: Re: Confused by mysqli « PHP Programming Language « IT news, forums, messages
Re: Confused by mysqli

Posted by Dodger on 07/05/06 11:38

Erwin Moller wrote:
> Dodger wrote:
>
> > Okay, background... yes, I am another of those evil, spurned, damnable
> > Perl mongers, but I'm not trying to start a flamewar, I'm juust tryung
> > to understand something...
>
> Hi Dodger,
>
> Other helped you with the msql part, but I want to make 1 remark on your
> next comment:
>
> >
> > I can write a script in Perl like so, and it's pretty to me (and the
> > using of the heredocs I think does defend perl against many arguments
> > withthe HTML being all escaped and explicit returns and stuff -- which
> > I can see... 'print "<p class=\"text\">stuff</p>\n";' is terrible to
> > me to.. so I use heredocs), and simple, and fast under mod_perl...
> >
>
> Only people who like to write unreadable code use syntax like that.
> consider:
> print "<p class=\"text\">stuff</p>\n";
> and
> <p class="text">stuff</p>
>
> The latter is the usual normal way if you first jump out of the PHP-tags,
> which every experienced PHP-coder with a sane mind does, for sake of
> readability.
> If you need to jump back to get some variable, do this:
-snip-
> I think that makes great readable code, both from a HTML perspective as from
> a PHP perspective.
> Don't use print and echo for HTML, unless you have some compelling reason.
>
> just my 2 cent.
>
> Regards,
> Erwin Moller

Oh, yeah, I know... I was more coming from the angle of 'Perl can keep
it pretty too, but 98% of perl programmers don't and I don't know why
-- just cause it's one of the things I hear all the time as a complaint
about Perl CGIs... and if you grab scripts off the web, it's true --
but those are usually worth every penny, minus the bandwidth cost, IMO.

Actually I think it's because all the die-hard PHP fans I know have
used the argument once or twice, and so coming into a PHP group I
wanted to point out that I want to be able to do a lot of the stuff I
do in Perl in PHP also, not because I feel a *need* to, but because I
*want* to -- which I hope might garner more respect. But it's
ecumenicism, not conversion.

But yeah, I know the whole

<?php
$var = 'foo';
?>
<p class="blue"><?= $var ?> bar..<br>
for you.</p>

thing... got that out of the box... plus I used to do ColdFusion, which
is a lot the same, and I have dorked around with embedded Perl script
in mod_perl, as SHTML tags, or embperl or even, once, PerlAsp (yuk).

Its just I see people do comparisons a lot and they try and compare
that to this Perl code:
my $var = 'foo';
print "<class=\"blue\">$var bar..<br>\nfor you</p>\n";

and it's just totally the wrong thing people compare with.
The proper thing to make such a comparison would in my case be:

my $var = 'foo';
print <<"EOF";
<p class="blue">$var bar..<br>
for you.</p>
EOF

See, Pretty Perl. Only thing missing is the vim syntax highlighting on
the HTML bits. But you can't have everything, neh? B^)

(
And I prefer the heredocs vastly to the CGI faux-oo approach thing some
people try and push, which is horrible stuff, like:
my $var = 'foo';
print $cgi->p("$var bar", $cgi->br(), "for you.", {class => 'blue'});

That stuff is only useful, IMO, for, like, the popup_menu method and
stuff where just writing out the HTML is a pain.
)

Buy yeah, I want to know how to do this every way, and I figure
branching out to PHP was one of the best starts.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация