For reasons that will be revealed later... I am currently making a set of php libraries which build (x)html compliant webpages, correctly indented, etc.
Here's a taste of things to come:
php goes in:
$webpage = new webpage('xhtml10_strict', 'Website Title',
'text/html; charset=utf-8');
$webpage->add_style_sheet('Default', 'style.css');
$webpage->print_webpage();
webpage comes out:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>
Website Title
</title>
<meta http-equiv="Content-Type"
content="text/html; charset=utf-8"/>
<link rel="stylesheet"
type="text/css"
title="Default"
href="style.css"/>
</head>
<body>
</body>
</html>Anybody into regex?
function isValidEmail(email) {
return email.match(/^(([\w]+\.?)*[\w])?@
([\w]([\-\w]*[\w])?\.)+
[a-zA-Z]+$/) !== null;
}
(although I guess javascript doesn't actually let me use those line breaks in the middle of a regex definition)
php compile with pear:
./compile ... --with-pear
pear package installation:
sudo pear install -o Mail
sudo pear install -o Net_SMTP
What these are for:
During this past summer, I used Moodle for my Intro to Java course website. Right from the get-go, there were problems with confirmation emails from the system either landing in email spamboxes or just being killed on site by hasty email providers. Why? Moodle uses php's built-in mail sending functions. I was running an smtp server on my computer to send confirmation emails, so emails were originating from my computer.
Apparently my IP address is not trusted by many email providers. This doesn't come as any surprise, as my IP address is dynamically assigned periodically and pretty much every one I've been assigned has probably been in use by major spam bots at some point in the past. Hence why most email providers would just kill the messages on arrival.
So there's an extension library called PEAR which allows me to send mail through an actual email account. It takes a little muscle to get working. PHP needs to be built and installed with it explicitly enabled at compile-time. Then, you have to use the pear command-line tool to get and install the particular extensions that are needed, Mail and Net_SMTP in this case (the instructions above are notes on how to accomplish these tasks).
Seems a little sluggish, but it may just be gmail's smtp servers. Some messages take a long time, others are sent and delivered nice and quick. I'll have to take a deeper look into why this is later.