Textpattern Forum

You are not logged in. Register | Login | Help

#1 2009-03-28 16:21:35

makss
Plugin Author
From: Ukraine
Registered: 2008-10-21
Posts: 249
Website

aks_var : Easy variables and calculations

aks_var – Easy variables and calculations

Version 0.3 download link / homepage

Summary

aks_var operate with Txp variables and Custom Fields.

Last edited by makss (2012-02-14 06:57:25)


aks_cron : Cron inside Textpattern | aks_article : extended article_custom tag
aks_cache : cache for TxP | aks_meta | aks_header : Compress your pages on the fly

Offline

#2 2009-04-08 00:25:59

makss
Plugin Author
From: Ukraine
Registered: 2008-10-21
Posts: 249
Website

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_meta | aks_header : Compress your pages on the fly

Offline

#3 2009-04-24 10:59:47

oliverker
Plugin Author
From: Huddersfield
Registered: 2008-07-14
Posts: 90
Website

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

#4 2009-04-25 01:12:42

mrdale
Moderator
From: Walla Walla
Registered: 2004-11-19
Posts: 2,058
Website

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

#5 2009-04-25 07:36:24

makss
Plugin Author
From: Ukraine
Registered: 2008-10-21
Posts: 249
Website

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 (2009-04-25 15:45:33)


aks_cron : Cron inside Textpattern | aks_article : extended article_custom tag
aks_cache : cache for TxP | aks_meta | aks_header : Compress your pages on the fly

Offline

#6 2009-04-25 15:35:51

makss
Plugin Author
From: Ukraine
Registered: 2008-10-21
Posts: 249
Website

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_meta | aks_header : Compress your pages on the fly

Offline

#7 2009-04-25 15:45:21

oliverker
Plugin Author
From: Huddersfield
Registered: 2008-07-14
Posts: 90
Website

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

#8 2009-04-25 16:02:00

mrdale
Moderator
From: Walla Walla
Registered: 2004-11-19
Posts: 2,058
Website

Re: aks_var : Easy variables and calculations

Works, great… very useful

Offline

#9 2009-04-25 17:57:32

makss
Plugin Author
From: Ukraine
Registered: 2008-10-21
Posts: 249
Website

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 (2009-04-27 07:31:07)


aks_cron : Cron inside Textpattern | aks_article : extended article_custom tag
aks_cache : cache for TxP | aks_meta | aks_header : Compress your pages on the fly

Offline

#10 2009-04-26 22:46:13

mrdale
Moderator
From: Walla Walla
Registered: 2004-11-19
Posts: 2,058
Website

Re: aks_var : Easy variables and calculations

Useful plugin…

Feature Idea> An attribute to set the number of decimal points ouput?

Offline

Board footer

Powered by FluxBB