- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我知道周围有几个类似的主题,但我阅读并尝试了其中的大部分内容,但仍然不知道如何做到这一点。
我在 Joomla 2.5 中编写了一个组件,到目前为止它可以正常工作。我有不同的 View ,我可以使用 controller.php 加载 View 。其中一个 View 显示了我的数据库中的一个表(关于团队的数据)。
现在我想要同一个 View 的另一个布局,它将数据库表显示为一个表单,以便可以更改内容。
这是文件结构:
观看次数/
- 团队/
- - tmpl/
- - - 默认.php
- - - 修改.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);
}
我尝试了 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();
}
最佳答案
我有一个类似的问题,我创建了某种用户配置文件 View 并希望他们能够编辑字段而不必为其创建新模型(会有类似的功能,讨厌冗余...)。对我有用的是简单地调用这样的布局:
index.php?option=com_mycomponent&view=myview&layout=edit(在您的情况下“编辑”将是“修改”)
为此,我没有触及 view.html.php(好吧,我一开始触及了,但我不必触及。)。而且您也不需要使用 Controller 。如果要加载修改 View ,只需在链接到修改布局的常规 View 中添加一个按钮。无需更改任何其他内容。
刚好我写了一篇关于它的博文,有兴趣的可以看看:http://violetfortytwo.blogspot.de/2012/11/joomla-25-multiple-views-one-model.html
希望这对您有所帮助。
关于php - 在 Joomla 2.5 中更改 View 布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18817338/
hello world tutorial对于 Joomla 状态: $mainframe is a global variable in Joomla that has lots of useful
我已经通过了:http://docs.joomla.org/How_to_add_breadcrumbs 和 http://api.joomla.org/Joomla-Framework/Applic
在为模块设置添加参数字段时,我正在寻找可能的过滤器列表。 我知道 Text form field type 的示例中存在 filter="raw"和 filter="integer". 但是这些字段的
关闭。这个问题需要更多focused .它目前不接受答案。 想改善这个问题吗?更新问题,使其仅关注一个问题 editing this post . 5年前关闭。 Improve this questi
是否可以为 Joomla 1.5 后端和前端实现单点登录。我发现当管理员例如在后端登录并且需要在前端执行一些用户功能时必须再次登录,这有点多余。有没有实现单点登录的方法? 最佳答案 乔姆拉!被实现为两
我们如何在 joomla 中渲染带有标题的模块。因为现在,我可以根据位置渲染模块,但它不包括模块标题。 这是我渲染模块的方式。 title); echo JModuleHelper::renderMo
我正在 joomla 中开发一个自定义搜索模块。所以我正在使用 joomla 的内置数据库连接和功能。 问题是我想在这个模块中使用分页类,但不知道任何提示。 请帮我解决这个问题。 谢谢。 最佳答案 第
关闭。这个问题是off-topic .它目前不接受答案。 想改进这个问题? Update the question所以它是on-topic对于堆栈溢出。 10年前关闭。 Improve this qu
我在joomla中使用youtube视频,其中代码如下:- [jv_youtube url="https://www.youtube.com/watch?v=8Di0IOQssOM&rel=0" wi
我使用 onContentPrepare 事件将此 [test] 更改为其他文本 o prinf html,如 wordpress 短代码,但没有任何变化。 出了什么问题? 这是shortcodejd
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 要求我们推荐或查找工具、库或最喜欢的场外资源的问题对于 Stack Overflow 来说是偏离主题的,
请先转到www.espacioasir.com,然后注意第二篇文章如何“压碎”到左侧-文章正常宽度的一半。 无论如何,我认为我无法解释得更多,我的问题很清楚:为什么会这样?我确实想提及一下,本文的内容
有些人可能知道,Wordpress 在设置中有一个选项,允许在子目录中安装站点,同时将站点 URL 设为主域。它类似于“站点 url”和“Wordpress url”。我在 Joomla 中寻找类似的
我遇到的这种情况:安装了 joomlaxy/JSPT/Payplans 的 joomla 运行良好。 现在,我在/pages 文件夹中做了一个小的 php 脚本,用于在特定用户类型的模板中使用,它调用
我知道如何为 Joomla 1.6 创建一个模块。但是我听说可以在同一个 XML 安装文件中添加一组 Joomla 1.5 参数和一组 Joomla 1.6 参数,以使只有一个包与 1.6 和 1.5
自从昨晚 Joomla 3.0 Alpha 发布以来,我想尝试开始将我编写的 Joomla 2.5 组件转换为新的 Joomla 3.0。我一直在关注所有的开发小组,他们说 JController、J
我在 Joomla 1.5 中工作并开发了一个组件,该组件有 2 个 View ,在两个 View 中具有相同的部分。我正在重复代码,因为我在 2 个不同的 View 中使用了相同的代码。所以我想知道
我正在构建一个自定义 Joomla 组件,并将其添加到我的模板 (default.php) 文件(它使用 HTTP POST)中的表单中: echo JHTML::_( 'form.token' );
拿起 Joomla 的最快方法是什么?书籍,培训等?我们希望在 Joomla 中培训 10 名中高级 Java 开发人员。 最佳答案 如果你想节省时间,不要从官方的 joomla 文档开始。转至 ht
我之前以这种方式从 Joomla 文章中添加了 Joomla 模块:{loadmodule mod_name}但是这次我需要从中传递参数。 如何将文章中的参数传递给 Joomla 模块? 最佳答案 您
我是一名优秀的程序员,十分优秀!