There is no need to add a system.xml
to have a node in the configuration.
You can take the configuration wherever you want it. If you want an easy way to retrieve it and it doesn't feel wrong, just put it in:
<config>
<default>
<your_module_identifier>
<your_identifiert>
<your_config_setting>SETTING</your_config_setting>
</your_identifiert>
</your_module_identifier>
</default>
</config>
Then you can retrieve this setting with:
Mage::getStoreConfig('your_module_identifier/your_identifiert/your_config_setting');
The alternative is to put it wherever you want it, like the fieldsets in the Mage_Sales
config.xml
:
<config>
<global>
<fieldsets>
...
</fieldsets>
</global>
</config>
Then you need to use:
Mage::getConfig()->getNode('global/fieldsets/whatever/path/you/have/in/your/xml');
You can the page title using ->setTitle();
For example my page title is My title; the add below code in between $this->loadLayout();
and $this->renderLayout();
in controller action,
and just change title according action or it action parameters
I,e
$this->getLayout()->getBlock('head')->setTitle($this->__('My title'));
Add the code in Controller
$this->loadLayout();
...
$this->getLayout()->getBlock('head')->setTitle($this->__('My title'));
$this->renderLayout();
Example:
same action but different parrmeters
custommodule/controller/myindex/id/1(for this url i want set title Amit)
custommodule/controller/myindex/id/5 (for this url i want set title Bera)
then in MymoduleContoller.php
at action myindexAction
code is like
$this->loadLayout();
...
if($this->getRequest()->getParam('id')=5){
$this->getLayout()->getBlock('head')->setTitle($this->__('Bera'));
}elseif($this->getRequest()->getParam('id')=1){
$this->getLayout()->getBlock('head')->setTitle($this->__('Amit'));
}
else{
$this->getLayout()->getBlock('head')->setTitle($this->__('My title'));
}
$this->renderLayout();
If want using xml then try below
<layout version="0.1.0">
<custommodule_mymodule_myindex>
<reference name="head">
<action method="setTitle"><title>My Module Page</title></action>
</reference>
</custommodule_controller_myindex>
</layout>
http://blog.chapagain.com.np/magento-setchange-page-layout-title-tag-meta-keywords-and-description/
http://inchoo.net/ecommerce/magento/change-any-page-title-in-magento/
Best Answer
Yes. If you take a look at
app/Mage.php
in theexception()
method, you will see that it looks for an exception that matches the pattern$module . '_Exception
, for example:YourCompany_YourModule_Exception
:Because of the way this method works you have no control over where your exception is placed - it must be placed in the module root directory, and it must be named
MyCompany_MyModule_Exception
. For example:This is the way it is because the Magento autoloader will work the same way it does for other Magento classes in that it looks for an
Exception
file in theMyCompany/MyModule
folder.Use the
exception()
method instead ofthrowException()
. The former will throw an exception from a custom module, whereas the latter will throw aMage_Core_Exception
:Catch:
More specific exceptions
A side note, if you want to make your exceptions more specific to certain parts of your module, e.g. a certain Model, you can create Exception classes and put them whereever you want, as long as they follow the correct Magento naming convention for a class. You wouldn't use the method above to throw them however, you'd just have to throw them the old fashioned way:
Then throw it like this: