Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#16 2015-05-19 13:58:19

mrdale
Member
From: Walla Walla
Registered: 2004-11-19
Posts: 2,215
Website

Re: template inheritance

interesting… but I don’t understand how this approach is better than using <txp:output_form form="my_form">Something</txp:output_form> and <txp:yield />.

What am I missing?

Offline

#17 2015-05-19 14:11:42

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

Re: template inheritance

It’s not better or worse. Just different.

Offline

#18 2015-05-19 14:12:40

sacripant
Plugin Author
From: Rhône — France
Registered: 2008-06-01
Posts: 479
Website

Re: template inheritance

For me, template by inheritance system is very interesting to gather all the components and contents of a context in the same code page and this independently of the layout structure.

For exemple, if for a author context you want :

  • a specific page title
  • add a specific CSS
  • add a specific content
  • add a specific JS

you can gathering all in one code page and injecting in different blocks :

<txp:rvm_block name="head-title">
   your specifique page title
</txp:rvm_block>

<txp:rvm_block name="additionnal-css">
   <link src="your additionnal-css">
</txp:rvm_block>

<txp:rvm_block name="main">
   you main content for author page
</txp:rvm_block>

<txp:rvm_block name="additional-js">
   <script src="your-additionnal-js" />
</txp:rvm_block>

Last edited by sacripant (2015-05-19 14:21:51)

Offline

#19 2015-05-19 15:24:36

etc
Developer
Registered: 2010-11-11
Posts: 5,675
Website GitHub

Re: template inheritance

I guess, things are getting interesting with parent/child attributes (provided I understand how they work). This seems not straightforward (for me) with output_form/yield/variable:

<txp:rvm_inherit page="base">
  ...
  <txp:rvm_block name="head-title">
    <txp:rvm_block name="head-title" parent="1" /> - <txp:title />
  </txp:rvm_block>
  ...
</txp:rvm_inherit>

with “base” page

<html>
  <head>
    some code
    <title>
    <txp:rvm_block name="head-title">
      <txp:site_name />
    </txp:rvm_block>
    </title>
     some code   
  </head>
  ...
</html>

It’s not a wow example, but I like “structural” tags. Ruud, why wouldn’t you post the code for testing?

Offline

#20 2015-05-19 17:15:50

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

Re: template inheritance

  <txp:rvm_block name="head-title">
    <txp:rvm_block name="head-title" parent="1" /> - <txp:title />
  </txp:rvm_block>

Can be written as:

  <txp:rvm_block name="head-title">
    <txp:rvm_block parent="1" /> - <txp:title />
  </txp:rvm_block>

It would be trivial to create an extra tag that allows you to do this, but I’m not sure if that is needed:

  <txp:rvm_block name="head-title">
    <txp:rvm_parent /> - <txp:title />
  </txp:rvm_block>

I’ll write up some documentation and then upload the plugin code.

Offline

#21 2015-05-19 18:03:27

etc
Developer
Registered: 2010-11-11
Posts: 5,675
Website GitHub

Re: template inheritance

ruud wrote #290930:

It would be trivial to create an extra tag that allows you to do this, but I’m not sure if that is needed: <txp:rvm_parent />

I would prefer <txp:rvm_block parent="2" /> for grandpa, etc, if it makes sense.

Offline

#22 2015-05-19 19:29:52

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

Re: template inheritance

etc wrote #290931:

I would prefer <txp:rvm_block parent="2" /> for grandpa, etc, if it makes sense.

That was already possible in the plugin, even if I didn’t mention it. :)

Offline

#23 2015-05-19 19:42:12

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

Re: template inheritance

Okay, plugin is uploaded and support topic opened here

Offline

Board footer

Powered by FluxBB