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
樂多舊網址: http://blog.roodo.com/rocksaying/archives/5573545.html