cakephp - How to load a xml file in plugins webroot -


i using cakephp-3.0

in component of plugin, want load xml file in plugins webroot.

simplexml_load_file('rangemessage.xml') 

the file can't found. debugging path

debug(realpath('')); 

says, actual directory /path/to/app/webroot. xml-file in /path/to/app/plugins/myplugin/webroot how can find file without using absolute path?

you can use plugin::path() retrieve absolute path plugin, don't have hardcode it.

plugin::path('yourplugin') . 'webroot' . ds . 'rangemessage.xml' 

see api > cake\core\plugin::path()


Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -