Joomla Constants


Following is list of constants that can be used in Joomla:

01.JPATH_ADMINISTRATOR   The path to the administrator folder.
02.JPATH_BASE  The path to the installed Joomla! site.
03.JPATH_CACHE   The path to the cache folder.
04.JPATH_COMPONENT   The path to the current component being executed.
05.JPATH_CONFIGURATION   The path to folder containing the configuration.php file.
06.JPATH_INSTALLATION  The path to the installation folder.
07.JPATH_LIBRARIES   The path to the libraries folder.
08.JPATH_PLUGINS   The path to the plugins folder.
09.JPATH_ROOT  The path to the installed Joomla! site.
10.JPATH_SITE  The path to the installed Joomla! site.
11.JPATH_THEMES  The path to the templates folder.
12.JPATH_XMLRPC  The path to the XML-RPC Web service folder.
13. 
14.These constants are defined in _path_/includes/defines.php except JPATH_BASE which is defined in _path_/index.php.
15.
16.Note: These paths are the absolute paths of these locations within the file system, NOT the path you'd use in a URL.
17.
18.Also <a href="http://docs.joomla.org/JURI/base">JURI/base</a>.<ins datetime="2009-11-19T00:58:51+00:00"></ins>
19.
20./* this gives you the root of your url, something like http://www.mydomain.com/whereverjoomlais/ ;      */
21.JURI::root();
22.
23./* this one gives you the url to your index something like http://www.mydomain.com/whereverjoomlais/ if you are in front-end, and http://www.mydomain.com/whereverjoomlais/administrator/ if in back-end */
24.JURI::base();
25.
26./* Same but without the domain (like this: /wherejoomlais/administrator ) NOTE: this one is without the trailing "/"  */
27.JURI::base( true );
28.
29./* Path to your root directory, "/opt/xampp/..." or similar in Linux, "C:\wampp\..." on Windows */
30.var_dump( JPATH_ROOT );
31.
32./* Path to your admin directory, "/opt/xampp/joomla155/administrator" or similar in Linux, "C:\wampp\joomla155\administrator" on Windows. */
33.var_dump( JPATH_ADMINISTRATOR );
34.
35./* Path to your current component directory, "/opt/xampp/joomla155/administrator/components/com_free" or similar in Linux, "C:\wampp\joomla155\administrator\components\com_free" on Windows. */
36.var_dump( JPATH_COMPONENT );
37.
38./* Your directory separator: "/" in Linux, "\" on windows; use this to create a path to a directory so you don't have to worry about the server OS you're using */
39.var_dump( DS );

Bình luận về bài viết này