April 7th, 2008
I’m using headings in the format:
<hx id=”foo”>Foo</hx>
Instead of keeping track of an internal page menu by hand, it’s easily to dynamically parse the string with a regular expression (assuming you’re using level 3 headers):
function create_page_navigation(&$string)
{
$menu = array();
$pattern = ‘/<h3 id=”(.+)”>(.+)<\/h3>/’;
preg_match_all($pattern, $string, $headings);
$headings_num = count($headings[1]);
for ($i = 0; $i < $headings_num; $i++)
{
$menu[] = array('slug' => $headings[1][$i], […]
February 1st, 2008
There are many Code Igniter authentication libraries, Michael Wales’s Erkana Auth differentiates itself by aiming to be a “small set of methods and helpers that would prove useful for a variety of user authentication while not hijacking the framework”.
The code is fairly self-explanatory, but here’s an example of how it can be implemented.
Firstly, you need […]
October 20th, 2007
Popel, D. (2007) Learning PHP Data Objects, Packt Pub
Commendably the book keeps a tight focus, providing the minimum context in which to show PDO features: in this case a basic library program with simple PHP methods providing HTML. However in a later chapter it provides a useful example that shows the advantage of the model, […]