BoltWire is a FREE content management system written in PHP.

Its innovative architecture combined with best-in-class forms processing makes it ideal for creating complex, interactive, web applications fast...




Handbook > Conditions > Exists

This function checks to see if a page exists:

[if exists]true[else]false[if]
Checks to see if exists

You can use page shortcuts in this function:

[if exists ~bob]true[else]false[if]
Checks to see if member.bob exists

You can scan other directories within the local field by setting the dir parameter

[if exists img.gif dir=files]true[else]false[if]

You can check to see if a plugin exists in the plugin directory by setting dir=plugins

[if exists myplugin.php dir=plugins]true[else]false[if]

Except for the special case of the plugin directory, you cannot check for the existence of a file outside of the local field.

You can specify if you want to restrict the check to system and/or local pages. If the dir parameter is not specified, BoltWire checks both locations, and returns true if the page exists in either. Consider the following examples:

[if exists]true[else]false[if]
Returns true if in the system folder or the local pages folder

[if exists dir=system]true[else]false[if]
Returns true only if in the system folder, regardless of the local pages folder

[if exists dir=pages]true[else]false[if]
Returns true only if in the local pages folder, regardless of the system folder

System pages are important pages included with your BoltWire installation that enable your website to function. When they are edited, a modified version is stored in your local pages folder, but the original is preserved in the system folder. The following script for example, would list all the pages in the system folder, and put a + symbole before those which have customized versions in the pages folder:

[(search group=* dir=system template='[if exists {+p} dir=pages]+[else]-[if] {+p}')]

Note: This function does NOT check view permissions to determine if a page exists.