[Solved] Variables for Templates
Moderator: crythias
[Solved] Variables for Templates
Hi,
is it possible to define something like a variable holding html text to be used in templates?
(We'd like to have a central place where we can add constantly changing important information to templates as a kind of footer. E.g. "<b>Important:</b> security bug in Version 1.1, please update to 1.2".)
Any hints welcome.
Thanks
ndis
is it possible to define something like a variable holding html text to be used in templates?
(We'd like to have a central place where we can add constantly changing important information to templates as a kind of footer. E.g. "<b>Important:</b> security bug in Version 1.1, please update to 1.2".)
Any hints welcome.
Thanks
ndis
Last edited by ndis on 01 May 2014, 21:08, edited 1 time in total.
-
- Znuny newbie
- Posts: 19
- Joined: 16 Apr 2014, 15:27
- Znuny Version: 3.3.6
Re: Variables for Templates
Hi,
Sry I can't provide an instant solution.
Possibilities 1)
With the Generic Agent you could add a text to a dynamic field of each ticket or even different Texts for each queue. Afterwards you could show it in the ticket Zoom.
This has the advantage that even when you change the Notification you have still the old Notification coupled to the old tickets, and new notifications only to new tickets.
Managing the notification is then possible inside the genericAgent Admin menu.
Possibilites 2)
If you want the notification to be only stored once you could hard code it in the Template. But then the notification is always shown even new notifications for old tickets.
Also management isn't that easy.
Possibilities 3)
Like in possibilites 2) this will provide one text that is always shown (no matter how old the ticket is) But you can manage it through the webfrontend and you can have different text for different queues.
But it's the compicatest possibilites. You can store and manage text "once" with the FAQ module. Installing this and creating one FAQ entry or even one per queue is the first step. Then the template needs to be adopted to look up the corresponging FAQ article and show it.
I would go with possibilities one because of the history possibilities and the easy integration without touching any code. This ensures updateability.
Greeting Christoph
Sry I can't provide an instant solution.
Possibilities 1)
With the Generic Agent you could add a text to a dynamic field of each ticket or even different Texts for each queue. Afterwards you could show it in the ticket Zoom.
This has the advantage that even when you change the Notification you have still the old Notification coupled to the old tickets, and new notifications only to new tickets.
Managing the notification is then possible inside the genericAgent Admin menu.
Possibilites 2)
If you want the notification to be only stored once you could hard code it in the Template. But then the notification is always shown even new notifications for old tickets.
Also management isn't that easy.
Possibilities 3)
Like in possibilites 2) this will provide one text that is always shown (no matter how old the ticket is) But you can manage it through the webfrontend and you can have different text for different queues.
But it's the compicatest possibilites. You can store and manage text "once" with the FAQ module. Installing this and creating one FAQ entry or even one per queue is the first step. Then the template needs to be adopted to look up the corresponging FAQ article and show it.
I would go with possibilities one because of the history possibilities and the easy integration without touching any code. This ensures updateability.
Greeting Christoph
Re: Variables for Templates
Thanks Christoph.
We'd rather not hard code anything for various reasons.
Regarding your first suggestion, I am not sure if I did not explain our situation properly, or if I do not understand your approach.
We want to add predefined (html) text to templates. So when answering to a ticket and using a given template, this prdefined text should appear in the answer. I hoped there migth be a tag like <OTRS_SOMETHING_MyText1> that we can use within a template like other tags. I did take a short look into DynamicFields, but as far as I understand that's not what they are made for. (Please correct me if I am wrong.)
Is it clear what we are loking for?
Regards
ndis
We'd rather not hard code anything for various reasons.
Regarding your first suggestion, I am not sure if I did not explain our situation properly, or if I do not understand your approach.
We want to add predefined (html) text to templates. So when answering to a ticket and using a given template, this prdefined text should appear in the answer. I hoped there migth be a tag like <OTRS_SOMETHING_MyText1> that we can use within a template like other tags. I did take a short look into DynamicFields, but as far as I understand that's not what they are made for. (Please correct me if I am wrong.)
Is it clear what we are loking for?
Regards
ndis
-
- Moderator
- Posts: 10169
- Joined: 04 May 2010, 18:38
- Znuny Version: 5.0.x
- Location: SouthWest Florida, USA
- Contact:
Re: Variables for Templates
Have you tried putting the code in a dynamic field?
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
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
Re: Variables for Templates
Hi,
yes, put the value in a dynamic field and make a <OTRS_DynamicField_Value_...> or whatever.
Works fine.
Florian
yes, put the value in a dynamic field and make a <OTRS_DynamicField_Value_...> or whatever.
Works fine.
Florian
OTRS 8 SILVER (Prod)
OTRS 8 auf Debian 11 (Test)
Znuny 7.x latest version testing auf Debian 11
-- Ich beantworte keine Forums-Fragen PN - No PN please
I won't answer to unfriendly users any more. A greeting and regards are just polite.
OTRS 8 auf Debian 11 (Test)
Znuny 7.x latest version testing auf Debian 11
-- Ich beantworte keine Forums-Fragen PN - No PN please
I won't answer to unfriendly users any more. A greeting and regards are just polite.
Re: Variables for Templates
I did try dynamic fields without success. Since I am new to OTRS, I am probably
doing something absolutely wrong.
I did create two test fields in "Administration -> DynamicFields". One for "Articel"
named "Test2" and one for "Ticket" named "Test". Both of the type "Textarea"
with a "Default Value" set to:
Some <b>bold</b> Text<br>
in two lines.
This is how I am trying to include them in the template and what it is replaced with
when using the template:
Template Source
------------------------------------------------------------------------------
Ticket:
#1: <OTRS_DynamicField_Value_Test>
#2: <OTRS_TICKET_DynamicField_Test>
#3: <OTRS_TICKET_DynamicField_Test_Value>
Article:
#1: <OTRS_DynamicField_Value_Test2>
#2: <OTRS_TICKET_DynamicField_Test2>
#3: <OTRS_TICKET_DynamicField_Test2_Value>
Output (When using the template for an answer):
------------------------------------------------------------------------------
Ticket:
#1: <OTRS_DynamicField_Value_Test>
#2:
#3:
Article:
#1: <OTRS_DynamicField_Value_Test2>
#2: -
#3: -
What am I doing wrong? Is there any additional information I should suppy?
Thanks
ndis
doing something absolutely wrong.
I did create two test fields in "Administration -> DynamicFields". One for "Articel"
named "Test2" and one for "Ticket" named "Test". Both of the type "Textarea"
with a "Default Value" set to:
Some <b>bold</b> Text<br>
in two lines.
This is how I am trying to include them in the template and what it is replaced with
when using the template:
Template Source
------------------------------------------------------------------------------
Ticket:
#1: <OTRS_DynamicField_Value_Test>
#2: <OTRS_TICKET_DynamicField_Test>
#3: <OTRS_TICKET_DynamicField_Test_Value>
Article:
#1: <OTRS_DynamicField_Value_Test2>
#2: <OTRS_TICKET_DynamicField_Test2>
#3: <OTRS_TICKET_DynamicField_Test2_Value>
Output (When using the template for an answer):
------------------------------------------------------------------------------
Ticket:
#1: <OTRS_DynamicField_Value_Test>
#2:
#3:
Article:
#1: <OTRS_DynamicField_Value_Test2>
#2: -
#3: -
What am I doing wrong? Is there any additional information I should suppy?
Thanks
ndis
-
- Moderator
- Posts: 10169
- Joined: 04 May 2010, 18:38
- Znuny Version: 5.0.x
- Location: SouthWest Florida, USA
- Contact:
Re: Variables for Templates
Dynamic Fields are per ticket (or article) and need to be applied to the ticket but aren't automatically, so that's out.
If you want to change the notification for all tickets, change it in the signature attached to the queue (for Replies/Responses) and directly in the AutoResponse.
If you want to change the notification for all tickets, change it in the signature attached to the queue (for Replies/Responses) and directly in the AutoResponse.
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
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
Re: Variables for Templates
Can you please explain what exactly you did to achieve the desired behaviour?wurzel wrote:Hi,
yes, put the value in a dynamic field and make a <OTRS_DynamicField_Value_...> or whatever.
Works fine.
Florian
Thanks
ndis
Re: Variables for Templates
Ok, that's what I thought in the first place, after my tests with dynamic fields haven't been successfull.crythias wrote:Dynamic Fields are per ticket (or article) and need to be applied to the ticket but aren't automatically, so that's out.
Isn't there any general namespace where I can define a variable in, or maybe reuse something existing, set it's value to what I need, and do not use the original feature, that it was meant for? I hoped to find something in <OTRS_CONFIG_*> but am simply not experienced enought to proceed that way myselfe. I do not want to hardcode something in the GUI, since that sounds like trouble with every update in future, but I wouldn't mind setting something manually in the database as long as I know what feature I am breaking by using an existing (maybe legacy?) configuration option for my text.
We can not do that for all tickets, since the text I have in mind is to long and will confuse the receipent, if it is part of every anwser.crythias wrote: If you want to change the notification for all tickets, change it in the signature attached to the queue (for Replies/Responses) and directly in the AutoResponse.
Thanks
ndis
-
- Moderator
- Posts: 10169
- Joined: 04 May 2010, 18:38
- Znuny Version: 5.0.x
- Location: SouthWest Florida, USA
- Contact:
Re: Variables for Templates
Create a custom response with the information.ndis wrote:We can not do that for all tickets, since the text I have in mind is to long and will confuse the receipent, if it is part of every anwser.
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
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
Re: Variables for Templates
I am not sure if I really understand (as said before, I am rather new to OTRS). If "custom response" means an additional template with the desired text, the problem is, that we will need that text with different other textblocks. The other textblocks will (almost) never change, but the additional common textblock will change all the tim, so we do not want / cannot change it manually in all templates every day.crythias wrote:Create a custom response with the information.ndis wrote:We can not do that for all tickets, since the text I have in mind is to long and will confuse the receipent, if it is part of every anwser.
E.g.
Template 1 (Empty answer + variabel)
Template 2 (New ticket text+ variable)
Template 3 (Ticket closed text+ variable)
...
BUT (and that's why the signature will not do the Job)
Template 4 (Empty answer WITHOUT variable)
...
Thanks
ndis
-
- Moderator
- Posts: 10169
- Joined: 04 May 2010, 18:38
- Znuny Version: 5.0.x
- Location: SouthWest Florida, USA
- Contact:
Re: Variables for Templates
Use <OTRS_CONFIG_MyVariable>ndis wrote: If "custom response" means an additional template with the desired text, the problem is, that we will need that text with different other textblocks. The other textblocks will (almost) never change, but the additional common textblock will change all the tim, so we do not want / cannot change it manually in all templates every day.
in Config.pm:
$Self->{MyVariable} = "<b>Hello, World</b>";
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
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
Re: [Solved] Variables for Templates
Yes, that's it! HERO
-
- Moderator
- Posts: 10169
- Joined: 04 May 2010, 18:38
- Znuny Version: 5.0.x
- Location: SouthWest Florida, USA
- Contact:
Re: [Solved] Variables for Templates
BTW, Kudos to you for asking a question I haven't seen asked before.
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
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
-
- Znuny newbie
- Posts: 47
- Joined: 21 Sep 2012, 07:55
- Znuny Version: 5.0.10
- Real Name: Игорь (Igor)
Re: Variables for Templates
Thank you very much! That's what I'm looking for.crythias wrote:
Use <OTRS_CONFIG_MyVariable>
in Config.pm:
$Self->{MyVariable} = "<b>Hello, World</b>";
OTRS 6.0.20, Debian GNU/Linux 9 stretch