Question on blocks and templates

A place for users and developers of the Xataface to discuss and receive support.

Question on blocks and templates

Postby digital1 » Tue Nov 23, 2010 10:52 am

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.
digital1
 
Posts: 24
Joined: Wed Nov 03, 2010 9:40 am

Re: Question on blocks and templates

Postby digital1 » Tue Nov 23, 2010 4:13 pm

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!
digital1
 
Posts: 24
Joined: Wed Nov 03, 2010 9:40 am


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 18 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved