However all the files are merged together during the parsing process.It will help to understand the XML structure. It is the reason that the module name is repeated as an XML element name (represented below as <(modulename)>) several times through every file - this is necessary to segregate configuration for each module. Without these elements, the configuration in these sections would be overwritten by the configuration files in other modules.
so let us understand the XMl and its ELements ans tructure
Every Config.xml has following elements
The XML sub-structure of each element is described separately below.
1)Modules
<modules>
<(NameSpace_ModuleName)>
<active>[true|false]</active>
<codePool>[core|community|local]</codePool>
<depends>
<(AnotherNameSpace_ModuleName) />
</depends>
<version>(version_number)</version>
</(NameSpace_ModuleName)>
</modules>
2) Global
<global>
<models>
<(modulename)>
<class>(ClassName_Prefix)</class>
<resourceModel>(modulename)_(resource_model_type)</resourceModel>
<(modulename)_(resource_model_type)>
<!-- definition -->
</(modulename)_(resource_model_type)>
<rewrite><!-- definition --></rewrite>
</(modulename)>
</models>
<resources>
<(modulename)_setup><!-- definition --></(modulename)_setup>
<(modulename)_read><!-- definition --></(modulename)_read>
<(modulename)_write><!-- definition --></(modulename)_write>
</resources>
<blocks>
<(modulename)>
<class>(ClassName_Prefix)</class>
</(modulename)>
</blocks>
<helpers>
<(modulename)>
<class>(ClassName_Prefix)</class>
</(modulename)>
</helpers>
<fieldsets>
<(page_handle?)>
<(field_name)>?</(field_name)>
</(page_handle?)>
</fieldsets>
<template>
<email>
<(email_template_name)
module="(modulename)"
translate="[label][,description]"
>
<!-- definition -->
<(/email_template_name)>
</email>
</template>
<events>
<(event_name)>
<observers><!-- observers --></observers>
</(event_name)>
</events>
<eav_attributes><!-- definition --></eav_attributes>
<(modulename)><!-- custom config variables --></(modulename)>
</global>
so let us understand the XMl and its ELements ans tructure
Every Config.xml has following elements
modules | global | admin | adminhtml | install | frontend | default | stores | websites |
1)Modules
<modules>
<(NameSpace_ModuleName)>
<active>[true|false]</active>
<codePool>[core|community|local]</codePool>
<depends>
<(AnotherNameSpace_ModuleName) />
</depends>
<version>(version_number)</version>
</(NameSpace_ModuleName)>
</modules>
2) Global
<global>
<models>
<(modulename)>
<class>(ClassName_Prefix)</class>
<resourceModel>(modulename)_(resource_model_type)</resourceModel>
<(modulename)_(resource_model_type)>
<!-- definition -->
</(modulename)_(resource_model_type)>
<rewrite><!-- definition --></rewrite>
</(modulename)>
</models>
<resources>
<(modulename)_setup><!-- definition --></(modulename)_setup>
<(modulename)_read><!-- definition --></(modulename)_read>
<(modulename)_write><!-- definition --></(modulename)_write>
</resources>
<blocks>
<(modulename)>
<class>(ClassName_Prefix)</class>
</(modulename)>
</blocks>
<helpers>
<(modulename)>
<class>(ClassName_Prefix)</class>
</(modulename)>
</helpers>
<fieldsets>
<(page_handle?)>
<(field_name)>?</(field_name)>
</(page_handle?)>
</fieldsets>
<template>
<email>
<(email_template_name)
module="(modulename)"
translate="[label][,description]"
>
<!-- definition -->
<(/email_template_name)>
</email>
</template>
<events>
<(event_name)>
<observers><!-- observers --></observers>
</(event_name)>
</events>
<eav_attributes><!-- definition --></eav_attributes>
<(modulename)><!-- custom config variables --></(modulename)>
</global>
models | resources | blocks | helpers | fieldsets | template | events | eav_attributes |
3)admin
<admin>
<attributes>
<(attribute_name) />
<attributes>
<fieldsets><!-- definition --></fieldsets>
<routers>
<(modulename)>
<use>[standard|admin|default]</use>
<args>
<module>(NameSpace_ModuleName)</module>
<frontName>(frontname)</frontName>
</args>
</(modulename)>
<!-- or -->
<(modulename)>
<args>
<modules>
<(NameSpace_ModuleName)
before="(AnotherNameSpace_ModuleName)"
>
(New_ClassName)
<(NameSpace_ModuleName)
</args>
</(modulename)>
</routers>
</admin>
attributes | fieldsets | routers |
4)adminhtml
<adminhtml>
<events>
<(event_name)>
<observers><!-- observers --></observers>
</(event_name)>
</events>
<global_search>
<products>
<class>(modulename)/search_catalog</class>
<acl>catalog</acl>
</products>
<customers>
<class>adminhtml/search_customer</class>
<acl>customer</acl>
</customers>
<sales>
<class>adminhtml/search_order</class>
<acl>sales</acl>
</sales>
</global_search>
<translate>
<modules>
<(NameSpace_ModuleName)>
<files>
<default>(name_of_translation_file.csv)</default>
</files>
</(NameSpace_ModuleName)>
</modules>
</translate>
<layout>
<updates>
<(modulename)>
<file>(name_of_layout_file.xml)</file>
</(modulename)>
</updates>
</layout>
<(modulename)><!-- custom config variables --></(modulename)>
</adminhtml>
events | global_search | translate | layout |
5)Frontend
<frontend>
<secure_url>
<(page_handle)>/relative/url</page_handle>
</secure_url>
<events>
<(event_name)>
<observers><!-- observers --></observers>
</(event_name)>
</events>
<routers>
<(modulename)>
<use>[standard|admin|default]</use>
<args>
<module>(NameSpace_ModuleName)</module>
<frontName>(frontname)</frontName>
</args>
</(modulename)>
</routers>
<translate>
<modules>
<(NameSpace_ModuleName)>
<files>
<default>(name_of_translation_file.csv)</default>
</files>
</(NameSpace_ModuleName)>
</modules>
</translate>
<layout>
<updates>
<(modulename)>
<file>(name_of_layout_file.xml)</
</(modulename)>
</updates>
</layout>
</frontend>
secure_url | events | routers | translate | layout |
No comments:
Post a Comment
Thankyou for your Comments