Jump to content

paths no longer work once file is included


gwh

Recommended Posts

Hi everyone,

 

I have a separate php file that's located in a specific directory and it includes another php file, ie.

 

include '../../catalogue.php';

 

The abovementioned catalogue.php file has a whole heap of links to other javascript files whose paths work in relation to the catalogue.php file, eg.

 

<script language="javascript" type="text/javascript" src="../../ScriptLibrary/jquery-latest.pack.js"></script>

<script language="javascript" type="text/javascript" src="../../dmx/dmx.core.js" id="dmxCoreJS"></script>

<script language="javascript" type="text/javascript" src="../../dmx/widgets/Lightbox/dmx.lightbox.js"></script>

 

...however, when the catalogue.php file is included from the other controller file (see the code below), the paths no longer work. Does this mean I have to change the above paths so that they are correct in relation to the controller file below?

 

Hope that makes sense and appreciate any help.

 

<?php
$link = mysqli_connect('localhost', 'root', 'root');
if (!$link)
{
$output = 'Unable to connect to the database server.';
include 'output.html.php';
exit();
}

if (!mysqli_set_charset($link, 'utf8'))
{
$output = 'Unable to set database connection encoding.';
include 'output.html.php';
exit(); 
}

if (!mysqli_select_db($link, 'catalogue'))
{
$output = 'Unable to locate the catalogue database.';
include 'output.html.php';
exit();
}

$output = 'Database connection established.';
include 'output.html.php';

$result = mysqli_query($link, 'SELECT shirtDescLadies, shirtDescMen FROM shirts');
if (!$result)
{
$error = 'Error fetching description: ' . mysqli_error($link);
include 'error.html.php';
exit();
}

while ($row = mysqli_fetch_array($result))
{
$descriptions[] = array('shirtDescLadies' => $row['shirtDescLadies'], 'shirtDescMen' => $row['shirtDescMen']);
}

include '../../catalogue.php';

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.