Funcdown Manual
Installation
- Requirements
-
Other than PHP it self, funcdown has no special requirements nor installation. The only strong fact is that standard, good HTML and PHP knowledge is required in order for one to operate with funcdown properly. Speaking of PHP Version, >=8.2 is required where one also need to make sure that the following three PHP extensions are enabled: xml, ctype and mbstring.
When and if those conditions are met, assuming that You have obtained funcdown code, and did according to the instructions there, You may throw an look at Basic Usage and start goofing with funcdown.
- Configuration
-
Just like PHP it self, funcdown is using it's own
.ini
file, with it's default Runtime options, with few differences. It is masked as PHP (eg:.funcdown.conf.ini.php
) and has a DOT as prefix for the filename and sits within PHP block comment. This is because it indicates that it is system (hidden) file on unix-alike production `boxes` (in 99.99% cases).On well configured server, everything within a file that has .php extension, wrapped with php tags is invisible to `bystander/visitor` of any kind... and PHP simply doesn't give a dime about extension when it comes to parsing various x-text formats. All it takes is properly formatted content within. Valid syntax in other words. One plus for a bit of additional security, nothing else.
Basic Usage
Somewhere in Your script, prefferably at the top of it ..
.. and thеn Funcdown::parse() funcdown source by using any of given INPUT methodology.
- INPUT/OUTPUT
-
Funcdown code or input value for
Funcdown::parse()
method, can come in a form of value of PHP$variable
(meaning directly asstring
as well), as validfilepath
or as compliantarray
. Here are pseudo examples for three possible funcdown input types, how to parse/transform funcdown syntax to html markup.- INPUT
-
- STRING
-
You write this ...
<?php $funcdown-> parse ('!{Comment text} D [p {This is my paragraph text}]', false); echo $funcdown-> release(); - ARRAY
-
You write it like this ...
<?php $funcdown-> parse ([ '!' => 'Comment text', // ! = <!-- ... --> 'D' => [ // Capital D = div 'p' => 'This is my paragraph text' ] ], false); echo $funcdown-> release();Learn the Hashmap Syntax
- FILEPATH
-
While
your_funcdown_file.fncd
oryour_funcdown_file.fncd.phtml
, looks something like this ..!{Comment text} D [ p {This is my paragraph text} ].. you call it like this ..
<?php echo $funcdown-> parse ('/path/to/my_funcdown_file.fncd')-> release();
- OUTPUT
-
Once when
Funcdown::release()
method has been called, be it string, array or external file, You will get the sample below.<!-- Comment text --> <div> <p>This is my paragraph text</p> </div>It simply doesn't matter whether funcdown is written as single liner or with a lots of space style, generated markup will be formatted in the same way, unless runtime option is modified.
- EXAMPLES
-
You type .. .. browser gets *{5}
<!DOCTYPE html>
*{X}
<?xml version="1.0" encoding="UTF-8"?>
!{HTML comment}
<!-- HTML comment -->
R[]
<html> </html>
H[]
<head> </head>
B[]
<body> </body>
M(charset utf-8)|
<meta charset="utf-8">
hr| br|
<hr> <br>
~{ This is not a love song! }
This is not a love song!
p { This is not a love song! }
<p> This is not a love song! </p>
p [ ~{This is not a love song!} ]
<p> This is not a love song! </p>
ul (# mySpecialList) [ li (. myClassOne) [ p { Attributes are wrapped within b//() ^+ braces or `parenthesis`. } ] li (! Title on Hover) [ p {:>>> HTML Text is wrapped within b//{} ^+ braces or `curlies`. By placing :>>> right after the beginning of { and inverse <<<: right before the closing }, You get the super string so that You don't need to escape closing curly brace. Just like in this example. <<<:} ] li (C font-size: smaller) [ p { HTML Text must follow preceeding word *(tag) or C//~+ character. } ] ]
<ul id="mySpecialList"> <li class="myClassOne"> <p> Attributes are wrapped within <b>()</b> braces or `parenthesis`. </p> </li> <li title="Title on Hover"> <p> HTML Text is wrapped within <b>{}</b> braces or `curlies`. By placing :>>> right after the beginning of { and inverse <<<: right before the closing }, You get the super string so that You don't need to escape closing curly brace. Just like in this example. </p> </li> <li style="font-size: smaller"> <p> HTML Text must follow preceeding word *(tag) or <code>~</code> character. </p> </li> </ul>