橫幅廣告

2012年11月15日 星期四

Joomla redirect with message

If you want to use redirect function with a message to display message on screen, we can use as following codes:

JFactory::getApplication()->redirect(JRoute::_('PATH'), 'your message');

2012年11月7日 星期三

取得Joomla的安裝路徑

JPATH_SITE 這個constant可以讓我們取得joomla的安裝位置
ex:
echo JPATH_SITE;

c:\AppServ\www\your_joomla

2012年10月29日 星期一

Apache 預防 Range 標頭攻擊


見招拆招 改裝Apache就地抵禦DoS攻擊


Apache Log檔分割

Apache Log檔分割
在httpd.conf中搜尋 "CustomLog",將其改成

CustomLog "|bin/rotatelogs.exe logs/access%Y_%m_%d_%H_%M_%S.log 86400" common

之後的log檔會存成"access2012_10_29_00_00_00.log"的形式,以86400秒為一個檔案

2012年2月26日 星期日

GIW2012

http://conf.ncku.edu.tw/giw2012/

giw2012 in ncku

Zenbook case - GGMM case

I tried using the GGMM case for zenbook UX31. I'm luck it worked well.
The GGMM case is designed for Mac air 13" generally.
However, It not only fits for mba 13", but also fits for zenbook ux31.

本來就一直想替我的UX31買一個方便一點的保護套,例如可直接翻開的保護套

後來在Mac air上面看到GGMM的保護套,個人感覺外觀好看,形式也是我想要的。

因此在回家上網查一下UX31跟Mac air 13"的大小差異後,個人就跑去買了一個回家試試看(其實這樣真的有點賭...)

不過很幸運的!!!裝的上去,看起來應該不會有什麼問題(不過小弟我不能對這句話負責  )


請看(背景很居家~)


2012年2月20日 星期一

YUI 得知Datatable完成的方法

If you want to know that when is the datatable done, you can subscript the "postRenderEvent" event.

Juts like:
myDataTable.subscribe( 'postRenderEvent', function()
{
  //Do something
});

You can see here in more detail.

YUI 手動取得Datatable資料內容

IF you want to get datatable by a manual way, you can use the following code:


myDataTable.getRecord(0).getData("id");

  • myDataTable is your datatable name.
  • The parameter in getRecord is row number. (0 ~ the numebr of row - 1)
  • The parameter in getData is a key name. You have to specifically assign that.

2012年2月12日 星期日

以Article ID取得文章資訊的方法

$article =& JTable::getInstance("content");

$article->load(Article_ID);
echo $article->get("title");

最後會Echo出文章的Title

不過這樣做不能自動依系統定義自動產生read more...殘念

Joomla取得Component name

如果須要取得Component name的話,可以加入以下程式碼來取得當前的component name:
為何:
echo JRequest::getVar('option');

輸出範例:
com_web_homepage

在Joomla中得到Component的路徑

在開發Joomla的component的時候,可能常常須要include一些東西,因此必須要知道自己所
寫的component的路徑,進而才有辦法知道檔案的所在之處,最後方能include進來。

*如果資訊會顯示在Client端的話,則要小心有無安全性的問題

因此,我們可以使用以下兩種來得到路徑
  • JPATH_COMPONENT: for site
  • JPATH_COMPONENT_ADMINISTRATOR: for admin
另外,可以搭配『DS』這個常數來分隔資料夾。

EX:

$path = JPATH_COMPONENT.DS."function.phg";
$path會得到C:\...\My Web Sites\joomla/components/com_web_homepage\function.php
//我的環境是Windows,$path結果的有省略一些掉。