Tags
Tag code is useful for dynamic website. You can use this tag in any Wapka function.
:VAR(SITE_NAME); - To get your website name.
:VAR(PAGE_NAME); - To get page name.
:VAR(PAGE_ID); - To get page id.
:VAR(PAGE_TYPE); - To get page content type (default = text/html).
:VAR(USER_NAME); - To get user name.
:VAR(USER_ROLE); - To get user role.
:VAR(USER_ID); - To get logged user id.
:VAR(USER_EMAIL); - To get logged user email.
:VAR(USER_TYPE); - To get user account type.
:VAR(IP); - To get IP address.
:VAR(USER_AGENT); - To get http user agent string.
:VAR(DEVICE); - To get device type (Desktop or Mobile).
:VAR(BROWSER); - To get browser name.
:VAR(OS); - To get user operating system name.
:VAR(PROTOCOL); - To get url protocol e.g. http.
:VAR(HOST); - To get http host.
:VAR(URL); - To get full url or Uniform Resource Locator.
:VAR(URI); - To get Uniform Resource Identifier.
:VAR(URL_PATH); - To get path.
:VAR(URL_QUERY); - To get query string.
:VAR(HTTP_METHOD); - HTTP request method.
:VAR(HTTP_REFERER); - To get http referer.
Helper functions
You can use helper function with tag codes. Helper function is very useful for data processing. WAPKA function name is case sensitive. To make function chain use (.) dot
:GET(name); - To get data from url
:POST(name); - To get http post data
:COOKIE(name); - To get http cookie
:REQUEST(name); - Get combined data from get, post & cookie
:VALUE(data); - This function is used to set function parameter.
:DATA(Function or tag or data); - You can get data from many function like :DATA(Name: #GET(name)# ID: #VAR(USER_ID)#);
: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.
: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
:VAR(name); - To get data from variable use this function
: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);
:SLUG(make url); - Make SEO frendly url from any text. You can use with other function/tag like :SLUG(%title%);
:URL_ENCODE(url); , :HTML_ENCODE(html);, :BASE64_ENCODE(data);) - To encode data
:URL_DECODE(url); , :HTML_DECODE(html);, :BASE64_DECODE(data);) - decode encoded data
:REMOVE_TAG; - to remove html tag 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>);
:LOWER(MAKE IT LOWER); - convert all character to lower case.
:UPPER(lower to upper) - convert all character to upper case
:TRIM( space ); - Remove whitespace from data. You can also remove other character like :VALUE(-----test--------).TRIM(-); this will remove all -
:CHOP(space ); - Same as TRIM but remove from at the end of string
: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
:LENGTH(data); - length
:INT(1234abcd); - To make sure data is numeric
: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
: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");
:RANDOM(["one", "two", "three", "More"); - Get random value form JSON array or string. To generate random number use like :RANDOM("123456790");
:PLUS(numeric value); - Math function.
:MINUS(numeric value); - Math function.
:DIVIDE(numeric value); - Math function.
:MULTIPLY(numeric value); - Math function.
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);
Advanced functions
IFSET - Check if data not empty.
IFNOT - Check if data empty.
IFEQ - If equal.
IFNE - If not equal
IFGE - If getter then or equal to
IFLE - If less then or equal.
IFIN - Chech if data data exist. Usage: :VALUE(one, two, three).IFIN("two").THEN(2 found);
Or value exist :VALUE(one).IFIN(["one", "two", "three"]).THEN(Ok);
Or value exist :VALUE(one).IFIN(["one", "two", "three"]).THEN(Ok);
IFMATCH - If PCRE regex pattern matched.
IFLIKE - check if two value similar. :VALUE(TeSt).IFLIKE(test).THEN(Same data);
THEN - If condition is true then show this
OR - Optional condition check
ELSE - If condition is false then show this
Usage: -
:VAR(name).OR(variable not set);
:IFSET(%name%).THEN(Name - %name%).ELSE(empty);
:VALUE(12345).IFEQ(12345).THEN(both equal).ELSE(error);
:IFNOT(%id%).OR.IFNOT.VAR(test).OR.IFNOT(%var%).THEN(one or more error).ELSE(ok);
:POST(pin).IFNE(12345).VALUE(data not match).SET(error).ELSE.VALUE(success);
You can make more complex condition.
:VAR(name).OR(variable not set);
:IFSET(%name%).THEN(Name - %name%).ELSE(empty);
:VALUE(12345).IFEQ(12345).THEN(both equal).ELSE(error);
:IFNOT(%id%).OR.IFNOT.VAR(test).OR.IFNOT(%var%).THEN(one or more error).ELSE(ok);
:POST(pin).IFNE(12345).VALUE(data not match).SET(error).ELSE.VALUE(success);
You can make more complex condition.
ADD - to concate two value. :VALUE(one).ADD(two); => one two
APPEND - add value at the start of other value.:VALUE(one).APPEND(two ); => two one
DATA - get data from other function. Usage - :DATA(#VAR(test)# #GET(it)# #POST(data)#);
GOTO - To redirect user from one page to another use this function. Example - :GOTO(/index.php); redirect to home page
BB codes
You can use bbcode to write forum/blog post
[br], [hr] - to make line break and line
[b]This is bold text[/b]
[i]This is italic text[/i]
[code]This is pre-formatted text[/code]
[quote]This is a quote[/quote]
[quote=Obama]This is a quote by a specific person[/quote]
[size=30]This text's size is set at 30%[/size]
[s]This text has a strikethrough[/s]
[u]This text is underlined.[/u]
[center]This text is centered[/center]
[color=red]This is red text[/color]
[email]someone@somewhere.com[/email]
[someone@somewhere.com]An e-mail link[/email]
[url]http://www.google.com/[/url]
[url=http://www.google.com/]Visite Google.com![/url]
[img]https://img.wapka.io/000a2y.png[/img]
[url=https://wapka.org][img]https://img.wapka.io/000a2y.png[/img][/url] - Image with link
Youtube video
[youtube]http://youtu.be/DabwEqsWWiA[/youtube]
[youtube]http://www.youtube.com/watch?v=DabwEqsWWiA[/youtube]
[youtube]http://youtu.be/DabwEqsWWiA[/youtube]
[youtube]http://www.youtube.com/watch?v=DabwEqsWWiA[/youtube]