AngularJS based theme
I'm creating a new theme where many parts contain/are managed by AngularJS.
Angular works fine. My problem is that in the partials (that are loaded by Angular) I cannot use the Concrete5 classes and context.
In practice, I have a default.php page template which contains an HTML page that imports (among other libs) angular and a JS script file where the angular app is created.
The angular code loads a partial.php, which contains some additional HTML. In this HTML code I would like to use the Concrete5 classes (e.g., the Area class) and to access the Concrete5 context (e.g., the $c variable representing the current page), e.g.:
[HTML] <?php $a = new Area('Payments'); $a->display($c); ?> [HTML]
When I run the code I gent an errore saying:
"PHP Fatal error: Uncaught Error: Class 'Concrete\Core\Area\Area' not found in /[...]/agreement.php".
Question: is it possible to load external PHP files (through angular) and have Concrete5 classes and context available in this files?
Any help or link in this sense would be really appreciated.
1) Where can I find info about this global variables? Is it in the docs? Do you have a link by any chance?
2) What about including a new c5 Area in my partial.php? Is this possible? How to make c5 classes available in the partial.php?
Have a look at the header output on a page in Elemental theme. If your theme doesn't output similar, then you have missed something.
I don't know about (2). You could investigate creating a psuedo page to render where you pass the cID and area name into it. Stacks do something like that, so look at the code for the stack block (its a hidden block that is used to display a stack).