Custom Template

Moderator: crythias

Locked
mabullo
Znuny newbie
Posts: 6
Joined: 28 Apr 2020, 15:55
Znuny Version: 6.0.27
Real Name: Marco Bullo
Company: Elinet

Custom Template

Post by mabullo »

Hi, everybody,
I have approached the OTRS world a few days ago, currently I have installed version 6.0.27.
My problem is that following the official documentation (OTRS Developer Manual both version 6 and 7) and precisely the chapter https://doc.otrs.com/doc/manual/develop ... hemes.html I can't set up a template of my own, even if trivial.
  • I create the new folder -> Kernel/Output/HTML/Templates/New_folder
  • I copy the files I'm interested in editing from Kernel/Output/HTML/Templates/Standard, in my case only CustomerLogin.tt
  • Then I log on the portal with Admin -> SystemConfiguration and in the search field I enter Frontend::Themes
  • at this point I had added the name of the theme and put as value 1, to 0 the others
Once these operations are done nothing happens... I also tried to launch the Cache and configuration rebuild from the command line but nothing changes.
Am I missing something? :(

Thanks
zzz
Znuny superhero
Posts: 914
Joined: 15 Dec 2016, 15:13
Znuny Version: All
Real Name: Emin
Company: Efflux GmbH
Contact:

Re: Custom Template

Post by zzz »

Hey,

What are you trying to achieve?
Are you only trying to replace an existing file (CustomerLogin.tt)? In that case, something way simpler is needed than generating a theme.

— Emin
Professional Znuny and OTRS services: efflux.de | efflux.de/en/

Free and premium add-ons: German | English
mabullo
Znuny newbie
Posts: 6
Joined: 28 Apr 2020, 15:55
Znuny Version: 6.0.27
Real Name: Marco Bullo
Company: Elinet

Re: Custom Template

Post by mabullo »

Hi,
What I would like to achieve is to customize a template, initially for the management of the Customer part. I have also already tried to create my own Skin for editing styles.
zzz
Znuny superhero
Posts: 914
Joined: 15 Dec 2016, 15:13
Znuny Version: All
Real Name: Emin
Company: Efflux GmbH
Contact:

Re: Custom Template

Post by zzz »

To change an existing file, all you have to do is create the same path in the Custom folder. For example:
If you're trying to edit /opt/otrs/Kernel/Output/HTML/Templates/Standard/CustomerLogin.tt
you have to copy the file into:
/opt/otrs/Custom/Kernel/Output/HTML/Templates/Standard/CustomerLogin.tt

Now you're free to make all the changes that file. Please don't forget to copy that file as well on an update.

Themes are a bit more complicated and something different.
They can be used to serve different files based on the current domain, like showing login a for customer a and login b for customer b.

— Emin
Professional Znuny and OTRS services: efflux.de | efflux.de/en/

Free and premium add-ons: German | English
mabullo
Znuny newbie
Posts: 6
Joined: 28 Apr 2020, 15:55
Znuny Version: 6.0.27
Real Name: Marco Bullo
Company: Elinet

Re: Custom Template

Post by mabullo »

Thanks zzz,
That's all I need right now 8) .
Last thing if I have not misunderstood, the Custom folder and everything you create inside it is not maintained after an update/upgrade?

Thanks
zzz
Znuny superhero
Posts: 914
Joined: 15 Dec 2016, 15:13
Znuny Version: All
Real Name: Emin
Company: Efflux GmbH
Contact:

Re: Custom Template

Post by zzz »

Yep, that's correct.
You have two options: copy your custom files into the new OTRS folder or make your own extension/add-on ( https://doc.otrs.com/doc/manual/develop ... lding.html).

— Emin
Professional Znuny and OTRS services: efflux.de | efflux.de/en/

Free and premium add-ons: German | English
mabullo
Znuny newbie
Posts: 6
Joined: 28 Apr 2020, 15:55
Znuny Version: 6.0.27
Real Name: Marco Bullo
Company: Elinet

Re: Custom Template

Post by mabullo »

Thanks, zzz,
one last thing to finish this part.
If I have to upload additional js and css files do I use the "Loader"?
For the js files, if I understand correctly, I copy them in '/var/httpd/htdocs/js/thirdparty/' and then I should add a piece of XML, I suppose to the xml file of the Skin, for example:

Code: Select all

<Setting Name="Loader::Customer::CommonJS###000-Framework" Required="1" Valid="1">
    <Description Translatable="1">My custom file.</Description>
    <Navigation>Frontend::Base::Loader</Navigation>
    <Value>
        <Array>
            <Item>thirdparty/my_js_folder/function.js</Item>
        </Array>
    </Value>
</Setting>
But instead to add a CSS file to the Customer Interface, using the Loader, where do I place the file? I copy it in '/var/httpd/htdocs/skins/Agent/my_custom_folder/css/' ?

It's correct?

Thanks
zzz
Znuny superhero
Posts: 914
Joined: 15 Dec 2016, 15:13
Znuny Version: All
Real Name: Emin
Company: Efflux GmbH
Contact:

Re: Custom Template

Post by zzz »

The CSS file belongs to:
/var/httpd/htdocs/skins/Customer/default/css/Core.Your.css

And the CSS is

Code: Select all

	<Setting Name="Loader::Customer::CommonCSS###001-Framework" Required="1" Valid="1">
		<Description Translatable="1">List of JS files to always be loaded for the customer interface.</Description>
		<Navigation>Frontend::Base::Loader</Navigation>
		<Value>
			<Array>
				<Item>Core.Your.css</Item>
			</Array>
		</Value>
	</Setting>
Don't forget to execute "/opt/otrs/bin/otrs.Console.pl Maint::Config::Rebuild --cleanup" to enable the setting.

I've just released the ModernSkinCustomer add-on on our portal. You can analyze the files if that helps you (it's free).

Don't hesitate to ask if you're stuck.

— Emin
Professional Znuny and OTRS services: efflux.de | efflux.de/en/

Free and premium add-ons: German | English
mabullo
Znuny newbie
Posts: 6
Joined: 28 Apr 2020, 15:55
Znuny Version: 6.0.27
Real Name: Marco Bullo
Company: Elinet

Re: Custom Template

Post by mabullo »

Hi, ZZZ,
thanks for the piece of code. I registered on the Efflux portal, I downloaded the file EffluxRepository-1.0.1.opm, I suppose then I have to follow the installation procedure that will create me folders and files for the new Skin?

Thanks
zzz
Znuny superhero
Posts: 914
Joined: 15 Dec 2016, 15:13
Znuny Version: All
Real Name: Emin
Company: Efflux GmbH
Contact:

Re: Custom Template

Post by zzz »

*Off-topic*
You can find a tutorial if you click on 'How to install', which is located below the "EffluxRepository.opm" button.

After installing a package, you can inspect the created files and paths in the package manager.
That should help you understand how skins are build and you can copy the XML to create your own.

— Emin
Professional Znuny and OTRS services: efflux.de | efflux.de/en/

Free and premium add-ons: German | English
Locked