I believe the issue I am facing is how to use PHP include();
This is what exactly happening:
I am working in my local machine using WAMP Server.
1) My main index.php file is located in: http://localhost/MARANATHA.tv/index.php
2) This is my folder hierarchy:
a) http://localhost/MARANATHA.tv/]index.php
b) http://localhost/MARANATHA.tv/_functions/functions.php
c) http://localhost/MARANATHA.tv/bible/search.php
functions.php is added as an include() in index.php, and it contains all the functions that make up my website. menu() generates my menu buttons and content()generates the body text of each menu page.
3) I am including a bible script (third party), which comes with is own database. I used an if condition so as to when the user clicks on BIBLE button, it includes the third part appplications main file search.php The code to include the search.php file is: include ('bible/search.php');
When I click on the BIBLE button, the right the content of search.php is rendered on the page. We are good up to here. However, when I click on any of the links in search.php, they are broken. For instance if I click on genesis, I am directed to http://localhost/MARANATHA.tv/readbible.php?version=kjv&book=Genesis, which is broken.
What's happening, in this case, is that PHP engine is looking at readbible.php as if this file is included in the main root folder (http://localhost/MARANATHA.tv/readbible.php), and not in the bible folder (http://localhost/MARANATHA.tv/bible/readbible.php) as is supposed to happen.
You can also see it online at maranatha.tv I use jQUERY to render the contents pages. So if you click BIBLE, you will only see maranatha.tv on the address bar and not maranatha.tv/bible/search.php but that's fine. However if click on any of the links on BIBLE page, it will show the broken link as so: http://maranatha.tv/readbible.php?version=kjv&book=Genesis
Here's my entire content function:
function content(){
// DETERMINE which page ID to USE in our query below ***************************************************
if (!isset($_GET['jesusid'])) {
$pageid = '1';
} else {
$pageid = preg_replace('#[^0-9]#i', '', $_GET['jesusid']);} // filter everything but numbers for security)
//preg_replace($pattern, $replacement, $string);//preg_replace() Function structure
// Query the body section for the proper page
$query = mysql_query ("SELECT body_text,title,linklabel, author FROM content WHERE id = '$pageid' LIMIT 1 ") or die (mysql_error());
while ($row = mysql_fetch_array($query)) {
echo ucwords($row['title']).' por ';
echo '<b>'.$row['author']. '</b><br>';
echo ucwords($row['body_text']);
//Add Bible Script
if (ucwords($row['title'])=='Biblia') //use row title -- UPPERCASED word
{
include ('bible/search.php');
}
}
}
?>
Thanks for your help!