Skip to content
Advertisement

Dynamically output the page title with php

I am trying to output the page title dynamically. I am using induces and this script is withing the header.php the goal is to output the header dynamically using a case/switch statement. here is my code:

JavaScript

I am getting a error telling me my variable $title is not defined?

What i am doing wrong?

Advertisement

Answer

In your first line, you have

JavaScript

This $title ; shouldn’t be there.

And, as Kailash Ahirwar already mentioned, it’s always a good idea to provide a default value for your $title:

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement