Path constants September 10, 2014 / Updated: June 12, 2022
Content
Zenphoto uses several path related constants internally you should always use these if you work with paths so your themes and plugins are safe for any possible name changes. These constants are defined in /zp-core/global-definitions.php.
For all URL's to actual items (albums, image, news and pages) you should rather use Zenphoto's object model framework or the related template functions.
Available constants
- ALBUMFOLDER
- /albums/ – stores all albums and images. If you use a custom name it of course stores that name.
- ALBUM_FOLDER_WEBPATH
- http(s)://yourdomain.com/albums/ – full webpath to the /albums folder
- ALBUM_FOLDER_SERVERPATH
- /var/www/html/zenphoto/albums/ – The path to the albums folder but with the full server path if you installed in a subfolder "zenphoto" (exact path depends on the host)
- BACKUPFOLDER
- /backup/ – stores the database backup made with the backup utility
- CACHEFOLDER
- /cache/ – stores all the cached images
- COMMON_FOLDER
- /zp-core/zp-extensions/common/ – stores some files that several official plugins make use of
- DATA_FOLDER
- /zp-data/ – stores the configuration and log files
- FULLWEBPATH
- The full web path to your installation, e.g. http://www.yourdomain.com/zenphoto/ if you installed Zenphoto in a folder "zenphoto".
- PLUGIN_FOLDER
- /zp-core/zp-extensions/ – stores all officially included plugins
- PROTOCOL
- http or https – The server protocol as set on its option. If you use it you need to add ://
- SERVER_HTTP_HOST
- The host part of the url, e.g. http://www.yourdomain.com
- SERVERPATH
- The full path on your server. e.g. /var/www/html/zenphoto if you installed in a subfolder "zenphoto" (the exact path depends on the host)
- STATIC_CACHE_FOLDER
- /cache_html/ – stores all the cached static HTML files of your site pages if using the static_html_cache plugin and also the RSS feeds if the RSS cache is enabled.
- THEMEFOLDER
- /themes/ – stores all themes
- UPLOAD_FOLDER
- /uploaded/ – the default folder for general non gallery files
- USER_PLUGIN_FOLDER
- /plugins/ – stores all 3rd party plugins
- UTILITES_FOLDER
- /zp-core/utilities/ – stores offcially included utiltiy plugins which appear as buttons on the main overview page on the backend.
- WEBPATH
- stores the path to your install. If you installed in a folder called "zenphoto" resolves to zenphoto.
- ZENFOLDER
- /zp-core/ – The Zenphoto core folder
Usage
Note: The constants do not include the slashes.
Path to a 3rd party plugin:
FULLWEBPATH.'/'.USER_PLUGIN_FOLDER.'/yourplugin.php
Path to an included plugin:
FULLWEBPATH.'/'.ZENFOLDER.'/'.PLUGIN_FOLDER.'/officialplugin.phpIf you print out URL's using these constants, don't forget to escape them using html_encode() to be sure.
This text by www.zenphoto.org is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Code examples are released under the GPL v2 or later license
For questions and comments please use the forum or discuss on the social networks.