The good old "Failed to find block 'file_line'" and some new cause The good old "Failed to find block 'file_line'" and some new cause
 

News:

CPG Release 1.6.27
change DB IP storage fields to accommodate IPv6 addresses
remove use of E_STRICT (PHP 8.4 deprecated)
update README to reflect new website
align code with new .com CPG website
correct deprecation in captcha

Main Menu

The good old "Failed to find block 'file_line'" and some new cause

Started by Horst, July 19, 2006, 01:11:30 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Horst

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

Nibbler

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);

Horst

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