jDiction Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

jDiction 2.2.0 released. http://jdiction.org/downloads

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - pagchen

Pages: [1]
1
Extensions and jDiction / XML format for component
« on: February 06, 2014, 07:52:21 pm »
Hi,
I am building a custom component and wanted to create an xml file so my component is using jdiction powerful translation.
I did find bits in many places, so I thought I would combine all the info I gathered here.

First you need to create a file called jdiction.xml in the administration folder (administrator/components/my_component/jdiction.xml)

The format to use is like this:
Code: [Select]
<?xml version="1.0" encoding="utf-8"?>
<jdiction>
  <component>com_mycomponent</component>
  <sections>
    <section>
      <tables>
        <table>
          <name>#__mycomponent_items</name>
          <key>id</key>
          <class>mycomponentTableItem</class>
          <file>item.php</file>
          <cache fullfetch="1" />
        </table>

      </tables>
      <views>
        <view name="item" list="items" layout="edit" default="true">
          <form import="form.xml">
          <fieldset name="main" label="COM_JDICTION_TRANSLATION_FIELDSET_MAIN">
              <field name="title" />
      <field name="otherfields" />
          </fieldset>
          </form>
        </view>
      </views>
    </section>
<section>
<tables>
<table>
  <name>#__mycomponent_otheritems</name>
  <key>id</key>
  <class>mycomponentTableOtheritem</class>
  <file>otheritem.php</file>
  <cache fullfetch="1" />
</table>
</tables>
<views>
<view name="otheritem" list="otheritems" layout="edit" default="true">
  <form import="form.xml">
  <fieldset name="main" label="COM_JDICTION_TRANSLATION_FIELDSET_MAIN">
  <field name="title" />
  <field name="otherfields" />
</fieldset>
  </form>
</view>
</views>
</section>
  </sections>
</jdiction>

So basically, you need to put each table in its section, change the name of the tables and component. Adjust the view names. Put the primary key of the table in the key field.
I still have to discover what the cache fullfetch is doing.

Cheers,

Pages: [1]