Tuesday, January 26, 2010

How to configure the url aliases in drupal

How to configure the url aliases in drupal for friendly urls.
suppose your url like :
http://www.yourdomain.com/node/1

this page for about us page, then we can convert into in your friendly urls like
http://www.yourdomain.com/aboutus
for this we have to follow some configuration in drupal:
1) Administrator -> Site building -> URL aliases
2) Click on Add alias – then it go to form admin/build/path/add
3) Give the Existing system path like:


node/1
to Path alias:
aboutus
see the below image :


Thursday, January 21, 2010

Thumbnail creation in codeigniter

In the following function will create thumbnails in codeigniter.


<? PHP

function _createThumbnail($fileName) {

$config['image_library'] = ‘gd2′;


$config['source_image'] = ‘uploads/’ . $fileName;

$config['create_thumb'] = TRUE;

$config['maintain_ratio'] = TRUE;

$config['width'] = 75;

$config['height'] = 75;

$this->load->library(‘image_lib’, $config);


if(!$this->image_lib->resize()) echo $this->image_lib->display_errors();

}

? >

Call the above function like :

<? PHP

$this->_createThumbnail($fInfo['file_name']);

? >

After creation of thumbnail clear the caches.

<? PHP

$this->image_lib->clear();

? >

Hope that it will be useful.

Monday, January 18, 2010

Using PHP remove the consecutive whitespaces.

Following script will work for remove the newline and remove the consecutive white spaces
       

<? PHP
function remW( $content )

{
$content = trim(ereg_replace(“\n|\r|\r\n|\n\r”, ”, preg_replace(‘/\s+/’, ‘ ‘, $content)));
return $content;

}
        ?>

Tuesday, January 12, 2010

ctp,thtml configure in dreamweaver for cakephp

Hi friends,
ctp and thtml extension files, are not properly displayed at dreamweaver, if we want to code difference between php codes and normal text, then we have to configure.
in C:/program files/dreamweaver/configuration/documentTypes/
open the file MMDocumentTypes.xml
<documenttype id=”PHP_MySQL” servermodel=”PHP MySQL” internaltype=”Dynamic” winfileextension=”php,php3,php4,php5l” macfileextension=”php,php3,php4,php5″ file=”Default.php” writebyteordermark=”false”>


to


<documenttype id=”PHP_MySQL” servermodel=”PHP MySQL” internaltype=”Dynamic” winfileextension=”php,php3,php4,php5,inc,module,ctp,thtml” macfileextension=”php,php3,php4,php5,inc,module,ctp,thtml” file=”Default.php” writebyteordermark=”false”>

Once close the dreamweaver and open that file in dreamweaver that will display code difference php code and normal.

Monday, January 4, 2010