How To Set Dynamic Variable in CMS Content


public function setVariableforCMSBlock($BlockId,$VariableArray=""){

	if(!$blockId){
		return;
	}
	$block = Mage::getModel('cms/block')
		->setStoreId(Mage::app()->getStore()->getId())
		->load($blockId);
	$filter = Mage::getModel('cms/template_filter');
	$filter->setVariables($array);
	return $filter->filter($block->getContent());
	
}

use of function 
$test['test1'] = 'test1';
$test['test2'] = 'test2';

Mage::helper('example')->setVariableforCMSBlock('testCmsBlockId',$test);

you can set content in cms block like

Hello this is {{var test1}} and this is another {{var test2}}

OUTPUT :: Hello this is test1 and this is another test2

Advertisements

How to run php file using command prompt(cmd)


Go to
Control pannel->System>Advanced System Settings>Environment Variables
Click new

Variable name : path
Variable value : D:\wamp\bin\php\php5.3.13\ /* path of your php folder */

Click ok

Now you can run you php file using php keyword like below

D:\wamp\www>php hello.php