Chủ Nhật, 9 tháng 9, 2012
get Params trong admin
//GET PARAMS IMAGES THUMBNAIL SIZE
$params = &JComponentHelper::getParams( 'com_iapp' );
$image_width = $params->get('image_width',100);
$image_height = $params->get('image_height',150);
Thứ Tư, 22 tháng 8, 2012
renew joomla
function renewProperty($id){
//echo __FILE__;
$now=date("Y-m-d H:i:s");
$db= JFactory::getDbo();
$query = $db->getQuery(true);
$query->update('#__iproperty as i');
$query->set('i.created = "'.$now.'"');
$query->set('i.publish_up = "'.$now.'"');
$query->set('i.modified = "'.$now.'"');
$query->set('i.state= 1 ,i.approved= 1');
$query->where('i.id='.(int)$id);
$db->setQuery($query);
$db->query();
//.',i.publish_up i.state= 1 ,i.approved= 1'
echo '<pre>';
print_r($query);
echo '</pre>';
}
$date= JDate::getInstance('now');
//$now=date("Y-m-d H:i:s");
RENEW ADS
function renewContent($contentid,$ad_duration)
{
$ad_duration = 1;
$this->_db->setQuery( "SELECT expiration_date FROM #__adsmanager_ads WHERE id = ".(int)$contentid);
$expiration_date = $this->_db->loadResult();
$time = strtotime($expiration_date);
if ($time < time())
{
$time = time();
}
$time = $time + ( $ad_duration * 3600 *24);
$newdate = date("Y-m-d",$time);
$now=date("Y-m-d H:i:s");
$this->_db->setQuery( "UPDATE #__adsmanager_ads SET expiration_date = '$newdate', date_created = '$now',recall_mail_sent=0,published=1 WHERE id=".(int)$contentid);
$this->_db->query();
}
$table= JTable::getInstance('Property', 'IpropertyTable');
$table->created=date("Y-m-d H:i:s");
Thứ Tư, 8 tháng 8, 2012
List cac field trong joomla
<field name="font-size" type="list" default="12" description="What size font should the message use?" label="Font size">
<option value="8">8px</option>
<option value="12">12px</option>
<option value="16">16px</option>
</field>
aaaaaaa
<field name="color" type="radio" default="black" description="Which color should the message be displayed in?" label="Color">
<option value="black">black</option>
<option value="red">red</option>
<option value="blue">blue</option>
</field>
vvvvvv
<field name="alt-text" type="text" default="" label="Alternative Text" description="Besides Hello World, you can specify other text here to print to the screen instead." />
llll
$this->params->get('alt-text')
kkkkk
<fieldset name="basic">
<field name="text-options" type="spacer" default="Text Settings" label="<b>Text Settings</b>" description="Text Settings" />
<field name="alt-text" type="text" default="" label="Alternative Text" description="Besides Hello World, you can specify other text here to print to the screen instead." />
<field name="font-options" type="spacer" default="Font Settings" label="<b>Font Settings</b>" description="Font Settings" />
<field name="color" type="radio" default="black" description="Which color should the message be displayed in?" label="Color">
<option value="black">black</option>
<option value="red">red</option>
<option value="blue">blue</option>
</field>
<field name="font-size" type="list" default="12" description="What size font should the message use?" label="Font size">
<option value="8">8px</option>
<option value="12">12px</option>
<option value="16">16px</option>
</field>
</fieldset>
How to use Spacers to add HTML
The key to using HTML within a plugin is to change:
- > to >
- < to <
InMotion Hosting provides the <a href='http://www.inmotionhosting.com/joomla-hosting/best-joomla-hosting.html'>best joomla hosting</a>
<field name="great-joomla-hosting" type="spacer" description="InMotion Hosting provides joomla hosting" label="InMotion Hosting provides the <a href='http://www.inmotionhosting.com/joomla-hosting/best-joomla-hosting.html'>best joomla hosting</a>" />
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 filedefine('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
Get params trong component
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
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
Thứ Tư, 1 tháng 8, 2012
PR
PR3
http://www.sitepoint.com/forums/showthread.php?833570-Coldfusion
http://www.sitepoint.com/forums/showthread.php?822353-Frameworks
PR 2
http://quangbaweb.edu.vn/showthread.php?13891-Chuoc-Toi
http://quangbaweb.edu.vn/showthread.php?14119-Hem-Cut
PR3
http://diendan.camau.gov.vn/showthread.php?t=43306
http://diendan.camau.gov.vn/showthread.php?t=43436
http://diendan.camau.gov.vn/showthread.php?t=43267
http://diendan.camau.gov.vn/showthread.php?t=42982
http://diendan.camau.gov.vn/showthread.php?t=42297
http://diendan.camau.gov.vn/showthread.php?t=42981
http://diendan.camau.gov.vn/showthread.php?t=41981
http://diendan.camau.gov.vn/showthread.php?t=41641
http://diendan.camau.gov.vn/showthread.php?t=41981
http://diendan.camau.gov.vn/showthread.php?t=42005
http://diendan.camau.gov.vn/showthread.php?t=42717
http://diendan.camau.gov.vn/showthread.php?t=42754
http://diendan.camau.gov.vn/showthread.php?t=42774
http://diendan.camau.gov.vn/showthread.php?t=42589
http://diendan.camau.gov.vn/showthread.php?t=42640
http://diendan.camau.gov.vn/showthread.php?t=42586
PR 2
http://quangbaweb.edu.vn/showthread.php?14680-Lua-Tro-Bong
http://quangbaweb.edu.vn/showthread.php?14431-Thi-cong-mang
http://quangbaweb.edu.vn/showthread.php?14055-Nguoi-Doi-3
http://quangbaweb.edu.vn/showthread.php?14060-Ky-Nguyen-Rock
http://quangbaweb.edu.vn/showthread.php?14061-Dac-Vu-Catwalk
http://quangbaweb.edu.vn/showthread.php?14059-Ke-Doc-Tai
http://quangbaweb.edu.vn/showthread.php?14048-Hung-Dong-2
http://quangbaweb.edu.vn/showthread.php?13506-Chuyen-Lang-Be
http://quangbaweb.edu.vn/showthread.php?13015-Hoa-Phu-Dung
http://quangbaweb.edu.vn/showthread.php?12931-Tuyen-CTV-marketing
http://quangbaweb.edu.vn/showthread.php?12901-Nguoi-Dep-Online
http://quangbaweb.edu.vn/showthread.php?11717-Hakuhodo-Viet-Nam
http://quangbaweb.edu.vn/showthread.php?10426-Giveaway-ColorlabsProject-Themes
http://quangbaweb.edu.vn/showthread.php?6819-Hoi-ve-htaccess
http://quangbaweb.edu.vn/showthread.php?14671-Doi-Canh-Dong-Tien
http://quangbaweb.edu.vn/member.php?4683-Nguyen-Tien-Toan
http://quangbaweb.edu.vn/showthread.php?14921-Tinh-Vo-Tran-Chan
http://quangbaweb.edu.vn/showthread.php?14912-Arang-Va-Tham-Phan
http://quangbaweb.edu.vn/showthread.php?14674-Quoc-Sac-Thien-Huong
http://quangbaweb.edu.vn/showthread.php?13980-SEO-tren-google-map
http://quangbaweb.edu.vn/showthread.php?12836-Ca-Cuoc-Cuoc-Doi
Trầm Bê Đại gia Ngân hàng Việt Nam
http://www.sitepoint.com/forums/showthread.php?833570-Coldfusion
http://www.sitepoint.com/forums/showthread.php?822353-Frameworks
PR 2
http://quangbaweb.edu.vn/showthread.php?13891-Chuoc-Toi
http://quangbaweb.edu.vn/showthread.php?14119-Hem-Cut
PR3
http://diendan.camau.gov.vn/showthread.php?t=43306
http://diendan.camau.gov.vn/showthread.php?t=43436
http://diendan.camau.gov.vn/showthread.php?t=43267
http://diendan.camau.gov.vn/showthread.php?t=42982
http://diendan.camau.gov.vn/showthread.php?t=42297
http://diendan.camau.gov.vn/showthread.php?t=42981
http://diendan.camau.gov.vn/showthread.php?t=41981
http://diendan.camau.gov.vn/showthread.php?t=41641
http://diendan.camau.gov.vn/showthread.php?t=41981
http://diendan.camau.gov.vn/showthread.php?t=42005
http://diendan.camau.gov.vn/showthread.php?t=42717
http://diendan.camau.gov.vn/showthread.php?t=42754
http://diendan.camau.gov.vn/showthread.php?t=42774
http://diendan.camau.gov.vn/showthread.php?t=42589
http://diendan.camau.gov.vn/showthread.php?t=42640
http://diendan.camau.gov.vn/showthread.php?t=42586
PR 2
http://quangbaweb.edu.vn/showthread.php?14680-Lua-Tro-Bong
http://quangbaweb.edu.vn/showthread.php?14431-Thi-cong-mang
http://quangbaweb.edu.vn/showthread.php?14055-Nguoi-Doi-3
http://quangbaweb.edu.vn/showthread.php?14060-Ky-Nguyen-Rock
http://quangbaweb.edu.vn/showthread.php?14061-Dac-Vu-Catwalk
http://quangbaweb.edu.vn/showthread.php?14059-Ke-Doc-Tai
http://quangbaweb.edu.vn/showthread.php?14048-Hung-Dong-2
http://quangbaweb.edu.vn/showthread.php?13506-Chuyen-Lang-Be
http://quangbaweb.edu.vn/showthread.php?13015-Hoa-Phu-Dung
http://quangbaweb.edu.vn/showthread.php?12931-Tuyen-CTV-marketing
http://quangbaweb.edu.vn/showthread.php?12901-Nguoi-Dep-Online
http://quangbaweb.edu.vn/showthread.php?11717-Hakuhodo-Viet-Nam
http://quangbaweb.edu.vn/showthread.php?10426-Giveaway-ColorlabsProject-Themes
http://quangbaweb.edu.vn/showthread.php?6819-Hoi-ve-htaccess
http://quangbaweb.edu.vn/showthread.php?14671-Doi-Canh-Dong-Tien
http://quangbaweb.edu.vn/member.php?4683-Nguyen-Tien-Toan
http://quangbaweb.edu.vn/showthread.php?14921-Tinh-Vo-Tran-Chan
http://quangbaweb.edu.vn/showthread.php?14912-Arang-Va-Tham-Phan
http://quangbaweb.edu.vn/showthread.php?14674-Quoc-Sac-Thien-Huong
http://quangbaweb.edu.vn/showthread.php?13980-SEO-tren-google-map
http://quangbaweb.edu.vn/showthread.php?12836-Ca-Cuoc-Cuoc-Doi
Trầm Bê Đại gia Ngân hàng Việt Nam
RERULER EXPRESSION
http://www.catswhocode.com/blog/15-php-regular-expressions-for-web-developers
http://phpvn.info/2007/07/regular-expression
xoa nhung the a co src=''
http://phpvn.info/2007/07/regular-expression
xoa nhung the a co src=''
$html = '<img src="adasas.jpg" /><br />asasas<br />sdfsdf<br /><a href="adafgag"><img title="asa" src="" /></a>';
'!(<a\s[^>]+>)?<img([^>]+)src=""([^>]*)>(</a>)?!i'
Thứ Ba, 31 tháng 7, 2012
econtent
Lay noi dung tu 24h
/<div class="boxBaiViet-c">(.*?)<\/div>\s*<div class="boxDon-sub-b">/ismu
title
/<h1 class="baiviet-title">(.*?)<\/h1>\s*<div class="publication_date">/ismu
intro text
/<div class="baiviet-head-noidung">(.*?)<\/div>\s*<div class="cap2-boxtop-note">/ismu
huogn dan su dung
http://tunglinhonline.com/diendan/viewthread.php?tid=4434
lay tin vnexpress
chi tiet 1 bai viet
/<div id="content">\s*(.*?)\s*<\/div>\s*<div id="footer">/ism
/<div class="content">\s*(.*?)\s*<\/div>\s*<div class="folder-news">/ism
/<div class="content">\s*(.*?)\s*<\/div>\s*<div class="Div_OtherNews">/ism
thay the
/<h1\s*(.*?)\s*<\/h1>/ism<=>
/<script\s*(.*?)\s*<\/script>/ism<=>
/<br\s*(.*?)\s*>>\s*(.*?)\s*<\/a><\/h2>/ism<=></h2>
/<link\s*(.*?)\s*\/>/ism<=>
/<div class="likesubject fl">\s*(.*?)\s*/ismU<=>
lay tin tren http://www.diaoconline.vn/rss/
/<div class="chitiet">\s*(.*?)\s*<\/div>\s*<input/ism
thay the
/<p align="right">\s*(.*?)\s*<\/p>/ism<=>
Lay tin dan tri
/<div id="ctl00_IDContent_ctl00_divContent">\s*(.*?)\s*<\/div>\s*<div class="clearfix">/ism
thay the
/<div class="box26"\s*>\s*(.*?)\s*<\/div>\s*<p class="detail_subtitle"\s*>\s*(.*?)\s*<\/p>/ism<=>
/<div itemscope(.*)/ism<=>
/<script[^>]+>.*?<\/script>/i<=>
/\(D.+n\str.+\)\s*\-\s*/iU<=>
/<h1\s*(.*?)\s*<\/h1>/ism<=>
/<br\s*(.*?)\s*<\/h2>/ism<=>
Thứ Hai, 30 tháng 7, 2012
Thứ Sáu, 27 tháng 7, 2012
Dung Session joomla luu url truoc do
$currentURL=JURI::current();
//$currentURL = JFactory::getURI();
$session =& JFactory::getSession();
$session->set( 'currentURL',base64_encode($uri->toString()) );
==> lay tham so truyen qua
$session =& JFactory::getSession();
$currentURL = base64_decode($session->get('currentURL'));
//$currentURL = JFactory::getURI();
$session =& JFactory::getSession();
$session->set( 'currentURL',base64_encode($uri->toString()) );
==> lay tham so truyen qua
$session =& JFactory::getSession();
$currentURL = base64_decode($session->get('currentURL'));
Thứ Năm, 26 tháng 7, 2012
Animated scroll to anchor/id function with jQuery
function goToByScroll(id){
$('html,body').animate({scrollTop: $("#"+id).offset().top},'slow');
}
goToByScroll("theIdIWantToGoTo");
Thứ Tư, 18 tháng 7, 2012
MAGENTO TIPS
ADD STATES to countries
http://dbhoopendra.blogspot.com/2012/02/magento-how-to-add-states-to-countries.html
http://www.sycha.com/magento-add-custom-state-province-region-country
ADD SHIPPING MEHTOD
http://inchoo.net/ecommerce/magento/custom-shipping-method-in-magento/
http://www.magentocommerce.com/wiki/5_-_modules_and_development/shipping/create-shipping-method-module
http://techportal.inviqa.com/2011/06/09/creating-a-custom-magento-shipping-method/
http://www.excellencemagentoblog.com/magento-create-custom-shipping-method
30 EXTENSION
http://visionwidget.com/free-magento-extensions.html
http://dbhoopendra.blogspot.com/2012/02/magento-how-to-add-states-to-countries.html
http://www.sycha.com/magento-add-custom-state-province-region-country
ADD SHIPPING MEHTOD
http://inchoo.net/ecommerce/magento/custom-shipping-method-in-magento/
http://www.magentocommerce.com/wiki/5_-_modules_and_development/shipping/create-shipping-method-module
http://techportal.inviqa.com/2011/06/09/creating-a-custom-magento-shipping-method/
http://www.excellencemagentoblog.com/magento-create-custom-shipping-method
30 EXTENSION
http://visionwidget.com/free-magento-extensions.html
joomla - Ham huu dung
Tao intro text gioi han ky tu
JHTML::_('string.abridge');
JHTML::_('string.truncate');
$data['alias']=JHtmlString::truncate($params['title'],10);
Tạo alias :
JFilterOutput::stringURLSafe(' f hjk có bà sáu lé nè con ơi ll--re2xzl.;; ');
JHTML::_('string.abridge');
JHTML::_('string.truncate');
$data['alias']=JHtmlString::truncate($params['title'],10);
Tạo alias :
JFilterOutput::stringURLSafe(' f hjk có bà sáu lé nè con ơi ll--re2xzl.;; ');
Lam gallery luu trang thai nut nhan
import caurina.transitions.Tweener;
var butArray:Array=new Array(but.b1,but.b2,but.b3,but.b4,but.b5)
var movingArea=222;
var time=4;
var movingItem=4
var mcArray:Array=new Array(
'http://www.limeorange.vn/vnt_upload/File/Flash/banner_left_scroll/1.png',
'http://www.limeorange.vn/vnt_upload/File/Flash/banner_left_scroll/2.png',
'http://www.limeorange.vn/vnt_upload/File/Flash/banner_left_scroll/3.png',
'http://www.limeorange.vn/vnt_upload/File/Flash/banner_left_scroll/4.png',
'http://www.limeorange.vn/vnt_upload/File/Flash/banner_left_scroll/5.png'
)
var mcLink:Array=new Array(
'http://www.limeorange.vn/product/stripe-t-shirt-10.html',
'http://www.limeorange.vn/product/typho-grphy-t-shirt-7.html',
'http://www.limeorange.vn/product/stylish-t-shirt-9.html',
'http://www.limeorange.vn/product/ilust-t-shirt-6.html',
'http://www.limeorange.vn/product/character-8.html'
)
var mcCount=mcArray.length;
var mc_wrap:MovieClip=new MovieClip();
addChildAt(mc_wrap,0);
for(var i=0; i<mcCount;i++){
var url:String=mcLink[i];
var mcload:MovieClip=new full_image();
mc_wrap.addChild(mcload);
mcload.path=mcArray[i];
mcload.t_shirt=i+1;
mcload.y=i*movingArea
mcload.name=url
mcload.buttonMode = true;
mcload.useHandCursor = true;
mcload.addEventListener(MouseEvent.MOUSE_DOWN,linkTo)
}
function linkTo(e:MouseEvent){
var link=e.currentTarget.name
var request:URLRequest = new URLRequest(link);
navigateToURL(request,'_self')
}
var count:int = 0;
var sliderTimer:Timer = new Timer(time,0);
sliderTimer.addEventListener(TimerEvent.TIMER, updateSlide);
sliderTimer.start();
function updateSlide(e:TimerEvent){
if(count >=movingItem){
count =0;
}else{
count ++;}
//trace('count = '+count)
moveBtn()
}
function moveBtn():void {
if(count>=movingItem){
Tweener.addTween(mc_wrap,{y:0,time:1.5, transition:"easeoutelastic"});
}
var a=-222*count
//trace('y = '+a)
Tweener.addTween(mc_wrap,{y:a,time:0.8,transition:"easeoutexpo"});
Tweener.addTween(mc_wrap,{alpha:0.1,time:0.3,transition:"easeoutquint"});
Tweener.addTween(mc_wrap,{alpha:1,time:0.5,delay:0.3,transition:"easeoutexpo"});
sliderTimer.reset();
sliderTimer.start();
for(var j=0;j<butArray.length;j++){
butArray[j].alpha=0;
}
Tweener.addTween(butArray[count],{alpha:1,time:0.3});
}
for(var j=0;j<mcBut.length;j++){
mcBut[j].addEventListener(MouseEvent.MOUSE_DOWN,playimg);
}
function playimg(e:MouseEvent){
//moveBtn()
var c=(e.target.name).substr(1);
count=Number(c)-1;
trace(count)
moveBtn()
}
for(var u=0;u<mcBut.length;u++){
mcBut[u].alpha=0;
}
mcBut[0].alpha=1;
Thứ Ba, 17 tháng 7, 2012
Tips: ajax in joomla component
Viet trong controller
Joom 1.5
//Hien thi du lieu
global $mainframe;
$mainframe->close();
joom 1.6 va nhung ban sau
//Hien thi du lieu
$app = &JFactory::getApplication();
$app->close();
Chủ Nhật, 15 tháng 7, 2012
JHTML
JHTML::date($row1->date_begin_special,'%d-%m-%Y %H:%M:%S')
$editor=JFactory::getEditor();
<?=$editor->display('content',$row1->content, '100%', '400', '70', '15', False); ?>
$editor=JFactory::getEditor();
<?=$editor->display('content',$row1->content, '100%', '400', '70', '15', False); ?>
Thứ Năm, 12 tháng 7, 2012
template 2.5 joomla
http://www.shape5.com/component/option,com_docman/Itemid,96/task,cat_view/gid,190/
http://www.shape5.com/product_details/free_extensions/
http://www.shape5.com/component/option,com_docman/Itemid,96/task,cat_view/gid,15/
http://www.shape5.com/component/option,com_docman/Itemid,96/task,cat_view/gid,13/
thuat toan multicategory trong joomla
Truong hop edit cua multi category
old lay id cua item, vao bang item_size, tao mang size.
new lay mang item_size sau khi edit gui qua
==>tim nhung phan tu co trong mang cu khong co trong mang moi ( xoa )
==>tim nhung phan tu co trong mang moi, nhung khong co trong mang cu ( them )
old=array('a','b','c','d')
new=array('a','b','c','f')
co trong mang cu, khong co trong mang moi
Array
(
[3] => d
)
co trong mang moi, khong co trong mang cu
Array
(
[3] => f
)
//save
kiem tra neu ton tai ten file => luu hinh
kiem tra mang iapp_media so voi mang trong database, lay phan tu khong co trong mang cu de delete.
vua co ten file hinh vua delete hinh cu=> vay phai kiem tra 2mang truoc, sau do moi upload hinh
//them moi:
- id<=0
- kiem tra ten file neu ton tai .
- save hinh,va ordering=1;
//edit
- id>0
- chi them moi, ko xoa
- them moi va xoa
kiem tra mang iaap_item_medias >0
so sanh mang cu, xoa hinh , cap nhat odering moi
nguoc lai neu mang iaap_item_medias<=0
dung id item, xoa het hinh anh trong 2 bang
kiem tra ten file neu ton tai .
ten hinh anh ton tai => save hinh va ordering=count(mang odering) +1;
css3 - fullpage background
http://css-tricks.com/perfect-full-page-background-image/
background: url(images/bg.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
Joomla 404 custom page
if (($this->error->getCode()) == '404') {header('Location: /url cua bai viet'); exit; }
http://www.inmotionhosting.com/support/edu/joomla-25/how-to/configure-email-over-smtp
Chủ Nhật, 8 tháng 7, 2012
Magento basic
Hien thi san pham tren trang chu
http://www.magentocommerce.com/wiki/groups/248/display_products_on_home_pageCai dat magento tren wamp va xamp
http://www.magentocommerce.com/wiki/1_-_installation_and_configuration/installing_on_windows_with_xampp_and_wamp
SUA DOI TIEN TE
http://www.magentovietnam.com/forum/viewtopic.php?f=24&t=13
Đăng ký:
Nhận xét (Atom)
