Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2015-05-19 19:36:36

ruud
Developer emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

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.

Download

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

#2 2015-05-20 08:25:51

etc
Developer
Registered: 2010-11-11
Posts: 4,529
Website GitHub

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 neither page nor form 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

#3 2015-05-20 11:33:37

ruud
Developer emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: rvm_inherit 0.3

Thanks. Those should all be fixed in version 0.2.

Offline

#4 2015-05-20 13:01:57

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

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 .


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#5 2015-05-21 09:32:28

etc
Developer
Registered: 2010-11-11
Posts: 4,529
Website GitHub

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

#6 2015-05-21 13:32:18

ruud
Developer emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: rvm_inherit 0.3

Thanks again for reading it so thorougly. Fixed in version 0.3

Offline

#7 2015-05-21 13:33:41

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,541
Website GitHub Twitter

Re: rvm_inherit 0.3

Any chance your plugins will be put onto GitHub at some point, Ruud?

Offline

#8 2015-05-21 13:56:06

ruud
Developer emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

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

#10 2015-05-21 14:50:07

ruud
Developer emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

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

#11 2015-05-21 18:50:14

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

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)


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

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

Board footer

Powered by FluxBB