覆盖components/com_users/models/forms/login.xml-Joomla 2.5? [英] Override components/com_users/models/forms/login.xml - Joomla 2.5?
问题描述
我一直在尝试覆盖文件login.xml
,但是无论我如何尝试,模板文件夹中的编辑版本都不会显示.
如何覆盖此文件?
I've been trying to override the file login.xml
but no matter what I try, the edited version in my template folder doesn't show up.
How can I override this file?
更新
我尝试了template/<templatename>/html/com_users/models/login.xml
以及template/<templatename>/html/com_users/models/forms/login.xml
或template/<templatename>/html/com_users/forms/login.xml
等其他变体,但是没有成功.
I have tried template/<templatename>/html/com_users/models/login.xml
and other variations like template/<templatename>/html/com_users/models/forms/login.xml
or template/<templatename>/html/com_users/forms/login.xml
etc without any success.
推荐答案
这是一个解决方案:
http://forum.joomla.org/viewtopic.php?t = 583380#p2375649
我刚刚在Joomla 2.5.3中对其进行了测试,并且可以正常工作.
I just tested it in Joomla 2.5.3 and it works.
更新
这是从上方URL复制的解决方案
here is the solution copied from above URL
我们可以使用常规模板替代功能替代输出.对我来说,我试图覆盖登录页面.因此,我正在复制/components/com_users/views/login/tmpl/default.php
并将其放入/templates/beez_20/html/com_users/login
.
We can override output by using the normal template override feature. For me, I'm trying to override the login page. So, I'm taking a copy of /components/com_users/views/login/tmpl/default.php
and putting it into /templates/beez_20/html/com_users/login
.
现在复制一份/components/com_users/models/forms/login.xml
并将其放置在/templates/beez_20/html/com_users/login
中.
Now take a copy of /components/com_users/models/forms/login.xml
and place in /templates/beez_20/html/com_users/login
as well.
然后编辑/templates/beez_20/html/com_users/login/default.php
并在表单顶部添加代码(我在form标记之后添加了我的代码),并添加了以下代码行:
Then edit /templates/beez_20/html/com_users/login/default.php
and add at the top of the form (I added mine just after the form tag) the following lines of code:
// to reset the form xml loaded by the view
$this->form->reset( true );
// to load in our own version of login.xml
$this->form->loadFile( dirname(__FILE__) . DS . "login.xml");
类似地,您可以安全地编辑/templates/beez_20/html/com_users/registration/registration.xml
来修改注册表.
Similarly you can safely edit /templates/beez_20/html/com_users/registration/registration.xml
to modify the registration form.
这篇关于覆盖components/com_users/models/forms/login.xml-Joomla 2.5?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!