h1

Read Line Breaks in Post

August 26, 2007

To read line breaks (\n) to post, use:

nl2br($result['message']);


From my codix.

h1

Styling Input Boxes

August 26, 2007

This is a CSS3 feature. Therefore, no IE6.

To style a text input box:

input[type=text] {
[insert code here]
}

To style a submit button:

input[type=submit] {
[insert code here]
}


From my codix.

h1

First Letter of a Paragraph

August 26, 2007

To style a first letter of a paragraph:

p:first-letter {
[insert code here]
}


From my codix.

h1

Image Within Boxes

August 26, 2007

boxes.jpg

To attain something like that above using Adobe Illustrator, here’s what you should do:

  1. Path Finder
  2. Shape Modules > Add
  3. Clipping Mask


From my notebook back in DTW.

h1

Auto Hyperlink

August 26, 2007

Honestly, I don’t get all the\\ and the //.function auto_hyperlink($hyperlink) {
$href_link = eregi_replace("([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/&=])", "<a href=\"\\1://\\2\\3\">\\1://\\2\\3</a>", $hyperlink);
$mailto_link = eregi_replace("(([a-z0-9_]|\\-|\\.)+@([^[:space:]]*)([[:alnum:]-]))", "<a href=\"mailto:\\1\">\\1</a>", $href_link);
return($mailto_link);
}
$true_msg = auto_hyperlink($true_msg);


From my codix.

h1

Truncates Sentences

August 26, 2007

This code truncates a paragraph to specified sentences:

$entry = "This is the first sentence. And the second sentence. The third sentence. And the fourth.";
$sentence = preg_split("/[\.\!\?]/", $entry);
for($i=0; $i<count($sentence);>
echo("$sentence[$i]<br />\n");
}</count($sentence);>


From my codix.

h1

Readable Date

August 26, 2007

To make dates from whatever format to human readable format:

$readable_date = date("F d, Y", strtotime($news['news_date']));
echo $readable_date;


From my codix.

h1

Opera Padding Hack

August 26, 2007

According to the magazine I read, Opera has default paddings. To remove them, use these so-called hacks.

For the body:

body {
padding:0;
}

For the ordered and unordered lists:

li, ol, ul {
padding:0;
}


From my codix.