I have news pages generated dynamically using page news.php taking data that is input into a MySql table and would like to have the page title to be the same as the news headline of each page.
I'm searching internet and although there is lots of info on this subject I'm still not having any success, so I'm looking for some help on where I'm going wrong. (must add that I'm a novice).
I have raed that it is possible using the following code:
<title><?php echo $pageTitle; ?></title>
and then have the following on a page to be included:
$pageTitle = "My page title";
What I'm looking for is the correct code to go into the include page to replace "My Page Title" that will dynamically give the news headline.
I'm hoping that someone can help me to extract the code I need from the following code in news.php that dynamically creates individual pages for each news item:
<?php
@include_once("class/Configure.php");
if(!$c_Connection->Connect())
{
@header("Location:message.php?msg=2");
exit();
}
@include_once("class/ss_news.php");
$c_ss_news = new ss_news($c_Connection);
$news = $_GET["news"];
$c_ss_news->m_NEW_Id = $news;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Supplier Scan - News</title>
<link rel="shortcut icon" href="images/favicon.ico" />
<link href="style/styles.css" rel="stylesheet" type="text/css" media="all" />
<link href="style/addto.css" rel="stylesheet" type="text/css" media="all" />
<script type="text/javascript" src="scripts.js"></script>
</head>
<body>
<div class="wrapper">
<div class="container">
<?php @include_once("includes/header.php"); ?>
<div class="contentWrapper">
<div class="contentWrapper_leftCol">
<div class="contentinner_bg_col">
<div class="contentinner_bg_bottom">
<div class="contentinner_bg_top">
<!--<h3>Latest News </h3>-->
<?php
if($resultNews = $c_ss_news->GetNewsById())
{
if($rowNews = @mysql_fetch_array($resultNews))
{
$newsId = $rowNews["NEW_Id"];
echo ' <h3>'.$rowNews["NEW_Headline"].'</h3>';
echo '<p><b>'.$rowNews["NEW_Summary"].'</b></p>';
echo '<p>';
if($rowNews["NEW_Image"] != "")
{
echo '<img src="news/images/'.$rowNews["NEW_Image"].'" title="'.$rowNews["NEW_ImageTitle"].'" alt="'.$rowNews["NEW_ImageTitle"].'" style="float:left; margin-right:10px; " />';
}
echo $rowNews["NEW_Desc"].'</p>';
$resultPost = mysql_query("SELECT DATE_FORMAT('".$rowNews["NEW_Postedon"]."', '%d %b %Y')");
$posted = @mysql_fetch_array($resultPost);
$pdf = $rowNews["NEW_PdfName"];
}
}//End of if($resultNews = $c_ss_news->GetNewsById())
?>