- $tag = is the tag of the custom bb code? ... So i can define a generic "handler" class, and function where i use if..else if like: ... if($tag == "myPhoto"){//php code}... else if($tag == "myTable"){//php code}) ?

I must echo the $result, or just use return $result from function?

- what is $redererStates and $formatter?

- how to pass parameters? As json?
- can i define as many params as i need?

I don't know the 'events' order when xenforo (or zend framework itself) is rendering the page. This bb codes are parsed when the thread body is rendered, for each thread post. The time this 'hook' is 'firing', the header template was loaded, variable replaced and i don't see how i can insert CSS in header, unless i 'hook' to header render 'event'.
Sorry for this 'forced' comparison. I did some prestashop modules, and using phpBB... Before rewriting code i used in phpBB i switch to xenforo... and will with other forum i have...

If you can explain or give link to existent thread, your help will be much appreciated

LE: Unles the whole page is rendered only at the end of all templates parse.
For template parsing i used phpBB model and smarty in prestashop.
I guess xenforo has it's on sintax as i saw in files.

Where is the template files in folders? I found them in admin interface but a quick search in folder doesn't revelead any htmls... Are stored in DB?

In this example you would create a template in the Admin CP named whatever_template_name, and the array is an array of variables you want to be available to use in the template.

The template is able to specify the location of any CSS that should be included, and it is automatically included in the header on page load (it's also smart enough to only include the CSS once even if you call it 20 times).

CSS is also part of the template system (CSS templates are suffixed with .css).

You would create a CSS template (in the same way as the whatever_template_name template was created) and add all your CSS in there.

In this example, ["children"] is a "child" as array, and indeed i get "param1,param2" as a string for first element of ["children"], more precisely the string beween tags.
I don't use option like [tag=OPTION][/tag]....

I use in this form: [tag]param1,param2[/tag], and i thought that i can directly separate params, as the "child" is an array... array in array. And maybe i can use directly ["children"][0], ["children"][1]

I see now that these custom bb codes does not appear in reply editor. First, i thought "how can i hide special bbcodes" even from registered users. I want some custom bb codes to be available only for administrators / moderators... Is there a dropdown combo with these? I can't find any option in basic or advanced options for a bb code that says "show this in editor"...

My custom bb code with php callback works perfectly (including parameters). The returned HTML is just as i want... Now, for a quick test, can i edit the header template (overall) to check if the inclusion of CSS and JS library will make my photo gallery works as expected?

Questions about all this "task"....
- It is possible to encapsulate all changes i made into an addon? The only problem i see... is that maybe i can't programmatically add the new bb code and set class and function. The way bb codes with callback function work in xenforo eliminated my own post parsing function...
- PAGE_CONTAINER is marked with red color. There is a very usefull button "Revert template", but my question is about updateing xenforo core files, on a new version. Will my changes be overwritten?

Be careful if you enable debug mode. It will enable access to the master style and language. Changes to the master style and language cannot easily be reversed and those changes will be overwritten during upgrade.

However, as long as you only edit the "Default Style" (or another child of the Master Style) as you have seen, those changes can be reverted, but also those changes will not be affected by upgrades. If there is a conflict between a template we've changed during an upgrade and a template you have changed, then the template is marked as "Outdated". When this happens, you can use the comparison and merge tool to merge your changes back into the updated template.

In terms of making template changes, it's best to use the Template Modifications system to do this. This is effectively a find and replace style system for template changes that can be assigned to add-ons.