Template Duplication Topic is solved

Everything to do with Joomla! 4.x templates and templating.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
Locked
aitim
Joomla! Intern
Joomla! Intern
Posts: 56
Joined: Sun May 15, 2022 8:46 pm

Template Duplication

Post by aitim » Sun Aug 14, 2022 9:07 pm

What is the bast way to duplicate the Cassiopeia so that I end up with something like MyRevisedCassiopeiaTemplate.

The only way I can see doing this with Joomla 4.1 is to download the Cassiopeia template, unzip it, rename everything to the new template name including everything in templateDetails.xml, joomla.asset.json, configuration.php, perhaps the language constants, and anything else that is needed to uniquely identify this as a different template than Cassiopeia, zip it back up and install it.

I want to be able to keep the original Cassiopeia template for reference in case something goes wrong during the modification process, and I don't want my changes to be overridden during the update process, plus I want to be able to see what changes are made to the original Cassiopeia template during the update process so that I can add those changes to my modified template.

User avatar
Per Yngve Berg
Joomla! Master
Joomla! Master
Posts: 30926
Joined: Mon Oct 27, 2008 9:27 pm
Location: Romerike, Norway

Re: Template Duplication

Post by Per Yngve Berg » Sun Aug 14, 2022 9:28 pm

The way to do it in 4.1, is to create a child template.

https://magazine.joomla.org/all-issues/ ... -templates

sozzled
I've been banned!
Posts: 13639
Joined: Sun Jul 05, 2009 3:30 am
Location: Canberra, Australia

Re: Template Duplication

Post by sozzled » Sun Aug 14, 2022 9:29 pm

See the attached animation (you need to click it) to demonstrate how to duplicate the Cassiopeia template.

[Author removed incorrect information from this post]
You do not have the required permissions to view the files attached to this post.
Last edited by sozzled on Sun Aug 14, 2022 9:46 pm, edited 1 time in total.

User avatar
brian
Joomla! Master
Joomla! Master
Posts: 12787
Joined: Fri Aug 12, 2005 7:19 am
Location: Leeds, UK
Contact:

Re: Template Duplication

Post by brian » Sun Aug 14, 2022 9:42 pm

@sozzled - that is duplicating a style not duplicating a template - two very different things as I'm sure you already know.

As Per said Child Templates are the way to go
"Exploited yesterday... Hacked tomorrow"
Blog http://brian.teeman.net/
Joomla Hidden Secrets http://hiddenjoomlasecrets.com/

sozzled
I've been banned!
Posts: 13639
Joined: Sun Jul 05, 2009 3:30 am
Location: Canberra, Australia

Re: Template Duplication

Post by sozzled » Sun Aug 14, 2022 9:44 pm

Mea culpa, @brian. My apologies to @Per and the OP.

sozzled
I've been banned!
Posts: 13639
Joined: Sun Jul 05, 2009 3:30 am
Location: Canberra, Australia

Re: Template Duplication

Post by sozzled » Sun Aug 14, 2022 10:01 pm

See the attached animation instead. I hope I have it right this time.
You do not have the required permissions to view the files attached to this post.

aitim
Joomla! Intern
Joomla! Intern
Posts: 56
Joined: Sun May 15, 2022 8:46 pm

Re: Template Duplication

Post by aitim » Sun Aug 14, 2022 11:42 pm

Well, I created a full version of the Cassiopeia template that I called Sagacic instead of Cassiopeia. Just a name change nothing else and I changed that name in every instance that Cassiopeia/cassiopeia was used including the language files.

I was about to assemble all the files and folders and make it installable when I saw these many suggestions.

Thanks you Per. can I make the Child Template the default?

Same thing Sozzled.

And thank you brian for observing that duplicate is for styles only. Had already read three tutorials that pointed this out.

I like the idea of Child Templates as a way of preserving modifications. That would be perfect if I could also make a Child Template the default.

sozzled
I've been banned!
Posts: 13639
Joined: Sun Jul 05, 2009 3:30 am
Location: Canberra, Australia

Re: Template Duplication

Post by sozzled » Sun Aug 14, 2022 11:44 pm

aitim wrote:
Sun Aug 14, 2022 11:42 pm
Can I make the child template (duplicate) the default?
Yes.

aitim
Joomla! Intern
Joomla! Intern
Posts: 56
Joined: Sun May 15, 2022 8:46 pm

Re: Template Duplication

Post by aitim » Sun Aug 14, 2022 11:47 pm

Ohhhh, I can make it default. Wowwww. Inpressive. Piece of pie, easy as cake.

Well, at least I learned how to create my own template if I want to. Not as easy as cake, in fact several hours of work, at least for me. compare that to click, name it, choose the styles I want applied to it, click "Create" and done.

One more thing I wanted to add, is, since Cassiopeia is so adaptable, this almost obviates the need to look anywhere else for a template.
Last edited by aitim on Sun Aug 14, 2022 11:55 pm, edited 1 time in total.

sozzled
I've been banned!
Posts: 13639
Joined: Sun Jul 05, 2009 3:30 am
Location: Canberra, Australia

Re: Template Duplication

Post by sozzled » Sun Aug 14, 2022 11:53 pm

It's just a template, like any other template and, like in every version of J! that I've used for the past ten years or more, you can make it the default template. See https://docs.joomla.org/Template_style

aitim
Joomla! Intern
Joomla! Intern
Posts: 56
Joined: Sun May 15, 2022 8:46 pm

Re: Template Duplication

Post by aitim » Sun Aug 14, 2022 11:56 pm

See the addition I made to the above comment.

aitim
Joomla! Intern
Joomla! Intern
Posts: 56
Joined: Sun May 15, 2022 8:46 pm

Re: Template Duplication

Post by aitim » Sun Aug 14, 2022 11:58 pm

And thanks for the lightning fast replies.

aitim
Joomla! Intern
Joomla! Intern
Posts: 56
Joined: Sun May 15, 2022 8:46 pm

Re: Template Duplication

Post by aitim » Mon Aug 15, 2022 12:09 am

Except that there is no index.php, no html folder, I will need to read and re-read because I already read that you can modify index.php and add and subtract module positions so I just have to learn the process.

aitim
Joomla! Intern
Joomla! Intern
Posts: 56
Joined: Sun May 15, 2022 8:46 pm

Re: Template Duplication

Post by aitim » Mon Aug 15, 2022 1:13 am

Well, my revision of Cassiopeia installed without a hitch. Now I have Cassiopeia - default and Sagaciweb - default and the two are essentially identical except that I used the default Cassiopeia css instead of my modified css.

Here is the thought that came to mind regarding installing a duplicate template instead of using Child Templates.

With the Child Templates, any updates to the template core are available to the Child Templates whenever Joomla 4 is updated, whereas when I create my own duplicate of the Cassiopeia template, the core files no longer get updated when Joomla 4 gets updated.

So I would think, that creating my own duplicate only makes sense where I am continually updating the modified Cassiopeia template and keeping abreast of changes being made to Joomla itself. That is the duplicate template is in continual development and the client is able to pay for that continual development. For the client of more modest means, using the Child Templates makes more sense, because I will not be there to continually make updates to the template and that client would benefit from having the template core files updated every time Joomla 4 gets updated.

Does that make sense?

aitim
Joomla! Intern
Joomla! Intern
Posts: 56
Joined: Sun May 15, 2022 8:46 pm

Re: Template Duplication

Post by aitim » Mon Aug 15, 2022 4:58 am

I ran into a small snag. My copied template does not have a button for "Create Child Template." Instead it has a button for "Copy Template" instead.

Does anyone have any idea what I am missing here?

In templateDetails.xml I have

<inheritable>1</inheritable>

Is there something else that I should include here?

aitim
Joomla! Intern
Joomla! Intern
Posts: 56
Joined: Sun May 15, 2022 8:46 pm

Re: Template Duplication

Post by aitim » Mon Aug 15, 2022 5:38 pm

If someone has understanding of the above question, I would really like to get enlightened. It speaks to the bigger question of how Cassiopeia works. Seems like there is a conditional in Joomla core that says, IF cassiopeia, enable "Create Child Template," otherwise enable "Copy Template"

User avatar
brian
Joomla! Master
Joomla! Master
Posts: 12787
Joined: Fri Aug 12, 2005 7:19 am
Location: Leeds, UK
Contact:

Re: Template Duplication

Post by brian » Mon Aug 15, 2022 5:54 pm

The relevant code is indeed the inheritable attribute in the xml BUT did you actually install the new template. If you did then it would have created a record in the template_styles database and set the value of the field inheritable to 1
"Exploited yesterday... Hacked tomorrow"
Blog http://brian.teeman.net/
Joomla Hidden Secrets http://hiddenjoomlasecrets.com/

aitim
Joomla! Intern
Joomla! Intern
Posts: 56
Joined: Sun May 15, 2022 8:46 pm

Re: Template Duplication

Post by aitim » Mon Aug 15, 2022 10:52 pm

Thanks for the heads up. I seem to have made a typo somewhere because I am not seeing the media files folder listed in the template files. The media files are there in media/templates/site/sagacicweb, which is what I called the duplicate, but they are not registered. I will just comb through this until I find the mistake I made. In fact now the media files aren't getting copied nor are the language files. I am going to start over and do it again, because before I started getting fancy I was getting a complete duplicate including media and language files and they were registered.

I really appreciate the Child Templates and how this makes the Cassiopeia template infinitely customizable. I just want to be able to do both, create my own fork of Cassiopeia and use the Cassiopeia Child Templates as well.

I have read what Philip Walton had to say: Sweet child o' mine... A deep dive into Joomla Child Templates — https://magazine.joomla.org/all-issues/ ... -templates

and watched the video by Dimitris Grammatiko: Sweet child o' mine; A deep dive into Child Templates for Joomla 4.1 — https://www.[youtube].com/watch?v=8lX44gS9QG8&t=72s

If there are more sources of information, I would be more than appreciative to know them.

I will check the template_styles table to make sure that 1 is getting registered. So thanks to making me aware of that check I can do, easy to do with phpMyAdmin

Image

aitim
Joomla! Intern
Joomla! Intern
Posts: 56
Joined: Sun May 15, 2022 8:46 pm

Re: Template Duplication

Post by aitim » Tue Aug 16, 2022 12:18 am

Wow, I capitalized <name>Sagacicweb</name> instead of <name>sagacicweb</name> in templateDetails.xml

Now all is well, I have "Create Child Templates" back, "media" files are back and "language" files are back and the language constants are being replaced with their values.

aitim
Joomla! Intern
Joomla! Intern
Posts: 56
Joined: Sun May 15, 2022 8:46 pm

Re: Template Duplication

Post by aitim » Tue Aug 16, 2022 3:39 am

Image
Image

aitim
Joomla! Intern
Joomla! Intern
Posts: 56
Joined: Sun May 15, 2022 8:46 pm

Re: Template Duplication

Post by aitim » Tue Aug 16, 2022 4:05 pm

I just updated to Joomla 4.2 and all my styles in Cassiopeia were overwritten and returned to the Cassiopeia default.

When I switch the default site template to the duplicate of Cassiopeia, I called Sagacicweb, everything is preserved.

However, by using the duplicate I lose any enhancements made to Cassiopeia by the Joomla team. And, had I created a child template to serve as the site default, my styles would have been preserved even when Joomla is updated anyway.

It is just nice knowing that I can have my cake and eat it at the same time. I can enhance my duplicate of Cassiopeia in any manner my heart desires while at the same time I can rely on the awesome Cassiopeia template to be continually enhanced by the Joomla team while I safely make my modifications to the child template.

I mean, how awesome is that?

aitim
Joomla! Intern
Joomla! Intern
Posts: 56
Joined: Sun May 15, 2022 8:46 pm

Re: Template Duplication

Post by aitim » Tue Aug 16, 2022 6:16 pm

For anyone interested, here are the files and folders that need to be included in the duplicate of the Cassiopeia site template.

Image

And in many of the files the name cassiopeia needs to be changed to my-duplicate-template-name, whatever name you choose. I mean in every instance. I would even change the name of all the language constants as well just to be complete from TPL_CASSIOPEIA… to TPL_MY_DUPLICATE_TEMPLATE_NAME…. And then remember to change the name of the language constants in every file where they appear, in order to get the language constant name replaced with it's value.

And remember, if you do this, your version of the Cassiopeia template will no longer get any enhancements provided by the Joomla Development team whenever you update Joomla 4.x. It is better to use child templates, and make a Cassiopeia_Main child template the default template if you want it applied to every page where you haven't created a specific child template for that page. That way the Cassiopeia core files get updated and enhanced whenever you update Joomla 4.x, yet your modifications to specific files, like *.css and *.js are preserved.


Locked

Return to “Templates for Joomla! 4.x”