简体   繁体   English

可以在模板中覆盖Joomla的article.xml文件吗?

[英]Can Joomla's article.xml file be overriden in a template?

I'm working on creating custom article parameters in Joomla 1.5 and was hacking the file /administrator/components/com_content/models/article.xml . 我正在Joomla 1.5中创建自定义文章参数,并且正在入侵文件/administrator/components/com_content/models/article.xml Folks discourage hacking the core files of Joomla and now I'd like to follow good practices. 人们不鼓励黑客攻击Joomla的核心文件,现在我想遵循好的做法。

So how would I override the article.xml file so that my template has its own copy with custom parameters in the Advanced section of the file? 那么,我将如何覆盖article.xml文件,以便我的模板在文件的“高级”部分中拥有自定义参数的副本?

You can override just about anything that comes from the Joomla! 您可以覆盖来自Joomla的几乎所有内容! Core. 核心。 Check out this documentation on the Joomla site: http://docs.joomla.org/How_to_override_the_output_from_the_Joomla!_core 在Joomla网站上查看此文档: http : //docs.joomla.org/How_to_override_the_output_from_the_Joomla!_core

for 2.5 or 3.x 适用于2.5或3.x

add the article.xml in your override for com_content/form folder 在您的com_content / form文件夹替代中添加article.xml

add this line in edit.php 在edit.php中添加这一行

$this->form->loadFile( dirname(__FILE__) . DIRECTORY_SEPARATOR . "article.xml"); 

If it is like most of the other Open Source Software that I use that has that style of "templating", you should just be able to copy the file exactly as it is in the default template, to your new template and modify it there. 如果它与我使用的大多数其他开源软件一样都具有“模板化”样式,则您应该能够将文件与默认模板中的文件完全一样地复制到新模板中,然后在其中进行修改。 Ex: 例如:

default/a/b/article.xml -> your_template/a/b/article.xml 默认/a/b/article.xml-> your_template / a / b / article.xml

I don't do too much Joomla, rather other open source PHP CMS and eComm systems, so I am not positive, but is easy enough to try though. 我并没有做太多的Joomla,而是其他开源PHP CMS和eComm系统,所以我并不乐观,但是很容易尝试。

copy these files: 复制这些文件:

  • \\administrator\\components\\com_content\\views\\article\\tmpl\\edit.php \\管理员\\分量\\ com_content \\意见\\文章\\ TMPL \\ edit.php
  • \\administrator\\components\\com_content\\models\\forms\\article.xml \\管理员\\分量\\ com_content \\型号\\表格\\ article.xml

to this location: 到这个位置:

  • C:\\administrator\\templates\\isis(yourtemplate)\\html\\com_content\\article C:\\管理员\\模板\\ ISIS(yourtemplate)\\ HTML \\ com_content \\文章

Then edit edit.php and add under Html::_('formbehavior.chosen', 'select'); 然后编辑edit.php并在Html::_('formbehavior.chosen', 'select'); these 2 lines: 这2行:

$this->form->reset( true );  
$this->form->loadFile( dirname(__FILE__) . DIRECTORY_SEPARATOR . "article.xml");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM