Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
rvm_inherit 0.3
rvm_inherit 0.3
This plugin makes it possible to use template inheritance and should work in TXP 4.5.7 and above.
Report problems or ask questions about this version of the plugin here in this topic please, but please read the plugin help before asking!
Offline
Re: rvm_inherit 0.3
Nice one! Had no much time to test it, but:
- Help needs some brush up:
<txp:rvm_inherit />
… should contain only<txp:rvm_block>
,<txp:rvm_child>
and/or<txp:rvm_parent>
tags is in contradiction with
<txp:rvm_inherit page="default">
<txp:rvm_block name="header">
this is some header content
</txp:rvm_block>
this is the body content.
</txp:rvm_inherit>
- unclosed
<txp:rvm_block>
in “Getting started” example (body?) - I would parse the
default
page if neitherpage
norform
are set - this results in an infinite loop:
<txp:rvm_block name="header">
this is some header content
<txp:rvm_block name="header" />
</txp:rvm_block>
Offline
Re: rvm_inherit 0.3
Thanks. Those should all be fixed in version 0.2.
Offline
Re: rvm_inherit 0.3
Haven’t tested it yet, but nice one, ruud. Thanks!
You may recall that we talked about this in the past .
Offline
Re: rvm_inherit 0.3
It remains to replace file
with page
in <txp:rvm_inherit file="default">
(“Nesting blocks” section), though v.0.2 works as is :) I’m sure it can change the way we work with conditional tags, and improve the code readability.
Offline
Re: rvm_inherit 0.3
Thanks again for reading it so thorougly. Fixed in version 0.3
Offline
Re: rvm_inherit 0.3
Any chance your plugins will be put onto GitHub at some point, Ruud?
Offline
Re: rvm_inherit 0.3
Perhaps. I don’t really see any advantages in using Github for relatively small projects such as my plugins. Chances my website going offline are smaller than such a central code repository shutting down (like Google Code).
Offline
#9 2015-05-21 14:38:38
- candyman
- Member
- From: Italy
- Registered: 2006-08-08
- Posts: 684
Re: rvm_inherit 0.3
Can you post an example of a standard TXP layout side by side to the new inherited one?
Just to understand how does it work.
The benefits should be a better readibility or also a faster theme develpoment?
Offline
Re: rvm_inherit 0.3
A standard TXP layout would probably have a lot more <txp:if_section>
tags than one that uses an inherited template. How it works is documented in the plugin help. You’ll have to decide for yourself if using inherited templates is more in line with how you prefer to work, because this is just another way of doing things.
Offline
Re: rvm_inherit 0.3
candyman wrote #290972:
The benefits should be a better readibility or also a faster theme develpoment?
Haven’t tested the plugin yet, but template inheritance (as in Django’s templates or PHP Twig templates) usually helps in both areas: better readability (as you cut down on the amount of line of codes) and faster theme development (as, again you cut down on amount of LoC).
For example, with template inheritance, you usually avoid doing “includes” over and over again in all your templates. You define those common stuff (ie. includes) on a base template, and then, your other templates inherit from it. Also, on the base template, you define blocks that you can then “populate” or “override” on templates inheriting from it.
Last edited by maniqui (2015-05-21 18:50:26)
Offline
#12 2015-05-22 07:19:27
- candyman
- Member
- From: Italy
- Registered: 2006-08-08
- Posts: 684
Re: rvm_inherit 0.3
Looked at the docs (I haven’t txp 4.5.7 installed yet), I think it could be useful to me.
My template has default header and footer and central contents and sidebar depending on the section.
The only weak point (as all design not-core functions) is that all will depend on your plugin and its upgrades for the future (I’m thinkin’ about the next 4.6 release). If someone can avoid to use an extra function provided by a plugin, using rvm_inherit he has to hope that it will be always updated to get his site working.
I’m guessing if it will have a chance to become part of the core.
Offline