我已经在使用joomla组件创建应用程序了.但这不是最好的方式,那么我认为要学习它.请发送最好的教程.:)
我在joomla中使用不同的模型,而不是通过从控制器分配它来查看与其名称相似的自己的模型,例如:
$view->setModel($this->getModel('user'));
Run Code Online (Sandbox Code Playgroud)
现在我如何在视图中使用其方法getSingleUser($ user_id).在joomla文档中的一个例子中,它使用的是这样的东西:
$this->get("data1","model2");
Run Code Online (Sandbox Code Playgroud)
所以我假设data1是model2中方法的名称?如果是这样,那么如何在我的情况下传递userid的参数.我知道很多joomla开发人员都做过这件事很容易,但我是各种开发人员的杰克,也是joomla的新人,所以我希望你们能告诉我.
我知道有几个类似的主题,但我阅读并尝试了大多数但仍然无法弄清楚如何做到这一点.
我在Joomla 2.5中编写了一个组件,它到目前为止一直有效.我有不同的视图,我可以使用controller.php加载视图.其中一个视图显示了我的数据库中的表格(有关团队的数据).
现在我想要另一个相同视图的布局,它将数据库表显示为一个表单,以便更改内容.
这是文件结构:
views/
- teams/
- - tmpl/
- - - default.php
- - - modify.php
- - view.html.php
这不在view.html.php文件中:
...
// Overwriting JView display method
function display($tpl = null) {
...
$this->setLayout('modify');
echo $this->getLayout();
// Display the view
parent::display($tpl);
}
Run Code Online (Sandbox Code Playgroud)
我尝试了setLayout,$ tpl = ...,default_modify.php等的不同组合,但我总是得到默认布局或者像'找不到布局修改'这样的错误
我用.../index.php?option = com_test&task = updateTeams加载网站
controller.php看起来像这样:
function updateTeams(){
$model = $this->getModel('teams');
$view = $this->getView('teams','html');
$view->setModel($model);
$view->display();
}
Run Code Online (Sandbox Code Playgroud) 我在JOOMLA挖掘这段代码
$input = JFactory::getApplication()->input;
$controller->execute($input->getCmd('task'));
Run Code Online (Sandbox Code Playgroud)
80%我理解但坚持'任务'的事情.
文档说getCMD
* The default behaviour is fetching variables depending on the
* current request method: GET and HEAD will result in returning
* an entry from $_GET, POST and PUT will result in returning an
* entry from $_POST.
*
* You can force the source by setting the $hash parameter:
*
* post $_POST
* get $_GET
* files $_FILES
* cookie $_COOKIE
* env $_ENV
* server $_SERVER
* method via current …Run Code Online (Sandbox Code Playgroud) 我已经为我的Joomla网站创建了一个联系表单.该联系页面中有两个项目Contact(我的联系方式详见此处)和Contact Form.我不需要Contact显示该项目.我只需要展示Contact Form.我怎么能Contact只删除项目和显示Contact Form?(我正在使用Joomla 2.5)
我为Joomla 1.5创建了自定义组件和路由插件,以便为我的组件提供SEO URL,以及不与菜单绑定的文章和类别.现在我必须单独安装我的组件和路由插件.有没有办法在一个包装中安装?
先感谢您!Vojtech
我正在Joomla 3.x中编写自定义组件.
在组件的某个点上,我需要在Joomla中的"已注册"组下创建一个自定义用户组.
在搜索了很多网页后,我发现没有解决这个问题的方法.
在 joomla 定制组件中,页面上有多个帖子,每个帖子都包含多个评论,因此在视图中我想通过帖子 id 调用评论。请建议一个让它发挥作用的好方法。