Download on GitHub


Path class

The Path class is for getting a full path to a specified file.


object $CFG is the already defined $PHPZevelop->CFG object (This is required in the Path constructor)


GetClass(string $string, bool $return = true): Returns / Echos $PHPZevelop->CFG->RootDirs->Classes."/".$string

GetInc(string $string, bool $return = true): Returns / Echos $PHPZevelop->CFG->RootDirs->Inc."/".$string

GetImage(string $string, bool $return = false): Echos / Returns $PHPZevelop->CFG->LocalDirs->Images."/".$string

GetPage(string $string, bool $return = false): Echos / Returns $PHPZevelop->CFG->LocalDir."/".$string

GetPageRoot(string $string, bool $return = true): Returns / Echos $PHPZevelop->CFG->RootDirs->Pages."/".$string

GetScript(string $string, bool $return = false): Echos / Returns $PHPZevelop->CFG->LocalDirs->Scripts."/".$string

GetCSS(string $string, bool $return = false): Echos / Returns $PHPZevelop->CFG->LocalDirs->CSS."/".$string


To get the local URL for a page in pages/ you could use:


If the page was multiple levels deep you can use:


Note the second parameter of each method has a $return boolean that determines whether the method will "return" the value or "echo" the value. If you would like the value to be stored or used within a PHP script then you would pass "true" as the second parameter if "true" isn't the default (shown above):

$PHPZevelop->Path->GetPage("articles/article-name", true);

Where-as if you need the path string to be echo'ed directly to the page you would pass false as the second parameter, or leave blank in cases where $return is false by default:

<a href="<?php $PHPZevelop->Path->GetPage("article"); ?>">Link text</a>

Extending path class

You may want to extend the path class for your own usage, in this case put your path class file inside the "site/classes/" directory and use the following syntax:

class MyPath extends Path
	// Methods

You can then overwrite the $PHPZevelop Path object by calling:

$PHPZevelop->NewObject("Path", new MyPath($PHPZevelop->CFG));
.. In the site/instantiate.php file.

© PHPZevelop 2017 - @_Zephni (Craig Dennis)