KBD

Keith Devens .com

Saturday, August 30, 2008 Flag waving
When your enemy is making a very serious mistake, don't be impolite and disturb him. – Napoleon Bonaparte (allegedly)
← The sky is falling!Leaving PHP for Python →

Daily link icon Saturday, November 15, 2003

It's like beating your head against a wall...

I don't know why I thought things would be different in this round of trying to fuck with PHP until it does what I want.

Now Smarty is doing weird and unexpected things on me. I'm trying to use arrays, and it's "flattening" them... whenever I want to do an operation on the array (such as a foreach loop, or displaying the array variable with a modifier applied to it), it's mapping over the elements of the array rather than letting me use the whole array at once. I've looked at the code and this is exactly what it's programmed to be doing.

This totally blows my mind. Why does everything having to do with PHP just suck?


Seriously, does anyone have anything to say that can make me feel better? Because I think PHP is permanently damaging my brain chemistry.

← The sky is falling!Leaving PHP for Python →

Comments XML gif

Simon Willison (http://simon.incutio.com/) wrote:

You already know that Python is a much nicer language to work with than PHP. mod_python hosting is rare, but most hosts that allow CGIs have a version of Python installed somewhere. Of course, the problem with CGI is that it has lousy performance. A trick I've been using recently is to build Python applications which have admin interfaces implemented in CGI that generate static pages for viewing by the general public - in fact I rolled out a new system at work today that does exactly that (for managing photo galleries). Best of all, Python's module system makes it pretty easy to write code for these static CGI apps that can later be ported to a dynamic mod_python solution with (I'm hoping) relative ease.

The downside of this technique is that it doesn't work for pages that need to be served dynamically. Of course, if you wanted to be really interesting you could always use Python to generate static PHP files with dynamic behaviour...

∴ Simon Willison | 15-Nov-2003 7:52pm est | http://simon.incutio.com/ | #3278

Keith (http://keithdevens.com/) wrote:

I definitely don't want to go the CGI-that-generates-static-pages route. I'd rather have a few dynamic scripts than thousands of static pages.

I'm going to rewrite my CMS in mod_python + Cheetah, and see if that meets my needs. I'm looking seriously now at Hard Hat Hosting, which I'm almost sure offers mod_python, as well as CSoft.net, which doesn't by default, but they said they can run a custom instance of Apache for me with mod_python installed and do funky firewall magic so it works (how's that for service?).

Keith | 15-Nov-2003 8:07pm est | http://keithdevens.com/ | #3279

Harry Fuecks (http://www.phppatterns.com) wrote:

Keith,

I disagree that PHP sucks. All languages have pros and cons - about Python you might say it hasn't reached "critical mass" for developing web apps. Others might dislike things like Pythons multiple inheritance. Java is probably the most sane but see you next Christmas when it's done.

There are quite a few skeletons in the closet for PHP4 (such as http://www.edwardbear.org/optimizations) but that doesn't prevent anyone writing good software with it. What PHP4 has going for it is critical mass (you can find at least 80% of what you need in Open Source libraries plus it's installed everywhere) and it's very easy to use / learn / teach.

Smarty is just one template engine (we counted at least 80 public domain alternatives in PHP here).

To tickle your fancy with WACT again - that calendar top right - what if the template for generating it simply consisted of something like this?

<td class="content-right">
<calendar:month class="calendar">
<calendar:title format="%B %Y" class="month" />
<calendar:selecteddaystyle class="linked-day" />
</calendar:month>
</td>

FYI, documented the initial process of developing this tag for WACT here

End of the month will have something to show...

∴ Harry Fuecks | 16-Nov-2003 9:08am est | http://www.phppatterns.com | #3281

Remi wrote:

You can also look at http://www.python-hosting.com for your hosting.
They support most python web apps, including mod_python + Cheetah.

∴ Remi | 16-Nov-2003 3:27pm est | #3285

Keith (http://keithdevens.com/) wrote:

Yeah, I've considered Python Hosting, but I don't think they have PHP available, and I'd still like the ability to use PHP when I want to.

Keith | 16-Nov-2003 3:33pm est | http://keithdevens.com/ | #3286

Sparticus (http://www.iamsparticus.co.uk) wrote:

I love php, because I can't code to save my life. Php however, I can do. Which probably says something about php.

∴ Sparticus | 17-Nov-2003 5:29am est | http://www.iamsparticus.co.uk | #3293

Remi wrote:

Actually, they do have PHP available ...

Check out this page: http://www.python-hosting.com/otherAccount

If you take a python account, they let you run PHP at no extra charge.

∴ Remi | 18-Nov-2003 8:28am est | #3305

Jon Perez wrote:

PHP felt like the greatest thing since sliced bread after I moved to it from Perl.

But after trying out Python, PHP was clearly the inferior language. Tolerable to some extent, but definitely more painful to use.

The people who say PHP sucks most probably have tried PHP after they have used Python.

∴ Jon Perez | 12-Oct-2004 12:58pm est | #5854

Feel free to post a comment below. Please see my comment policy.

Formatting Rules (No HTML):

  • **bold**, *italic*, _underlined_, --strikeout--
  • "text"="url" creates a link, and URLs are auto-highlighted
  • Blockquote: Like e-mail, begin paragraph with > (greater-than sign)
  • Lists: begin paragraph with *,-, or + (unordered), or # (ordered)
  • Code block: ?!code:language=perl|php|sql|javascript|etc.{\n}...{\n}?!/code

:
(will be your IP address if blank)
: (optional)
(Will not be shown on site)

: (optional)
:

August 2008
SunMonTueWedThuFriSat
 12
3456789
10111213141516
17181920212223
24252627282930
31 



RSS feed RSS feed for Keith's Weblog
Atom feed Atom feed for Keith's Weblog
Weblog archive
Recent comments
  on 2 posts

Recent comments XML

new⇒Girls, please don't get breast implants

http://when-3.ofawyib.net​http://girls-24.iniexka.net​http://swingers-4.emy...

Henry: Aug 30, 4:15am

new⇒Johnny Walker Blue Label

Wow, thanks for the scotch review​:D

Lagavulin and Laphroaig are​some of...

Keith: Aug 29, 3:35pm

Generated in about 0.152s.

(Used 8 db queries)

mobile phone