2008年02月21日

Extend core libraries of CodeIgniter to detect the request file type and load applicable view

Tags: CodeIgniter

I extend core libraries of CodeIgniter to detect the request file type and load applicable view. The other way is use URI Route, see '文件格式之 URI Route Rule 與 CodeIgniter 之實作示範'.

What I want to do is that if user request 'http://localhost/ci/blogs/index.xml', it will try to load a view for XML. In other cases:

  • If request 'blogs/index', load 'views/index.php' to render HTML document (default type).
  • If request 'blogs/index.xml', load 'views/index.xml.php' to render XML document.
  • If request 'blogs/index.pdf', load 'views/index.pdf.php' to render PDF document.
  • and so on.

MY_URI
MY_Loader

Posted by shirock at 樂多Roodo! │15:33 │回應(0)引用(0)PHP
樂多分類:學術/學習 工具:加入樂多書籤編輯本文
Ads by Roodo! 

引用URL

http://cgi.blog.roodo.com/trackback/5573545