Page 1 of 1

Question on blocks and templates

PostPosted: Tue Nov 23, 2010 10:52 am
by digital1
Hello Steve and everyone else,

I have a question that hopefully someone can point me the right way to answer. I would like to put a custom HTML output at the bottom of a page based upon if the table has a specific name, and if it doesn't just show the normal template without my extra HTML throughout the rest of the application. I figure I would need to know the table name through some variable. I was looking at the blocks and templates themselves. Is there a way I can do this as some code for the delegate class of the table itself that calls the block? or would this be a modification on the smarty template? Is there a demo/code sample somewhere I can see? Thank you very much in advance. I appreciate it.

Re: Question on blocks and templates

PostPosted: Tue Nov 23, 2010 4:13 pm
by digital1
Figured it out. Just in case someone needs the answer to this. Here goes.


1. In your "tablename".php file that has all the functions for your particular table in your application insert the following function like so:

Code: Select all
class tables_show {
..........
....
..
function block__before_record_footer(){

//Do something interesting here like echo something in html.

}


}




2. in the function block__before_record_footer() do your custom displays and custom html code. This is way cleaner then changing the templates. If you need to find out which blocks you want to change go to conf.ini and add the following line

debug=1
This will help you determine which region you want to add custom code to as well what the name of your function will be. When you determine the block you want to add some text or functionality to you have your function. (e.g. function block__"Region Name"())

Hope this helps someone!