php - echoing webpage title from the defined list -


i got way display custom page titles using include fuction.

header:

<title><?php echo $pagetitle ?></title> 

include:

<?php $pagetitle = "pets:"; include '../header.php'; ?> 

so handle titles easier i'd name come predefined list:

<?php define('animal', 'dog'); ?> 

how add 'animal' $pagetitle = "pets:"?

to answer question:

<?php $pagetitle = "pets:"; define("animal", "dog"); $pagetitle .= animal; echo $pagetitle; // yields "pets:dog"; ?> 

but fair, arrays, not constants in case.

something this:

<?php $pagetitle = "pets:"; $animals = array('dog', 'cat', 'bird', 'super cow'); echo $pagetitle . $animals[0]; // yields "pets:dog"; ?> 

Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -