Roundcube Community Forum

News and Announcements => General Discussion => Topic started by: rohitsyte on May 23, 2012, 03:47:10 AM

Title: How to pass data from plugin file to template skin
Post by: rohitsyte on May 23, 2012, 03:47:10 AM
Hello all,

I am pretty new to roundcube plugin development, I am working on a project that demanded me to create a custom plugin, I have figured out how to access the database code from my custom plugin, but where I am stuck is that how to pass this data to the template for display? The template code is in HTML, I tried writing some PHP scripts in it but it didn't work. What I need to be able to do is that display the set of records that have been fetched from the database in the plugin file in its template. I found nowhere a good tutorial or documentation for doing the same and I am posting my request here.

Any help would be greatly appreciated...
Title: Re: How to pass data from plugin file to template skin
Post by: SKaero on May 23, 2012, 05:39:11 AM
Have you read the plugin documentation?
Plugin documentation: http://trac.roundcube.net/wiki/Doc_Plugins
Plugin hooks: http://trac.roundcube.net/wiki/Plugin_Hooks
Skin documentation: http://trac.roundcube.net/wiki/Doc_SkinML
Title: Re: How to pass data from plugin file to template skin
Post by: rohitsyte on May 23, 2012, 07:17:09 AM
Thank you for your reply, yes I have checked the links, but I have all the database data in an associative array in the plugin file, I don't know how to display the contents of the array in the template file..
Title: Re: How to pass data from plugin file to template skin
Post by: SKaero on May 23, 2012, 02:11:35 PM
Are you trying to:
1. display a table of data on a complete new page
2. modify an existing page
3. load the data on an existing page dynamically (i.e. after a button is clicked)
Title: Re: How to pass data from plugin file to template skin
Post by: rohitsyte on May 24, 2012, 01:01:12 AM
Currently I am trying to display the data from the database in a completely new page. I have also a requirement to display the data on an existing page dynamically further in the project. So, these two are my scenarios.
Title: Re: How to pass data from plugin file to template skin
Post by: SKaero on May 24, 2012, 04:48:10 AM
Then read the Templates section in the plugin documentation http://trac.roundcube.net/wiki/Doc_Plugins#Templates its walks through adding the handler and using the roundcube:object tag to access it.