Basic Functions
Useful functions to make your website more dynamic.
Wapka Dashboard: https://web.wapka.org/panel/[SITEID]/[PAGEID]/new/basic
Math function usage — To calculate data you can use math function. Example usage: {{GET(id)@PLUS(100)}}, {{VALUE(100)@PLUS(100)@DIVIDE(2)}}, {{VAR(number)@PLUS@GET(number)}}.
- {{MULTIPLY(numeric value)}} — Math function.
- {{DIVIDE(numeric value)}} — Math function.
- {{MINUS(numeric value)}} — Math function.
- {{PLUS(numeric value)}} — Math function.
- {{RANDOM(["one", "two", "three", "More")}} — Get random value form JSON array or string. To generate random number use like #%RANDOM("123456790")%#.
- {{REPLACE(["search", "replace"])}} — This function is used to search and replace you can pass json array or string as parameter. Usage #%VALUE(test_data)@REPLACE("_data")%#.
- {{NULL(nothing)}} — If you want to call a function and hide result use this at the end. #%GET(data)@SET(var)@NULL; set variable and display nothing.
- {{INT(1234abcd)}} — To make sure data is numeric.
- {{LENGTH(data)}} — To get data length.
- {{CUT(["start", "end"])}} — Get part of string from start to end you can also set starting and ending position like #%VALUE(this is test)@CUT([0, 10])%# to get first 10 character.
- {{CHOP(space )}} — Same as TRIM but remove from at the end of string.
- {{TRIM( space )}} — Remove whitespace from data. You can also remove other character like #%VALUE(-----test--------)@TRIM(-)%# this will remove all -.
- {{UPPER(lower to upper)}} — Convert all character to upper case.
- {{LOWER(MAKE IT LOWER)}} — Convert all character to lower case.
- {{REMOVE_TAG(html)}} — To remove HTML tags from input. Usage:
{{REMOVE_TAG(<tag>this is tag</tag>)}}. To allow tag use like:{{VALUE(<b>this is bold</b><i>this is italic</i>)@REMOVE_TAG(<i>)}}. - {{BASE64_DECODE(data)}} — Decode data from the Base64 format.
- {{HTML_DECODE(html)}} — To decode HTML data.
- {{URL_DECODE(url)}} — To decode URL data.
- {{BASE64_ENCODE(data)}} — To encode data to Base64 format.
- {{HTML_ENCODE(html)}} — To encode HTML data.
- {{URL_ENCODE(url)}} — To encode URL data.
- {{SLUG(make url)}} — Make SEO frendly url from any text. You can use with other function/tag like #%SLUG(%title%)%#.
- {{DATE()}} — This function is for date and time. To format current date Use #%DATE(formater)%# You can format any date from other function and also time ago like #%VALUE(Dec 2020)@DATE(AGO)%# to use with other function use #%VALUE(%date%)@DATE(Formater or AGO)%#.
- {{VAR(name)}} — To get data from variable use this function.
- {{SAVE(name)}} — This is similar as SET but this will save data in server (session) and you can use this data later on any page.
- {{SET(name)}} — You can use this function to define variable. #%VALUE(test data)@SET(new_var)%# You can also call multiply function and make chain - #%GET(id)@INT.SET(ID)%# here we get data from url then make sure it number then set variable.
- {{DATA(Function or tag or data)}} — You can get data from many function like #%DATA(Name: #GET(name)# ID: #VAR(USER_ID)#)%#.
- {{VALUE(data)}} — This function is used to set function parameter.
- {{REQUEST(name)}} — Get combined data from get, post & cookie.
- {{COOKIE(name)}} — To get http cookie.
- {{POST(name)}} — To get http post data.
- {{GET(name)}} — To get data from url.