Archive for March, 2008|Monthly archive page

smarty caching problem

we can use {dynamic} for blocking perticular section of page to cache!

[index.php]

$smarty = new Smarty;
smarty->caching = true;

function smarty_block_dynamic($param, $content, &$smarty) {
return $content;
}
$smarty->register_block(‘dynamic’, ’smarty_block_dynamic’, false);

[index.tpl]

{dynamic}

{insertx name=photo_link assign=plink pid=$smarty.section.san.index}
{$plink}

{/dynamic}

here the section photo_link will not cached it is the dynamic block.

“insertx” is the plugin for insert tag used in smarty template files

function smarty_function_insertx($params, &$smarty)
{

$func=”insert_”.$params['name'];

if($params['assign']!=”")
$smarty->assign($params['assign'], $func($params));
else
return $func($params);
}

Setting CronJobs

This is the pattern for cronjob setting on linux server:

Minute Hour Day-of-Month  Month-of-Year  Day-of-Week   Command

0 0 * * * D:/xampp/php -q D:/xampp/htdocs/dolfin/periodic/cmd.php
(every day)

*/10 * * * * D:/xampp/php -q D:/xampp/htdocs/dolfin/periodic/notifies.php
(every 10 mins)

* * * * * echo “This is an example of cron command”
(execute after every minute)

0 18 * * * sh /home/user1/take_backup
(take_backup at 6:00 PM every day)

10,30,50 9-18 * * 1-6 cp /home/user1/display
(every day from MON to SAT display execute every 20 mins from 9:00 AM to 6:00 PM)

How to convert video files into FLV by mobile device

1 – Create email (Mobile Profile) like username@domain.com using cpanel API or curl.
2 – Use this Email for sending video from mobile via internet to username@domain.com.
3 – Make a script for reading these email from user’s inbox by IMAP function.
4 – Create a cron job (every hour) for read/save these attached video to site in a folder.
5 – Make a script for converting these videos to FLV by ffmpeg and mail user about converted video by email.
6 – Enjoy videos.

GetId3 in php

GetId3 is used for getting information about server files like file title, file size, file duration etc.

How to convert video files in FLV on Amazon EC2 server

Steps for converting your video to flv format:

1 – Get the video into EC2 instance (post/curl/php/etc)
2 – Use some command line software to convert it(ffmpeg)
3 – Send new file to S3 (curl, s3sync, php, etc)

Video help for EC2:

http://s3.amazonaws.com/AmazonEC2Tutorial/AmazonEC2Tutorial.html