覆盖 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/
和其他变体,例如 template/
或 template/
等没有任何成功.
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
并在表单顶部添加以下代码行(我在表单标签之后添加了我的):
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屋!