Forum Moderators: coopster
function metadata($type) {
global $keywords;
$page = test_page('class');
$hometext = 'Home Page Title';
if($page == '') { // this means we're on the "Home" page
if($type == 'title')
echo $hometext;
elseif($type == 'description')
echo 'description here';
elseif($type == 'keywords')
echo 'keyword list here';
} else { // if we're not on the home page...
if($type == 'title')
echo ' » ' . $hometext;
elseif($type == 'description')
echo $page;
elseif ($type == 'keywords')
echo $keywords;
}
}
<?php include('../loader.php');
get_include('header');
$keywords = 'inside keyword'; ?>
<div id="main" class="clear">
<h1>Vision, Mission</h1>
<h3>Vision Page Test</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin rhoncus, massa tincidunt molestie blandit, velit urna porta enim, tempor mollis metus ipsum sed mi. Quisque luctus tristique turpis. Sed vel sem dignissim orci rutrum vestibulum. Proin pretium molestie est id blandit. Duis posuere congue quam. Duis elementum nulla a massa interdum facilisis. Cras id libero quis elit blandit blandit. Praesent eros est, viverra nec eleifend sed, cursus at dui. Curabitur eu magna eu lectus imperdiet vehicula. Nulla velit leo, consectetur eget rutrum ut, dapibus quis nunc. Mauris ligula nibh, lacinia non vehicula id, luctus volutpat erat. Nulla sed tortor dolor, ut ullamcorper elit. Integer eros leo, rhoncus id pretium vitae, tempus a eros. Vivamus nec eleifend mi. Nam augue enim, iaculis laoreet dictum quis, hendrerit in nisi. Sed risus metus, varius nec varius in, laoreet id risus. Suspendisse potenti. Pellentesque ornare quam orci. Aliquam rutrum dapibus varius. Mauris ac consectetur massa.</p>
<p>Nunc quis mauris eleifend orci tempor tincidunt. Etiam id lorem ut felis scelerisque ornare a ut mauris. Duis molestie odio sed nulla eleifend dignissim. Suspendisse consectetur adipiscing elit.</p>
<!--/left-->
</div>
<?php get_include('sidebar');
get_include('footer'); ?>
when the client goes in to edit the title, keywords and description for each page, they can do it right there within the file they're going to edit.
function calc($num1,$num2,$operand) {
switch $operand {
case add:
$tot=$num1+$num2;
break;
case subtract:
$tot=$num1-$num2;
break;
case multiply:
$tot=$num1*$num2;
break;
case divide:
// No division by zero
$tot=($num2 > 0)?$tot=$num1/$num2:'INVALID DIVISOR';
break;
default:
$tot='INVALID OPERAND';
}
$mod = ($num%$num2 > 0)?'odd','even';
return Array($tot,$mod);
}
<head> tag in my header.html include: <?php global $thistitle, $thisdesc, $thiskey; ?>
<title><?php echo metadata('title', $text = $thistitle); ?></title>
<meta name="description" content="<?php echo metadata('description', $text = $thisdesc); ?>" />
<meta name="keywords" content="<?php echo metadata('keywords', $text = $thiskey); ?>" />
function metadata($type, $text='') {
global $thistext;
$page = test_page('class');
$default_title = 'Catalysis: Foundation for Health';
$default_description = 'Default Description';
$default_keywords = 'Default Keywords';
if($type == 'title') {
if($text == '') $text = $default_title;
else $text = $text;
} elseif($type == 'description') {
if($text == '') $text = $default_description;
else $text = $text;
} elseif($type == 'keywords') {
if($text == '') $text = $default_keywords;
else $text = $text;
}
return $text;
}
// edit meta stuff here
$thistitle = 'About';
$thisdesc = 'About page description here';
$thiskey = 'About keywords here';
// end editing