Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2018-11-17 07:40:51

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 6,916
Website

the beauty of override forms

My recent adventures to merge two databases into one, reminded me of the beauty and simplicity of the override forms.

Consider a case like this:

<txp:article form="">
<article>
<h1><txp:title /></h1>
<txp:body />
</article>
<txp:if_custom_field name="type" value="call">
<h3>Deadline</h3>
<txp:custom_field name="Dates" />
</txp:if_custom_field>
<txp:if_custom_field name="type" value="info">
<h3>Date(s)</h3><txp:custom_field name="Dates" /></txp:if_custom_field>
<h5>Posted</h5>
<txp:posted />
</txp:article>

There seems to be a lot of evaluation processes happening there as well as a waste of a custom_field.

With override forms

We could have a form named deadlines:

<article>
<h1><txp:title /></h1>
<txp:body />
</article>
<txp:if_custom_field name="Dates">
<h3>Deadline</h3>
<txp:custom_field name="Dates" />
</txp:if_custom_field>
<h5>Posted</h5>
<txp:posted />

and another one named info:

<article>
<h1><txp:title /></h1>
<txp:body />
</article>
<txp:if_custom_field name="Dates">
<h3>Dates</h3>
<txp:custom_field name="Dates" />
</txp:if_custom_field>
<h5>Posted</h5>
<txp:posted />

and we can continue building different forms as our needs change or expand, without worrying of typos in the custom field value.


Yiannis
——————————
neme.org | hblack.net | LABS | State Machines | NeMe @ github

Offline

Board footer

Powered by FluxBB