Difference between revisions of "Customization"
From PhotoVoltaic Logger new generation
m (→vzlogger compatible) |
m |
||
Line 11: | Line 11: | ||
** <tt>frontend/View</tt> | ** <tt>frontend/View</tt> | ||
* Found template here: <tt>frontend/View/default.footer.tpl</tt> | * Found template here: <tt>frontend/View/default.footer.tpl</tt> | ||
+ | |||
+ | The <tt>{module}</tt> stands here for the actual [[:Category:Web_frontend|web frontend]] module (can be found in the URL in your browser). | ||
The <tt>custom</tt> sub directories are not delivered with Git repository, you have to create them if required. | The <tt>custom</tt> sub directories are not delivered with Git repository, you have to create them if required. | ||
These directories will be ignored on update, they are excluded via <tt>[https://github.com/K-Ko/PVLng/blob/master/.gitignore .gitignore]</tt> | These directories will be ignored on update, they are excluded via <tt>[https://github.com/K-Ko/PVLng/blob/master/.gitignore .gitignore]</tt> | ||
+ | |||
+ | == HTML hooks == | ||
== Coding == | == Coding == | ||
Line 67: | Line 71: | ||
[[Category:Internals]] | [[Category:Internals]] | ||
+ | [[Category:Example]] |
Revision as of 10:44, 7 April 2014
Templates
The web frontend templates resides at frontend/View
The internal search logic for the to be used template is this (assume this requested template: default.footer.tpl)
- Search these directories
- frontend/View/{module}/custom
- frontend/View/{module}
- frontend/View/custom
- frontend/View
- Found template here: frontend/View/default.footer.tpl
The {module} stands here for the actual web frontend module (can be found in the URL in your browser).
The custom sub directories are not delivered with Git repository, you have to create them if required.
These directories will be ignored on update, they are excluded via .gitignore
HTML hooks
Coding
Prepend/append code
- If an file prepend.php exists, it will be included before any other PHP instructions.
- If an file append.php exists, it will be included after all other PHP instructions.
(This works for the web frontend and for API since r3, see prepend.php.dist and api/r3/prepend.php.dist.
I use this for defining the application name for NewRelic monitoring.
Custom API routes
For API since r3 you can define your own routes in route.custom.php.
The API is based on the Slim framework.
See route.custom.php.dist for reference and refer to the other route definitions in route.*.php for middleware helper functions and help.
vzlogger compatibility
PVLng can direct act as middleware for volkszaehler.org vzlogger.
Original vzlogger request is
POST http://demo.volkszaehler.org/middleware.php/data/550e8400-e29b-11d4-a716-446655441352.json?ts=1284677961150&value=12
as described in vzlogger API reference.
So just change your vzlogger configurations from
... "middleware" : "http://localhost/middleware.php", ...
to
"middleware" : "http://localhost/api/r3",
The coding is prepared in routes.custom.php.dist, copy to routes.custom.php and uncomment the relevant
$api->post( ...
coding.
Please keep in mind,
that there will be by design no security against unwanted postings like PVLng implements with the API key concept!