Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

Correct way to modify additionnal theme?

Started by Muut Archive 11 years ago · 9 replies · 332 views
11 years ago

Hello every one ♪
I would like to thank the community for Grav: its an oustanding tool and I'm glad to discover it !!! ☆

Here is a question:
I am currently using theme ANTIMATTER modified by MYTHEME (inheritance).

For a part of my site, I want to use theme LEARN2

It work great with plugin of @sommerregen themer (thanks to him)

For the purposes of the site, here and there, I am making directly modifications to LEARN2.

I am worrying about that now, as in the future, there will be upgrades of theme LEARN2 and if I upgrade, that might OVERWRITE the modifications I made.

So the question is:
Is there a way, _like for ANTIMATTER and MYTHEME, to structure that to avoid that kind of problem?

Thank you in advance for considering this ☆

Best regards

11 years ago

*Thank you very much for reply ☆

So, I can find a way to extend learn2 too* (thanks!!!)

not sure I understand (sorry for that) how

Below, I am describing what I understood:

Supposition 1:
I extend learn2 with another mytheme called mytheme2 (that I define in the same relationship as antimatter and mytheme)
but in that case, the second part of answer (just use learn2 rather than antimatter as your parent theme') does not fit...

Supposition 2:
I extend learn2 with mytheme
therfore, in the mytheme.yaml, it becomes something like:

YAML
   theme:
     type: ReadOnlyStream
     prefixes:
       '':
         - user/themes/mytheme
         - user/theme/learn2 (position second, after mytheme) 
         - user/themes/antimatter

but in this position I have elements of both learn2 and antimatter in the same mytheme folder
aren't there confusions between learn2 and antimatter... ?
[ is there a way to structure the subfolder of mytheme between learn2 and antimatter? ]
[ is that it? ]

Supposition 3:
there is another possibility that I have not considered...

[ I can't yet understand the reason for learn2 to be above parent in front of antimatter either ] [ but may be I am totally wrong.. ]

[ I am using themer extension for a page out a many others with antimatter ]
[ in the page header of documentation.fr.md the setting: template: docs to call for learn2 ]

Sorry for not being able to understand at first... suppositions are probably stupids...

Thank you for your understanding and patience with me!

Best regards ♪

11 years ago

antimatter is not in the picture at all, just have learn2 installed and reference learn2.

11 years ago

Can't someone understand the question?

@rhuster
Please forgive me if my exposition is ambiguous.

to make it more clear, here below:

I have a web site with theme antimatter (working great!!).

For some documentation pages among antimatterpages, I am using extension themer of @Sommerregen (works great too!!) in combination with theme learn2.

For those pages only, page.header is set to template: docs and so learn2 theme is called and render them.

That is working great also.

that's where problem is:

In order to get what I want with theme learn2 in those pages, I need to make some modifications of the theme.

I started to make them, then I realised that any upgrade of theme learn2, would overwrite them.

So, the question is:
is there a way to modify theme learn2 (that is not my main theme) to have it modified by inheritance anyway?

with @rhukster's answer I understood that mytheme still apply to learn2: that's a point.

I tried in my answer to @rhukster to ask about possible confusions in folder mytheme between modifications for antimatter and modifications for learn2.

Especially I am afraid that if I put learn2 modifications ALSO in the mytheme folder there might be some confusion between modifications for theme antimatter and theme learn2...
I have not tried anything yet though.

Any recommandations?

Probably I should just put everything together and deal with problems from there...

Thanks in advance for considering my question...

11 years ago

For example, both themes antimatter and learn2 has a base.html.twig.

So putting modifications for both in mytheme might create confusion no? ! ?

11 years ago

You can support multiple levels of theme inheritance, but yes, there is probably going to be some conflicts if they share the same filenames. Considering learn2 and antimatter are so different, I don't advice inheriting from more than one theme.

11 years ago

Thank you for replying to me

Any method to modify learn2as an additionnal theme to antimatter for some pages AND be able to update learn2 later in a clean way?

11 years ago

Really my best advice is to run two sites like we do here with getgrav.org and learn.getgrav.org

Either that or just accept the fact that your not going to be able to have them both inherit. Choose one, and then just use the bits from the other and customize it.

11 years ago

Thanks you very much for your answer: I feel a lot better with being sure that there is no method for such case...

What about revisionning locally the changes made to learn2 from original theme?

Doing so when an upgrade is taking place, I am able to see where changes are and adapt my modifications to new version... much more easily than having just a copy

Learn2 is now pretty achieved, it probably not going to change that much...

Grav is really FANTASTIC !!! ☆

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1351 9 years ago
Archive · by Muut Archive, 9 years ago
2 935 9 years ago
Archive · by Muut Archive, 9 years ago
2 4063 9 years ago
Archive · by Muut Archive, 9 years ago
1 2949 9 years ago
Archive · by Muut Archive, 9 years ago
3 1119 9 years ago