CMS-block API magento
CMS-block API magento
>?php error_reporting(0); include("../app/Mage.php"); umask(0); Mage::app(); $result_array = array(); $identifier=$_GET["url_key"]; if($identifier=="" or $identifier=="0"){ $result_array["message"]="Please add Right url-key "; $result_array["status"]="2"; echo json_encode($result_array); exit(); } else { $PageData = Mage::getModel('cms/block')->load($identifier, 'identifier'); $result_array["id"]=$PageData->getId(); $result_array["title"]=$PageData->getTitle(); $result_array["identifier"]= $PageData->getIdentifier(); $result_array["content"]=htmlentities(preg_replace('/"/',' ',$PageData->getContent())); if(empty($result_array["identifier"])){ $result_array1["message"]="Cms-block not found"; $result_array1["status"]="0"; echo json_encode($result_array1); exit(); } else { $result_array["message"]="success "; $result_array["status"]="1"; echo json_encode($result_array); exit(); } } ?<
No comments: