Thứ Tư, 8 tháng 8, 2012

Joomla tips


Lấy 100 ky tự thôi
$truncated_text = JHtml::_('string.truncate', $text, 100);
echo $truncated_text;

Bảo mật file ajax trong joomla
// No direct access to this file
define('IS_AJAX', isset($_SERVER['HTTP_X_REQUESTED_WITH'])
&&strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest');
if(!IS_AJAX) {die('Restricted access');}

Set generator tag, trong file index.php
$this->setGenerator('Enter_whatever_you_want_here');


Get params trong component
http://www.minitek.gr/tutorials/joomla-16-tutorials/development-tutorials/item/235-how-to-get-the-component-parameters-from-within-a-model.html

Gọi module trong view của 1 component
$modules =& JModuleHelper::getModules('position_name');
foreach ($modules as $module){
     echo JModuleHelper::renderModule($module);
}

Gửi mail joomla
http://www.minitek.gr/tutorials/joomla-16-tutorials/item/150-how-to-send-email-from-a-joomla-component.html

Không có nhận xét nào:

Đăng nhận xét

Related Posts Plugin for WordPress, Blogger...