How to pass data to template

Moderator: crythias

Locked
dstover
Znuny advanced
Posts: 135
Joined: 04 Jun 2013, 23:14
Znuny Version: 3.3.3
Real Name: Dan Stover
Company: EMAC, Inc.

How to pass data to template

Post by dstover »

Hello. I would like to be able to pass variable data to a dtl (template) file. For example, the Article.dtl file has some data passed to it in the Body field which I would like to modify. Please let me know a way to do this.

Thanks in advance for any info...Dan.
OTRS 3.3.3
Ubuntu 12.04
MySQL DB
reneeb
Znuny guru
Posts: 5018
Joined: 13 Mar 2011, 09:54
Znuny Version: 6.0.x
Real Name: Renée Bäcker
Company: Perl-Services.de
Contact:

Re: How to pass data to template

Post by reneeb »

In the .pm files (e.g. Kernel/Modules/AgentTicketPhone.pm) you'll find something like

Code: Select all

$Self->{LayoutObject}->Block( 
    Name => '...';
    Data => {
        ...
    },
);
or

Code: Select all

$Self->{LayoutObject}->Block( 
    TemplateFile => '...';
    Data => {
        ...
    },
);
. The hash passed to "Data" contains all the values for the template. This might also help: http://doc.otrs.org/developer/3.3/en/ht ... anism.html
Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
dstover
Znuny advanced
Posts: 135
Joined: 04 Jun 2013, 23:14
Znuny Version: 3.3.3
Real Name: Dan Stover
Company: EMAC, Inc.

Re: How to pass data to template

Post by dstover »

Thank you very much. I will look into that.
OTRS 3.3.3
Ubuntu 12.04
MySQL DB
dstover
Znuny advanced
Posts: 135
Joined: 04 Jun 2013, 23:14
Znuny Version: 3.3.3
Real Name: Dan Stover
Company: EMAC, Inc.

Re: How to pass data to template

Post by dstover »

I think I see how that works. What I really need is to bring up an activity dialog screen with an article field with predefined values in the article fields. I see that Article.dtl is where this comes from initially but how do I pass data to that so that the fields are filled in?

Any ideas? Thanks...Dan.
OTRS 3.3.3
Ubuntu 12.04
MySQL DB
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: How to pass data to template

Post by crythias »

Do you want to pass client side, server side, or via URL?
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
dstover
Znuny advanced
Posts: 135
Joined: 04 Jun 2013, 23:14
Znuny Version: 3.3.3
Real Name: Dan Stover
Company: EMAC, Inc.

Re: How to pass data to template

Post by dstover »

I would think server side. I do not want the client side to know that it happened. I just want to bring up an activity dialog screen that includes a normally blank article with the article fields filled in (Subject, Body, attachments, etc.) from a previously entered article. I think I can get the data from the previous article and save it behind the scenes if I can figure out how to load that activity dialog screen.

Thanks...Dan.
OTRS 3.3.3
Ubuntu 12.04
MySQL DB
Locked