Documentation

Light-weight, fast, simple and powerful!
 
Translations of this page?:

Constants

Wolf uses some “constants” which can be useful for site development:1)

URL_PUBLIC

URL_PUBLIC returns the homepage URL of the Wolf website in the format http://www.mywolfsite.com/ (with trailing slash). It is used throughout the default Layouts to provide a dynamic reference to the website. For example, the favicon is called in the Simple layout with this code:

  <link rel="favourites icon" href="<?php echo URL_PUBLIC; ?>favicon.ico" />

URI_PUBLIC

URI_PUBLIC returns the home location of the Wolf website. This makes it possible to pass a reference relative to the location of Wolf's index page. If Wolf's index.php lives in the root directory (e.g., http://www.mywolfsite.com/), then echo URI_PUBLIC will simply return /. If it lives in a subdirectory (e.g. http://www.example.com/wolfcms/), then echo URI_PUBLIC will return the root directory like this: /wolfcms/

BASE_URL

BASE_URL is closely related to URL_PUBLIC, and when USE_MOD_REWRITE is set to “true” in config.php, they are identical. However, when USE_MOD_REWRITE is set to “false”, BASE_URL will include the ? in the URI.

In the default sidebar to the Home Page, the RSS feed link is given this way:

  <a href="<?php echo BASE_URL; ?>rss.xml">Articles RSS Feed</a>

CURRENT_URI

Echoing CURRENT_URI will return the part of the current URL following the URI_PUBLIC (see above), ignoring any page suffixes. Examples:

Full URL URI_PUBLIC CURRENT_URI
http://www.mywolfsite.com/about_us / about_us
http://www.example.com/wolf/about_us /wolf/ about_us
http://www.example.com/wolf/about_us.html /wolf/ about_us
http://www.example.com/grocers-site/fruit/oranges.html /grocers-site/ fruit/oranges
http://www.mywolfsite.com/articles/2009/07/24/my_second_article / articles/2009/07/24/my_second_article

CMS_ROOT

The CMS_ROOT contstant returns the file path of the server to the directory where Wolf is installed. If you installed Wolf to the htdocs root directory of your site, this code:

<?php echo CMS_ROOT; ?>

would return a value something like:

/home/vol8/mywolfsite.com/my_account_name/htdocs

1) There is a yet more full list of constants provided with the Plugin documentation, but without some of the discussion given here.
 
functions/constants.txt · Last modified: 2011-09-12 00:46 (external edit)
 
Except where otherwise noted, content on this wiki is licensed under the following license:GNU Free Documentation License 1.2
Copyright 2010 wolfcms.org / design by yello studio / Wolf CMS Inside