Archive for the ‘php’ Category

mailing with php

April 19, 2006

We hate it when things are more difficult than they should be. (And who is to gauge how difficult it should be? We should!)

That's how it was in our latest struggle through the Great App that will Solve all Problems (GASP). One of the last things we chose to implement in the GASP is a mailto function that will mail an internal user when an external user does something. Sounds easy, yes? And in fact, it is. But it took us a while to get there. Because we learn everything the hard way.

So to keep anyone else from going through the crap we went through: make sure the server you are working on will send out mail before you go nuts trying to make it work. That might seem obvious to others. But remember: we learn things the hard way. Having an external, private server can help immensely on this. Before you fuss about scripts that don't work, test them on a server you know is good.

So what did we use, what did we learn? Mailing something in php is a snap. Just use the mail() function. Do not listen to all the other crap out there about needing x number of files to get shit done. Use the friggin mail() function. It goes mail($to, $subject, $message).

That said, the Surreal-Atmosphere tutorial was very helpful. So thank you for taking apart a small script and kicking it around until it made sense.

Many people apparantly found the emailform.php script very useful. That may be. We did not. We also did not find Jack's FormMail.php useful. But both of these failures were, most likely, due to the server we were developing on.

Lastly, if you need more features in mailing, you might want to check out PHPMailer on sourceforge. They seem like there's a lot there to work with. And they have docs, which makes our cold blackened hearts happy. 

php nuke themes: finding themes online

February 19, 2006

Here is a drive-by post to capture some info on php nuke themes. These, right now, are for us the most difficult thing to conquor. CreatingOnline has some free (and paid) themes to download and mess with. The official php nuke site, of course, has its whole themes section, but we haven’t found much good to work with yet. We tried Spidean’s AutoTheme, which we had greats hopes for. It allows you to plug in their theme and tweak it as you go, but the downside is that their interface is very kunky. But then, when its free you get what you pay for, eh? And we have liked what we have found at Designs4Nuke, regarding their downloadable themes. Lastly, there was some stuff on Portal Themes that looked interesting too.

php-nuke, building the theme

January 27, 2006

For our most beloved and endering site, we are moving from a static system to a more interactive system. This is the site we lovingly brought up from horrific, structureless HTML a few years back, to some templated PHP a few years back. Now it is time to grow some more.

And we’ve chosen (for now, at least) to go with PHP-Nuke. We’ve been told by our friend ‘neka that Nuke is the shit for a while. So we are going for it.

First thing out the box (so to speak), is that we need to customize the theme, so that it looks all nice and purdy. Turns out that it is no small task in Nuke. (thanks, neka…). So here we go. You can download themes at NukeThemes, and then, I guess, customize as you go. That is certainly something we have considered. We also thought about reading through the standard PHP-Nuke docs on managing themes. We are certain we shall be trollign those soon enough. But we also found a nice freebie “auto-generator” that we are more than willing to try, called AutoTheme. Spidean, the comapny that makes AutoTheme, also has some downloadable themes and other nice stuff for free.

Another task we will soon have to conquor is futzing the with the modules of nuke. So we were pleased to find Lenon.com’s Module Maker. They also have a fair set of other nuke tools we might be using in the future.

php grab bag: more stepping stones for project X

December 15, 2005

Here’s one that we’ve come across before, and used before, and yet we had to learn this little business again: addslashes(). Use addslashes when you want your forms to take in whatever a user inputs to your forms. We used this previously to help thwart hacker attacks — using addslashes prevents users from inputting SQL code into your forms and screwing up your databases. Anyway, Harry Feucks makes a strong point about using addslashes vs. magic quotes.

We used a handy bit of a hack from A List Apart for aligning a form without tables, aligning a form with CSS using cross-floats and such.

We found some offhand PHP tutorials at tizag helpful this time around. They have an interesting argument for ASP v. PHP, though we have used both and find PHP to be perfectly great and robust for any size project. We also found their MySQL tutorials helpful as well.

Lastly, we have had some code examples from PHP freaks on our desktop for a while. We haven;t tried any of them, but we wanted to make sure they were noted before the links went away. There is their PHP hit counter. Their expanding and collapsing menus look interested (and might be helpful in another project where Eric Meyer’s menus don;t seem to be cutting the muster). And then there is their PHP calendar, though we have been loving PHP iCalendar (except for a few small bits we’d rather not get into right now).

MySQL / PHP handy reference

December 6, 2005

We work a lot with MySQL and PHP. WEll, not as much as we’d like, but we are learning. And we are getting better. But in the mean time, we use a lot of references, including many online ones. Here are some handy things we recently came across to help us with a trouble ticket application we are building, some of which is embarrasingly simple and basic, but it helps to write it out:

MySQL manual on INSERT.

A very nicely laid out set of things you can do with your records from the Institute for Information Systems and and Computer Media. Includes some easy examples.

FAQTS has some good PHP FAQs going, including this nice reminder on how to access the last record in a table. Note: the queries on this page have a type. It should read “mysql_query” instead of what’s lsited.

Computing dot net helped clarify that  one should use mysql_num_rows, and not mysql_numrows.

We learned a bit about the necessity of using mysql_fetch_row for this early part of the project. PHP Addict helped us crack through the maddness in their help forum. The good folks at Zend (the PHP folks themselves) had many good examples for it. But it was Larry Ullman (whose PeachPit books are nice) who empahsized that it (or something like it) is always needed: “What you are printing is just a resource ID. You ALWAYS have to use mysql_fetch_array() to access the actual returned information“. For good measure, here is the PHP manual entry on mysql_fetch_array().