简体   繁体   中英

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 . Folks discourage hacking the core files of Joomla and now I'd like to follow good practices.

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?

You can override just about anything that comes from the Joomla! Core. Check out this documentation on the Joomla site: http://docs.joomla.org/How_to_override_the_output_from_the_Joomla!_core

for 2.5 or 3.x

add the article.xml in your override for com_content/form folder

add this line in 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

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.

copy these files:

  • \\administrator\\components\\com_content\\views\\article\\tmpl\\edit.php
  • \\administrator\\components\\com_content\\models\\forms\\article.xml

to this location:

  • C:\\administrator\\templates\\isis(yourtemplate)\\html\\com_content\\article

Then edit edit.php and add under Html::_('formbehavior.chosen', 'select'); these 2 lines:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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