Hi there,
A bit of SearchEngine Optimization:
As we all know, search engines do love to deal with
many keywords, and your goal probably is to get more
and more users on your page, therefore keywords might
be your things as well.
I've been working on a quick patch that adds dynamic
meta keywords when viewing a recipe: it's to be
implemented into your themes/default/header.php file in
the <head> section of yours:
____________________________________________________
<?php
// If we see have recipe_id set, let's generate
relevant meta keywords
$recipe_id = isset( $_GET['recipe_id'] ) ?
$_GET['recipe_id'] : 0;
if ($recipe_id != "0") {
// get some information on recipe
$sql = "SELECT
recipe_name,ethnic_desc,course_desc,base_desc,user_name
FROM $db_table_recipes
LEFT JOIN $db_table_ethnicity ON
ethnic_id=recipe_ethnic
LEFT JOIN $db_table_courses ON
course_id = recipe_course
LEFT JOIN $db_table_bases ON base_id
= recipe_base
LEFT JOIN $db_table_users ON
user_login = recipe_owner
WHERE recipe_id=$recipe_id";
$metaBase=$DB_LINK->Execute( $sql );
DBUtils::checkResult($metaBase, NULL, NULL,
$sql);
// construct our new keywords
echo "<!-- meta keywords for recipe: " .
$metaBase->fields['recipe_name'] . " -->\n";
echo '<meta name="author"
content="'.$metaBase->fields['user_name'].'"/>'. "\n";
echo '<meta name="keywords"
content="'.$metaBase->fields['recipe_name'].
',
'.mb_strtolower($metaBase->fields['ethnic_desc']).
',
'.mb_strtolower($metaBase->fields['base_desc']).
',
'.mb_strtolower($metaBase->fields['course_desc']).
', ';
// fetch ingredients
$sql = "SELECT
$db_table_ingredientmaps.*,unit_desc,ingredient_name
FROM $db_table_ingredientmaps
LEFT JOIN $db_table_units ON unit_id
= map_unit
LEFT JOIN $db_table_ingredients ON
ingredient_id = map_ingredient
WHERE map_recipe = $recipe_id ORDER
BY map_order";
$ingredients = $DB_LINK->Execute($sql);
DBUtils::checkResult($ingredients, NULL,
NULL, $sql);
// show ingredients as well in keywords
while (!$ingredients->EOF) {
echo
$ingredients->fields['ingredient_name'].', ';
$ingredients->MoveNext();
}
echo 'phprecipebook" />'. "\n";
} else {
// if we don't have a recipeID, use some
default meta info
echo "<!-- no recipeID is present, adding
default meta keywords -->\n";
echo '<meta name="author" content="I'm the
Author"/>'. "\n";
echo '<meta name="keywords"
content="phprecipebook" />';
}
?>
__________________________________________________
This will look whether you have a recipeID, and if yes,
will put the recipename, recipeowner, ethnic, base,
course and ingredients information as meta-keywords.
Don't forget to modify the default info :-)
Hope this helps,
MBJr.
Logged In: YES
user_id=620676
One more:
I made a mistake in the example, so be sure you modify the
default meta-author as it will drop you a parse error :-)
:>
Logged In: YES
user_id=599321
I like the idea, but I am going to leave this is a patch for
now. Maybe we can come up with something a little more
static (i.e. less overhead on the database). Maybe it could
be an admin function that is run on request every so often
to create a add on header file.
Todd