How to easily figure out which .tpl to edit?

alt=
K_K
@k-k
3 years ago
95 posts
I don't do much editing and part of it is that I have a hard time figuring out which .tpl to edit, so when I have to do something, it becames a chore.

And when done seldom, it is always a new learning process.

How you guys that do it frequently identify the right .tpl?

I have the thing enabled that puts the .tpl info in the source code, but that does not seem to help that much with module .tpls.
updated by @k-k: 10/26/21 12:49:03AM
michael
@michael
3 years ago
7,714 posts
Why doesn't it help much, it should take you right to where you want to go.

For me the way I like to edit the templates is not from within jamroom at all, I like to do it from an editor that works on my computer.

I store a copy of my website on my computer and the software keeps the two in sync. I use "PhpStorm" but if you're only editing occasionally it might not be the best for you.

When I want to figure out what template I need to be working on I find some code that looks unique-ish on the page, usually a class="something-unique-looking" then do a search with phpstorm for "something-unique-looking" to see which-of-all templates it could possibly be.

If I'm lucky there are only 2 or 3 location, from there if I dont know which one it is I'll write something to all of them

class="something-unique-looking 111"
class="something-unique-looking 222"
class="something-unique-looking 333"

Then go look again to see which one shows up on the page I want to know about. if its 222 then I know thats the location to edit.

Also another thing to turn on when making edits is DEVELOPER MODE so you dont need to reset the caches each time. its at
ACP -> MODULES -> DEVELOPER -> DEVELOPER TOOLS -> GLOBAL CONFIG
developer.png
developer.png  •  62KB

alt=
K_K
@k-k
3 years ago
95 posts
michael:
For me the way I like to edit the templates is not from within jamroom at all, I like to do it from an editor that works on my computer.

I store a copy of my website on my computer and the software keeps the two in sync. I use "PhpStorm" but if you're only editing occasionally it might not be the best for you.
Thanks, that is very useful.
alt=
K_K
@k-k
3 years ago
95 posts
michael:
Why doesn't it help much, it should take you right to where you want to go.
For example I just had to edit the activity.tpl in forum module, because it came up with errors in Google Search Console.

Page url like https://example.com/forum/activity/10/username/p=2

In the source code for the page, the activity.tpl name does not come up and neither that it is from Forum module. (header.tpl, meta.tpl etc are showing as usual)

Figured the template out from the url, but with some core templates it is not that easy.
michael
@michael
3 years ago
7,714 posts
Here's some generalizations of where things could be:

site.com/avacardo
if there is a module that uses the module url 'avacardo' then the template that shows that page will most likely be
/modules/xxAvacardo/templates/index.tpl
But if there is no module then the template will probably be at
/skins/(YOUR SKIN)/avacardo.tpl

if the URL is on a profile then its probably controlled by a module, so if the url is
site.com/michael/avacardo
then the template will most likely be
/modules/xxAvacardo/templates/item_index.tpl
but that could have an over-ride template in place at the skin level, so if
/skins/(YOUR SKIN)/xxAvacardo_item_index.tpl
that will be over-riding the modules version.

if there is a number in the URL on a profile then you're likely not looking at a list, but at the DETAIL page of a single item, eg
site.com/michael/avacardo/24
then the template will likely be
/modules/xxAvacardo/templates/item_detail.tpl
but could have an over ride at
/skins/(YOUR SKIN)/xxAvacardo_item_detail.tpl

--edit--
ah yeah on that URL the template names is not so much help. What you have here:
https://example.com/forum/activity/10/username/p=2

is the forum module, so jrForum and the page we're looking at has another / after the module name so its most likely a function. the visibile functions are stored in the index.php file of a module, so
/modules/jrForum/index.php
is the file, then the function name is /activity/ so open that file and look for
function view_jrForum_activity() to see whats going on with the page.
updated by @michael: 07/27/21 03:34:26AM
alt=
K_K
@k-k
3 years ago
95 posts
Thanks for infos, this helps a lot :).