PHP

date and time format in Smarty

Sometimes you need to format a value from database into different date format, here's some examples for smarty coders:

{$smarty.now|date_format:"%H:%M"}  13:30
{$smarty.now|date_format:"%I:%M %p"} 1:30 pm
{$smarty.now|date_format:"%A, %B %e, %Y"} Monday, December 1, 2010

Dolphin 7 Module Development: create a block for page builder

I assume you'd installed latest version of dolphin 7, mine is 7.0.4. And also read the tutorial here: http://www.boonex.com/trac/dolphin/wiki/DolphinTutorialMyFirstModule
Now you created your 1st module for dolphin, and would like to create a block for page builder, so your module can have something to appear on the home page. Here's the steps:

PHP: check domain availability

function check_domain($domain) {
if(preg_match('/[;\&\|\>\<]/', $domain)) exit;

exec("whois " . escapeshellarg($domain), $output);
$result = implode("\n", $output);

return (strpos($result, 'No match') !== false);
}
if( check_domain("domain.com")){
//domain.com still available
}

Setup drconcierge.org using Drupal Part 2

In this part, we are going to

Setup drconcierge.org using Drupal Part 1

This is a work log on how I setup drconcierge.org.

In this part, we are going to:

Switching from Wordpress to Drupal

  1. Install latest version of drupal
  2. Install wordpress import module, and Chaos tools module
  3. Export the wordpress blog into XML and start importing. Post -> Story, Page->Page and Comment->Comment
  4. copy wp-content folder to drupal dir, so all images/uploaded files still works

The answer to “Why Do 'Cool Kids' Choose Ruby or PHP to Build Websites Instead of Java?”

This morning I'd read an article with the title: “Why Do 'Cool Kids' Choose Ruby or PHP to Build Websites Instead of Java?”, and I think I may have some opinions on this kind of topic.

Please discuss the following questions with the website owner or business owner first

  1. What is your budget and dead line for this website project?
  2. How many developers/designers involved ?

If there's system architect, ask the following questions

Using Console_Getopt to parse command line parameters in PHP

1st, make sure you have the Console_Getopt installed:

C:\php>pear list
INSTALLED PACKAGES, CHANNEL PEAR.PHP.NET:
=========================================
PACKAGE VERSION STATE
Archive_Tar 1.3.2 stable
Console_Getopt 1.2.3 stable
DB 1.7.12 stable
HTML_BBCodeParser 1.2.2 stable
Log 1.9.11 stable
Net_DNS 1.0.0 stable
PEAR 1.7.2 stable
Structures_Graph 1.0.2 stable

Here’s the sample code:

<?php

$ADODB_CACHE_DIR in Adodb

By default, it's set '/tmp', so if you are using windows, it'll cause this error:
Message: mkdir() [function.mkdir]: No such file or directory
Filename: adodb/adodb.inc.php
Line Number: 1688

Open adodb.inc.php, find the line 
$ADODB_CACHE_DIR = '/tmp';
And change it to a temp directory on windows will fix it.
For example:
$ADODB_CACHE_DIR = 'c:/tmp/cache';

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer