Hello-
I am not the original developer but now own the job of making small modifications to a php application. The on page factors such as title and meta are stored in a mysql database for the various pages. All URLs are different and are stored in the DB as filename.php with the exception of a group of stories and those URLs are written as articles.php?pg=1and so on with the various numbers.
My problem is I can't get the application to pull the DB row for articles.php?pg=3 or whatever number - it always defaults back to pulling the record for articles.php that is in the database. What I'm functionally trying to do is get the titles and metas to vary across the articles.php?pg=# pages instead of it being the same for all the articles.php pages.
The flow looks like this:
User comes to articles.php where a header.php file is included.
header.php calls config.inc.php where $current_page is defined:
$current = explode("/", $_SERVER["PHP_SELF"]);
$current_page = $current[count($current)-1];
header.php then calls general.class.php where the GetContent function is defined:
function GetContent($current_page)
{
$ret = array();
$sel = "SELECT * FROM `pages_content` WHERE `link` = '".$current_page."'";
//print $sel;
$this->db->Query($sel) or trigger_error($this->db->Error());
while($row = $this->db->getRow())
{
$ret[] = $row;
}
return ($ret);
}
going back to header.php, further down the page, the page content is populated:
$content = $generalObj->GetContent($current_page);
foreach($content as $general_content) {
$general_text = $general_content["page_content"];
$page_title = $general_content["page_title"];
$related = $general_content["related_links"];
$meta_desc = $general_content["meta_desc"];
$meta_key = $general_content["meta_key"];
}
going back to articles.php, the code below is defined at the top because $full_path is used for the form at the bottom of the page and seems irrelevant to just paging through the articles already submitted (but here it is in case it is relevant!):
$full_path = "";
$current = explode("/", $_SERVER["PHP_SELF"]);
for($i = 0; $i < sizeof($current) - 1; $i++){
$full_path .= $current[$i]."/";
}
further down in articles.php, this section defines the current articles page number:
if (isset($_GET["pg"]) and is_numeric($_GET["pg"]) and $_GET["pg"]>=1 and $_GET["pg"]<=ceil($totalPages))
$thisPage = $_GET["pg"];
else
$thisPage = 1;
And so I tried putting this line below in articles.php right below the above section to make the GetContent function return the databse row for articles.php?pg=3 (or whatever number) instead of the row for articles.php but it isn't working.
$current_page .= "?pg=" . $thisPage;
Any help, please???
Thanks!