Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
aks_var : Easy variables and calculations
aks_var – Easy variables and calculations
Version 0.3a download link / homepage
Summary
aks_var operate with Txp variables and Custom Fields.
Last edited by makss (2016-01-16 18:11:15)
aks_cron : Cron inside Textpattern | aks_article : extended article_custom tag
aks_cache : cache for TxP | aks_dragdrop : Drag&Drop categories (article, link, image, file)
Offline
Re: aks_var : Easy variables and calculations
aks_var v 0.2 released
Changelog
- add preg_replace
- add read apache, PHP, TxP variables
- allow include txp tags:
<txp:aks_var value="<txp:title />" /> or <txp:aks_var><txp:title /></txp:aks_var>
Last edited by makss (2009-04-20 20:55:46)
aks_cron : Cron inside Textpattern | aks_article : extended article_custom tag
aks_cache : cache for TxP | aks_dragdrop : Drag&Drop categories (article, link, image, file)
Offline
Re: aks_var : Easy variables and calculations
Looks like a helpful plug in, but Im not sure how to use it?
I have tried a few examples. the thing I am trying to do is add ALL custom field values together.
So, I have a custom field labled ‘Area’ and in this box the user enters the area of land that has been covered. (eg 1 = 1 acre)
What I want to do is add all the ‘Area’ custom fields together so as you image it outputs the total area!?
I’m not sure how to do this – I assume that is what this plug in can do?
Thanks
Oli
Offline
Re: aks_var : Easy variables and calculations
I’m getting an error and the result is not getting calculated… Any Ideas? r3105
Here’s my call
<txp:aks_evar customfield="price" substr="1" calc="*12" />
And here’s the errors
Parse error: syntax error, unexpected T_LNUMBER, expecting T_VARIABLE or '$' in /users/home/mrdale/domains/tld.com/web/public/textpattern/lib/txplib_misc.php(573) : eval()'d code(35) : eval()'d code on line 1
Offline
Re: aks_var : Easy variables and calculations
mrdale, thanks for report. Please upgrade plugin.
aks_var Version 0.2.1
- Change operate order. Was: calc,substr,regexp. Now: substr,regexp,calc.
Last edited by makss (2016-01-16 18:12:00)
aks_cron : Cron inside Textpattern | aks_article : extended article_custom tag
aks_cache : cache for TxP | aks_dragdrop : Drag&Drop categories (article, link, image, file)
Offline
Re: aks_var : Easy variables and calculations
oliverker wrote:
I have tried a few examples. the thing I am trying to do is add ALL custom field values together.
So, I have a custom field labled ‘Area’ and in this box the user enters the area of land that has been covered. (eg 1 = 1 acre)
What I want to do is add all the ‘Area’ custom fields together so as you image it outputs the total area!?
I’m not sure how to do this – I assume that is what this plug in can do?
I did not understand the question. My English is poor. :(
Do you have a lot of custom fields in a single article, and you want to display in total?
e.g. field1+field2+field3+…
aks_cron : Cron inside Textpattern | aks_article : extended article_custom tag
aks_cache : cache for TxP | aks_dragdrop : Drag&Drop categories (article, link, image, file)
Offline
Re: aks_var : Easy variables and calculations
almost, i want to a sum
article1 field1+article2 field1+article3 field1 …
= total
makss wrote:
Do you have a lot of custom fields in a single article, and you want to display in total?
e.g. field1+field2+field3+…
Offline
Re: aks_var : Easy variables and calculations
Works, great… very useful
Offline
Re: aks_var : Easy variables and calculations
oliverker, please upgrade plugin.
aks_var Version 0.2.2
- Support TxP tags in calc attribute
.
oliverker wrote:
almost, i want to a sum
article1 field1+article2 field1+article3 field1 … = total
1. Create new form t1:
<txp:if_custom_field name="field1"> <txp:aks_var name="total" calc="+<txp:aks_evar customfield='field1' />" /> </txp:if_custom_field>
2. Place this code to article:
<txp:aks_var name="total" value="0" /> - init total value <txp:article_custom form="t1" section="area" /> <txp:aks_evar name="total" /> - display value
Do you have a lot of custom fields in a single article, and you want to display in total?
e.g. field1+field2+field3+…
Calculate field1+field2 in one article:
==<txp:aks_evar calc="+0"><txp:aks_evar customfield="field1" />+<txp:aks_evar customfield="field2" /></txp:aks_evar>==
Last edited by makss (2016-01-16 18:12:34)
aks_cron : Cron inside Textpattern | aks_article : extended article_custom tag
aks_cache : cache for TxP | aks_dragdrop : Drag&Drop categories (article, link, image, file)
Offline
Re: aks_var : Easy variables and calculations
Useful plugin…
Feature Idea> An attribute to set the number of decimal points ouput?
Offline
Re: aks_var : Easy variables and calculations
mrdale wrote:
Feature Idea> An attribute to set the number of decimal points ouput?
Apply :)
aks_var Version 0.2.2a
- Added attribute round
Example:
<txp:aks_evar name="total" value="100.12345" calc="*2" round="2" />
Output: 200,25
Last edited by makss (2016-01-16 18:13:12)
aks_cron : Cron inside Textpattern | aks_article : extended article_custom tag
aks_cache : cache for TxP | aks_dragdrop : Drag&Drop categories (article, link, image, file)
Offline
Re: aks_var : Easy variables and calculations
So almost there… Thanks
I need it to do 0 decimal points as well (eg. 20.3689 becomes 20).
Offline