hello,
could use a little help.
i try this:
------------------
http://doc.otrs.org/developer/3.0/en/html/hacking.html
Using a template file
Ok, but how to actually process a template file and generate the result? This is really simple ^ ^:
# Render AdminState.dtl
$ Output = $ self-> {Object} layout -.> Output (
Template File => 'Admin State',
Data => \% param,
);
In the frontend modules, the output () function of Kernel :: Output :: HTML :: Layout is called (after all the needed blocks have been called into this template) to generate the final output. An optional set of data parameters is not passed to the template, inserting data for all commands Which are inside of a block.
The source code of this document can be found at source.otrs.org.
-------------------
but i get this
Error message: Global symbol "$ output" requires explicit package name at C :/ Program 2/OTRS/OTRS / [..]
which is the package name?
what am I doing wrong?
greeting
Using a template file
-
- 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: Using a template file
Can you show more code?
If you want to develop a new feature (a new module) for OTRS you need (at least) three files: the configuration file, the module and the template.
In the configuration file you have to enable the frontend module. You can do it either with a perl module or with an XML file. If you do it the XML way, you can change the settings via SysConfig. With the Perl way you can't...
For the beginning it is easier with the Perl file. Create Kernel/Config/Files/Calendar.pm
You have to replace 'Calendar' with the module name.
You module has to be located in Kernel/Modules and it has to provide two methods: 'new' and 'Run'. In the new method the object is created and it checks if it has all needed stuff:
The Run method actually adds functionality to the feature. An example:
And in Kernel/Output/HTML/Standard, you need (in this example) a 'Contact.dtl'.
I saw in your profile, that you speak German, so this might be interesting to you: http://otrs.perl-services.de/workshop.html
If you want to develop a new feature (a new module) for OTRS you need (at least) three files: the configuration file, the module and the template.
In the configuration file you have to enable the frontend module. You can do it either with a perl module or with an XML file. If you do it the XML way, you can change the settings via SysConfig. With the Perl way you can't...
For the beginning it is easier with the Perl file. Create Kernel/Config/Files/Calendar.pm
Code: Select all
# module reg and nav bar
$Self->{'Frontend::Module'}->{'AgentCalendar'} = {
Description => 'Calendar',
NavBarName => 'Ticket',
NavBar => [
{
Description => 'Calendar',
Name => 'Calendar',
Image => 'calendar.png',
Link => 'Action=AgentCalendar',
NavBar => 'Ticket',
Prio => 5000,
AccessKey => 'c',
},
],
};
You module has to be located in Kernel/Modules and it has to provide two methods: 'new' and 'Run'. In the new method the object is created and it checks if it has all needed stuff:
Code: Select all
sub new {
my ( $Type, %Param ) = @_;
# allocate new hash for object
my $Self = {%Param};
bless( $Self, $Type );
# set debug
$Self->{Debug} = 0;
# check all needed objects
for my $Needed (qw(ParamObject DBObject LayoutObject ConfigObject LogObject)) {
if ( !$Self->{$Needed} ) {
$Self->{LayoutObject}->FatalError( Message => "Got no $Needed!" );
}
}
# hier evtl. weitere notwendige Objekte erzeugen
return $Self;
}
Code: Select all
sub Run {
my ( $Self, %Param ) = @_;
my $Output = $Self->{LayoutObject}->Output(
TemplateFile => 'Contact',
Data => \%Param,
);
}
I saw in your profile, that you speak German, so this might be interesting to you: http://otrs.perl-services.de/workshop.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
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
Re: Using a template file
that works.
solved ...
Thank you very much
solved ...
Thank you very much