Topic: Get current page
Hi everybody!
I have one question to prevent a "dublicate title" (for google quality guidelines)
I have this code in my index.php in <head></head> tags:
<?PHP
function title_values($id, $use_category)
{
$path = './news/data';//CHANGE PATH TO THE CUTENEWS DATA DIRECTORY HERE
if ($use_category)
{
$cat_lines = file($path.'/category.db.php');
foreach ($cat_lines as $cat_line)
{
$cat_array = explode('|', $cat_line);
$my_cats[$cat_array[0]] = $cat_array[1];
}
}
$news_lines = file($path.'/news.txt');
foreach ($news_lines as $news_line)
{
$news_array = explode("|", $news_line);
if ($news_array[0] == $id)
{
$title = strip_tags($news_array[2]);
$description = strip_tags($news_array[3]);
if ($use_category and !empty($news_array[6]))
{
if (strstr($news_array[6], ','))
{
$cat_array = explode(',', $news_array[6]);
foreach ($cat_array as $category)
$category_arr[] = $my_cats[$category];
}
else $category_arr = $my_cats[$news_array[6]];
}
}
}
return array ($title, $category_arr, $description);
}
if (isset($_GET['id']))
{
$title_values = title_values($_GET['id'], true);//change true to false if the category doesn't need to be in the titlebar.
$title = $title_values[0];
$description = $title_values[2];
if (is_array($title_values[1])) $cat = ' - '.implode(' - ', $title_values[1]);
else $cat = ' - '.$title_values[1];
$description= str_replace('"', '', $description);
echo "<title>".$title."".$cat." My Site Title</title>\n";
echo "<meta name=\"description\" content=\"".$description."\" />";
}
else
{
echo "<title>My default title</title>\n";
echo "<meta name=\"description\" content=\"My default description.\" />";
}
?>
I need in this line: echo "<title>".$title."".$cat." My Site Title</title>\n"; before My Site Title to show a current page number, this is possible ?
Like:
My Site Title Page: 2
I would be very grateful to people who can do the check and put the definition in the script.
Thanks!