PHPDevShell is all about customization. Really! Several mechanisms in the framework allow you to make the framework serve your purposes with as-little-as-possible code:
.local
files- Theme mods
- Hooks
- Classes override
Each mechanism fits one or several situation, and you can choose the right one depending on your need.
Local files
In several occasions, when a file is requested, the framework looks for another file with the same name ending with .local
. If found, the latter is used instead and therefore completely by-passes the original.
Currently this covers two situations:
1 – You want to override the very “top” (beginning of the process). Your index.local.php
should be a substitute for the following code:
include 'includes/PHPDS.inc.php';
$PHPDS = new PHPDS;
$PHPDS->run();
You could for example include
another PHPDS class definition and run()
an instance of it.
2 – Any .config.php
file loaded by the framework can also be substituted the same way. Useful for example to alter a config file for a plugin you didn’t write yourself, to avoid update problem. Or to change the configuration in the main config
folder, for single-site installations.
The main advantage is that when the content is updated, your file is preserved.
Hooks
Hooks allow a plugin to collaborate with another to add functionalities. The principal exemple would be the PluggableAuth addition of authentication via Google. See here.
Mods
If you create a complete website, you’ll likely to provide your own theme. If you do so, you can copy and change the theme’s mods.php
file, which contains a list of snippets that the framework uses to build the page.
For exemple:
class my_theme_mods extends themeMods
{
public function logo($url, $src, $alt, $title)
{
return "
<a href=\"{$url}\">
<img src=\"{$src}\" class=\"my_logo\" alt=\"{$alt}\" title=\"{$title}\">
</a>
";
}
}
You can put your own html for the logo part.
Post your comment on this topic.