Hello everybody,
here my situation:
1. I include a custom header (header.php) via the admin menu.
2. In the custom header a custom PHP script (shoutbox.php) is included.
3. This shoutbox.php is calling a database.
4. --> Template Error Failed to find block 'file_line'. Coppermine is showing me:
Template error
Failed to find block 'file_line'(#(<!-- BEGIN file_line -->)(.*?)(<!-- END file_line -->)#s) in :
<tr>
<td class="tableb" align="center">
<font size="3"><b>{MESSAGE}</b></font>
<br /><br />
</td>
</tr>
After a long time of reading forum and debugging I can name the following line of "shoutbox.php" as the cause of the error:
$link = mysql_connect($myConfig['db_addr'], $myConfig['db_user'], $myConfig['db_pass']);
if ($link)
{
// select db
$db_selected = mysql_select_db($myConfig['db_db']); // <---------------- this one
}
Without this database call the header is working fine and does not produce any errors and also my template is ok. The reason of the error is definitely the "mysql_select_db()" call!
How to solve this? ??? I really need to call the database there.
Horst
Is the shoutbox usign a different db to Coppermine? If so then you need to make sure it uses its own db connection exclusively.
Tell it to behave itself and use its own connection
$db_selected = mysql_select_db($myConfig['db_db'], $link);
You'll need to do that for all the mysql_query() calls too.
If not, then you need to tell it to make it's own connection to the db instead of sharing coppermine's.
$link = mysql_connect($myConfig['db_addr'], $myConfig['db_user'], $myConfig['db_pass'], true);
Bingo!!! Great, i changed my database callings and querys and also the database opening calls the way you showed me and - it works fine ;D.
Thank you.
Horst