PDA

View Full Version : Template warning, variable conflict?


everwicked
04-29-2002, 02:19 PM
Hello,

I recently started a postnuke+vbulletin project for my website.

Till now I just hacked register.php to update pn's edited tables as well. To do so I had to call pnInit().

Although the registration proceeds fine, I get a warning.

Warning: Use of undefined constant template - assumed 'template' in /home/everwick/public_html/project/forums/admin/functions.php on line 974

I thought that some variable of my hack is conflicting with vB but looking at my code over and over, can't find anything.

Any suggestions?

PS: I could post the code I added but I don't think it will be of any use. Just let me know if it does though.

PS2: I modified templates register_adult and register_stylecell

Cheers

Admin
04-29-2002, 02:48 PM
What's line 974 of functions.php?

The warning isn't about templates, it's about using an undefined constant ('template'). It should probably be a string / variable, I'll need to see the line in order to tell.

everwicked
04-29-2002, 02:51 PM
Pasting from the file, the line is the one in bold


// ###################### Start gettemplate #######################
function gettemplate($templatename,$escape=1,$gethtmlcommen ts=1) {
// gets a template from the db or from the local cache
global $templatecache,$DB_site,$templatesetid,$addtemplat ename;

if (isset($templatecache[$templatename])) {
$template=$templatecache[$templatename];
} else {
$gettemp=$DB_site->query_first("SELECT template FROM template WHERE title='".addslashes($templatename)."' AND (templatesetid=-1 OR templatesetid='$templatesetid') ORDER BY templatesetid DESC LIMIT 1");
$template=$gettemp[template];
$templatecache[$templatename]=$template;
}

if ($escape==1) {
$template=addslashes($template);
$template=str_replace("\\'","'",$template);
}
if ($gethtmlcomments and $addtemplatename) {
return "<!-- BEGIN TEMPLATE: $templatename -->\n$template\n<!-- END TEMPLATE: $templatename -->";
}

return $template;
}

Admin
04-29-2002, 02:57 PM
I see, looks like PostNuke or whatever is using functions.php has a high level of error reporting. Fixing that instance won't solve the problem because you will just get another error in a different place.

Find a line in your files that contains "error_reporting()" (not a vBulletin file, a custom file), and change whatever there is in there to 7, so it would look like this:
error_reporting(7);

everwicked
04-29-2002, 03:35 PM
I hope that works :)

There was only one error_reporting(E_ALL) in pnInit()

I'll get back to u if it doesn't work.

Thanks :)

Admin
04-29-2002, 03:53 PM
Yeah that's the problem. E_ALL means report all errros, including warnings.