Archive for September, 2007

Sending an email message with ASP

Here is how you send email in ASP. This will use the local server as teh mail server so just send a test email to yourself and see if it works on your server.

<%Set objMsg = Server.CreateObject("CDONTS.NewMail")

objMsg.From = "My Name <email@domain.com>"

objMsg.To = "email@domain.com" ' who do you want to send to?

objMsg.Cc = "secondEmail@domain.com" ' who do you want to CC?

objMsg.Subject = "Subject line"

objMsg.BodyFormat = 0

objMsg.MailFormat = 0

objMsg.Body = "Email message goes here"

objMsg.Send

Set objMsg = Nothing

%>

Balanced website design idea

The source site for this is: http://www.cravattificio.com

Website Layout Design Idea

This website is very simple and clean. The white background keeps it light and the header graphic balances out the simplicity with a clean, crisp set of photos. The layout of components on the page is elegant, the three-column body looks nice. And I still can’t figure out where tehy set the font for the headings. They have five style sheets and none of them specify the H4 font. If you can find it, could you post it in the comments? I am really curious.

Get size of a file in bytes

Need to know the size of an image or a text file? You can use PHP to get the size of a file in bytes.

<?php$filesize = filesize("local/path/to/file.jpg");

?>

String to Upper or Lower Case in PHP

You can turn any string of text to Upper Case, Lower Case letters. Also use PHP to capitalize the first letter of the string or the first letter of each word in a string.

<?php// Turn entire string to Upper Case Letters
$text = strtoupper($text);

// Turn entire string to Lower Case Letters
$text = strtolower($text);

// Turn first letter in the string to Upper Case
$text = ucfirst($text);

// Turn first letter of every word in the string to Upper Case
$text = ucwords($text);

?>

Simple Cookie script in PHP

Simple cookie script in PHP. Set cookie and get cookie. This is a great way of storing user prefferences, settings and customizations on the site.

<?php// SET COOKIE

setcookie("cookieName1", "cookieValue", time()+60*60*24*30 );
// or do it this way
setcookie($cookieName2, $cookieValue, time()+60*60*24*30 );

// GET COOKIE

$cookie1 = $_COOKIE['cookieName1'];
$cookie2 = $_COOKIE['cookieName2'];

?>