XF 2.1 Template modifications, how does it work? How to create new one?

Alan_SP

Well-known member
It may be a bit stupid but...

I read in manual that I have template modifications (https://xenforo.com/xf2-docs/manual/styles/#templates) and I have that option in ACP, but thing is, how I create new template modification?

Problem is, I don't see button or anything to create new template modification, like on this image:

templates.gif


My admin account is superadmin, I can directly edit template, it works as expected, but here with template modifications, I think that I'm missing button for new modification. In templates, I have button to create new template, that's why I'm thinking that button is missing.

I'm on latest xenforo (2.1.6 Patch1 - I started with xf1.5 to import phpBB forum, then I upgraded xf to 2.1.5, then upgraded to latest version through ACP. No errors were reported.). What's missing, what I'm doing wrong?

And yes, I'm trying to do that on custom style, not main style.
 
Just created xenforo demo, to see how that looks there, same situation, no button for new template modifications, but I see some already created modifications and I can edit them there.

Is this a bug, or I really don't get it how to use it?
 
And, reading manual, I see this part:

Template modifications
As an alternative to customizing templates directly, XenForo also offers a system called Template modifications, which works by allowing you to pick a template, specify a section of the template to find, and a way to insert new template code to modify the specified section.

In the template modification manager, you will find a list of all template modifications currently in use, grouped by the add-on which has defined them. You may quickly disable and re-enable any template modification by using the toggle gadget in the list.

Clicking on one of these modifications, or clicking the Add template modification button, will load the template modification editor.

So, I guess there should be button for new template modification?
 
The button only appears if you enable development mode (which I wouldn't recommend on a live board). Template modifications are mostly for add-on development. Strangely, it appears you can access the page directly at admin.php?template-modifications/add&type=public so long as you have style permissions, which I presume is a bug.
 
Yes, that's answer, I only need to add "add" and get new template modification.

I'm just wandering, wouldn't it be better if there's a button like manual say, or to edit manual and add this info about adding "add" to address? This seems a bit strange, though it certainly works.
 
Template modifications are mostly for add-on development.

Well, if you need to directly edit templates (and sometimes you do), this is much better way than directly tamper with templates.

In this way, you have all your edits in one place, you see which templates you tampered with and all in all, it is better way to edit templates, when you need to edit them.
 
Back
Top Bottom