General
Getting & Giving Support
Administration
Design
- Tut. - Layouts and Themes
- Tut. - Navigation cookbook
- Tut. - How To section
Reference Material
Plugin Development
- Tut. - Writing a plugin
- Ref. - List of Events
- Ref. - Enabling cron jobs
- Ref. - PHPDoc
Core Development
- Ref. - PHPDoc
Press information
Wolf CMS books section
url_match()
This is a simple conditional function which tests the current URI against a parameter supplied. If they match, it returns “true”; otherwise it returns “false”.
Example
A useful example is found in the default “header” snippet that is created when Wolf is installed. In the navigation code, this is the first entry in the <ul> list:
<li><a<?php echo url_match('/') ? ' class="current"': ''; ?> href="<?php echo URL_PUBLIC; ?>">Home</a></li>
This hard-sets the “Home” link in the navigation; the url_match() function provides the test for whether the homepage is current, and echoes the class="current" for styling the anchor if the test is successful.
Notes
All elements of the URI must be matched for “true” to be returned. For example, with the URL http://wolfsite.com/page/child-page, the test url_match('child-page') will return false, but url_match(page/child-page) will return true.
See also the url_start_with() function.
