Reuse Of code

I want to reuse of code for-example for checking error i write die or echo many time.

example die("Code is write above this line ").Is there any way that i write it for one time and i give it a name like "help" whenever i write help die("Code is write above this line ") will run .i only know that i have make my helper page in component but i dont know to write the code in component n how i can use it please help me with example.

hi

this is a suggestion, not a good way:

you can write function and include it in index.php like this :


require_once dirname(__FILE__).'/protected/help.php';

Then what should be a good way

You can also throw an exception, catch the exception at the "highest" level and write the help message there.

You can check the exception type and/or message to know if you need to write the help message or not.

Using "die" is not the good idea IMHO.