Extending a Navigation Menu in Partials in Laravel 5

This post is more of a reminder to myself on how to extend a menu in an included partial when using the PHP framework Laravel.

As of this writing I’m using Laravel 5.1.16.

Hopefully other people find it useful too.

Let’s say you have a similar folder setup to this in your project:

-- layouts
-- default.blade.php
-- partials
-- nav.blade.php

The default.blade.php template includes the navigation partial:

<!DOCTYPE html>
<html lang="en">


In order to be able to extend the navigation menu from within index.blade.php you need to add @yield(‘nav’) to the nav.blade.php file.

<li><a href="{{ url('/') }}">Home</a></li>

Then from within the index.blade.php file you can extend the navigation menu using the following code:

<li><a href="#">New Nav item</a></li>
@append {{-- @stop also works --}}

I’m not 100% sure this is the best way to do it, but I searched for a way to use @parent within the nav.blade.php file and could not find a solution.

Leave a comment if you know of a better way to achieve this.

CodeIgniter Profiler: Globally Enable/Disable

Here is a quick tip for users of the CodeIgniter PHP Framework (and a reminder to myself). If you wish to enable or disable the profiler globally while developing your application (as opposed to changing the value in each seperate controller), you can do the following.

1. Open the config.php file in the application/config/ folder.
2. Add a new config setting using the following code:

| Globally Enable/Disable Profiler
| TRUE  = On
| FALSE = Off
$config['profiler_status'] = TRUE;

3. Then in each of the controllers that you want to the profiler to be displayed on, add the following code to the constructor.


Note: If you prefer to only have the profiler be displayed on some methods, then place the code from step 3 above into each of the methods.

Hope  this helps :)

PHP Frameworks

Recently I’ve been toying with the idea of using a PHP framework to help with the development of my web sites. The problem is, I don’t know which one to choose :(

Some of the frameworks I’ve been looking at include:

Each has there own unique advantages, but what is the best way to decide which one suits my needs the best?

Object Oriented Programming in PHP

Object Oriented Programming is the one area of PHP programming that I’m having difficulty grasping :(

I’ve managed to come to terms with functions, regular expressions and the likes, but I just can’t seem to grasp the concept of methods, and especially stuff like passing by reference! Are there any tricks other programmers out there use?
If you know of any good books, articles or tutorials that might help me in my quest to overcome this affliction, please, please, let me know!

Call yourself a Web Professional

Plenty of people have been talking about whether or not those that refuse to adopt web standards in web design should be entitled to call themselves web professionals.

While I agree that those who design should be looking to learn web standards, I also feel that not everyone has the same learning curve when it comes to standards. Some people need more time to learn than others. I especially didn’t like one particular quote from John Oxton (certain words censored):

What I want is HTML that kicks up a royal f*****g stink if it isn’t treated properly. HTML that takes no s**t, with a built in big flashy message (GO AWAY AND LEARN ABOUT ME!) for people who refuse to take the time to learn this super simple language and who refuse to refine their understanding.
I think some people seem to forget that it’s not a ‘super simple language’ to everyone. That quote is like a typical ‘RTFM’ response you’d get on a forum. Don’t slate someone just because they don’t know as much as you. I’m sure you wouldn’t like the same response from someone who knows more about another topic than you.