0

Is there any way to include xml file in to another in Joomla 2.5 and up?

I am not asking how to write joomla xml params. Question is simple as title . Is there a way to include one xml in to another in Joomla ?

I have 2 files templateDetails.xml and extend.xml used these examples:

http://msdn.microsoft.com/en-us/library/aa302291.aspx

Can we import XML file into another XML file?

start code

templateDetails.xml:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE install PUBLIC "-//Joomla! 2.5//DTD template 1.0//EN" "http://www.joomla.org/xml/dtd/1.6/template-install.dtd" [
       <!ENTITY extend SYSTEM "extend.xml">
    ]>
<extension version="2.5" type="template" client="site" method="upgrade">
  <name>...</name>
  <creationDate>...</creationDate>
  <author>...</author>
  <copyright>...</copyright>
  <authorEmail>...</authorEmail>
  <authorUrl>...</authorUrl>
  <version>1.0</version>
  <positions>
    <position>top</position>
  </positions>
  <config>
    <fields name="params">
      <fieldset name="basic">
        &extend;
      </fieldset>
    </fields>
  </config>
</extension>

extend.xml:

<?xml version="1.0" encoding="utf-8"?>
<field name="somevar" type="list" default="2" label="My label" description="My desc">
      <option value="1">Yes</option>
      <option value="2">No</option>
</field>

I either made mistake somewhere or should use another approach. Any help is appreciated,

Community
  • 1
  • 1
Benn
  • 4,840
  • 8
  • 65
  • 106

1 Answers1

0

Unfortunately I don't think this is possible with Joomla. It is something I have looked at to reduce xml code duplication in Joomla components I am developing. I was searching Stack OVerflow to see if any solution was on here. The problem is in the way Joomla loads the xml files. It uses $xml = simplexml_load_file($file) to load files but to use entity expansion this would need to be changed to $xml = simplexml_load_file($file,null, LIBXML_NOENT). There are multiple locations where Joomla loads xml files so each would need to be changed. I don't know if there is a specific reason the Joomla developers did not use the extended form or may be I have missed something and there is a way to do this. I have it down as something to investigate further and possibly raise as a pull request for a later release of Joomla (I've checked in release 3.2.4 and it hasn't changed).