Working outside of the Midgard Parser
The major difference you face when developing with FS-MidCOM is the fact, that everything included by require() or include() is not passed through the Midgard Preparser. This has several implications, that are quite important.
Why are you dropping out of the parser anyway?
Midgard parses everything before it is actually passed to PHP, so when PHP finally starts, Midgard has already finished its magic. Essentially, when you start including stuff with require() or include(), they therefore do not run through the Midgard Parser explicitly, you have to do this by yourself. This does also include everything that is done from the code you are loading.
What does not work?
- &(variable:formatter);
- <(style element)>, <[style element]>
- mgd_include_snippet()
How to circumvent this
Unfortunalety, there is no golden solution around the missing parser. While you are in code executed through any require or include statement, you won't have the luxury of regular Midgard parsing.
Component Code (not including the default styles)
For a start &(); and <()> cannot be made easily available in stuff that is required or included. Period. If you use it in your component code, you have to replace it with corresponding PHP echo directives. The regular expression &\(([^:)]*)[^)]*\); matches all statements (without distinguishing between the different formatters), which makes bulk updates less tedious, for example in almost all cases you can replace it by using <?php echo htmlspecialchars(\$\1);?>.
A possibly bigger problem is the fact, that mgd_include_snippet too is a compiler directive. To still have it available in FS-MidCOM, a workaround function called mgd_include_snippet_php($path) has been defined in MidCOM, which has the same semantics as mgd_include_snippet, but is most probably a bit slower.
Style Code
Almost any style code should be evaluated correctly by the MidCOM Style Engine, which passes the included Style Elements through the Midgard Parser before evaluating it. So it should be safe for now to use regular Midgard proecessing directives in there.
How does it work internally?
Well, two places have been adapted there.
First, the MidCOM Style Engine explicitly uses mgd_preparse before evaluating the style's content. This will yield the same behavoir, then the one you are used to.
The same schema is in use for the mgd_include_snippet replacement mentioned above. It will load, preparse and eval the snippet's code using PHP code, again yielding the same functionality.