News:

Wondering if this will always be free?  See why free is better.

Main Menu

Use of undefined constant id

Started by tsmalmbe, March 27, 2007, 05:44:42 PM

Previous topic - Next topic

tsmalmbe

I get tons of these:

8: Use of undefined constant id - assumed 'id'
8: Undefined variable: first

The errormsg always contains a reference to a file and a linenumber that doesn't exist in the file. What's going on? I get like 10 rows of this stuff for each page I load. My error log is quite huge.
..:: http://www.kontrollrummet.com - Studio och musik ::.. RSS?

SleePy

Do the errors contain a (Eval?) at the end?

Run This query In phpMyAdmin (What is phpMyAdmin?)
REPLACE INTO smf_settings VALUES ('disableTemplateEval', 1);

Then clean your error log and wait for the error to occur again. It should hopefully be different.
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

tsmalmbe

Yes, I can confirm that i has eval(?) at the end.

I will run the query on my testserver.

Out of curiosity, what does this "fix" do? Am I just hiding some real problems with it?
..:: http://www.kontrollrummet.com - Studio och musik ::.. RSS?

tsmalmbe

Ni difference. A few clicks, and 3 pages of errors.

8: Undefined variable: first
Fil: /srv/www/html/smf/Themes/Musiconica/BoardIndex.template.php
Rad: 134

8: Use of undefined constant id - assumed 'id'
Fil: /srv/www/html/smf/Themes/Musiconica/index.template.php
Rad: 841

8: Use of undefined constant smflinks_menu - assumed 'smflinks_menu'
Fil: /srv/www/html/smf/Themes/Musiconica/index.template.php
Rad: 753

8: Use of undefined constant id - assumed 'id'
Fil: /srv/www/html/smf/Themes/Musiconica/index.template.php
Rad: 841
..:: http://www.kontrollrummet.com - Studio och musik ::.. RSS?

metallica48423

is this happening on the default theme as well?

I have seen quite a few users having problems with the musiconica theme in the month or so.
Justin O'Leary
Ex-Project Manager
Ex-Lead Support Specialist

QuoteMicrosoft wants us to "Imagine life without walls"...
I say, "If there are no walls, who needs Windows?"


Useful Links:
Online Manual!
How to Help us Help you
Search
Settings Repair Tool

tsmalmbe

I will test tomorrow, just shut down my testserver for today. I've heard all kinds of crap about the musiconica-theme.
..:: http://www.kontrollrummet.com - Studio och musik ::.. RSS?

butchs

I tried the query and it turned off my visual verification. Do you have something else to get rid of the errors?
???
I have been truly inspired by the SUGGESTIONS as I sit on my throne and contemplate the wisdom imposed upon me.

metallica48423

butchs: its not intended to be left off, it switches off the eval() code in templates, and instead returns true PHP errors, so you can see what the real issue is.

eval() is used for error logging because instead of returning an error to the server it can return it via something like your error log.

check your error log and post the issues you are having, and then run this to turn template eval back on:

DELETE FROM smf_settings WHERE variable = 'disableTemplateEval';
Justin O'Leary
Ex-Project Manager
Ex-Lead Support Specialist

QuoteMicrosoft wants us to "Imagine life without walls"...
I say, "If there are no walls, who needs Windows?"


Useful Links:
Online Manual!
How to Help us Help you
Search
Settings Repair Tool

metallica48423

QuoteNi difference. A few clicks, and 3 pages of errors.

8: Undefined variable: first
Fil: /srv/www/html/smf/Themes/Musiconica/BoardIndex.template.php
Rad: 134

8: Use of undefined constant id - assumed 'id'
Fil: /srv/www/html/smf/Themes/Musiconica/index.template.php
Rad: 841

8: Use of undefined constant smflinks_menu - assumed 'smflinks_menu'
Fil: /srv/www/html/smf/Themes/Musiconica/index.template.php
Rad: 753

8: Use of undefined constant id - assumed 'id'
Fil: /srv/www/html/smf/Themes/Musiconica/index.template.php
Rad: 841

The sql query did what it was supposed to - instead of returning an eval error it tells us which file(s) and which lines the errors are occuring on

As previously posted, there are all sorts of problems with the musiconica theme, i would heavily suggest moving off that theme :(
Justin O'Leary
Ex-Project Manager
Ex-Lead Support Specialist

QuoteMicrosoft wants us to "Imagine life without walls"...
I say, "If there are no walls, who needs Windows?"


Useful Links:
Online Manual!
How to Help us Help you
Search
Settings Repair Tool

tsmalmbe

I will struggle on with Musiconica.

I've managed to fix everything now with the new logformat in place - except for this. The row below always gives an error about the "first"-variable. WHere is it defined, and what is it supposed to do?


<div class="tborder" style="margin-top: ' , $first ? '0;' : '1ex;' , '' , $context['browser']['needs_size_fix'] && !$context['browser']['is_ie6'] ? 'width: 100%;' : '', '">
..:: http://www.kontrollrummet.com - Studio och musik ::.. RSS?

metallica48423

in the default theme, its set here:

/* Each category in categories is made up of:
id, href, link, name, is_collapsed (is it collapsed?), can_collapse (is it okay if it is?),
new (is it new?), collapse_href (href to collapse/expand), collapse_image (up/down image),
and boards. (see below.) */
$first = true;


then immediately after that is


foreach ($context['categories'] as $category)
{
echo '
<div class="tborder" style="margin-top: ' , $first ? '0;' : '1ex;' , '' , $context['browser']['needs_size_fix'] && !$context['browser']['is_ie6'] ? 'width: 100%;' : '', '">
<div class="catbg', $category['new'] ? '2' : '', '" style="padding: 5px 5px 5px 10px;">';
$first = false;



Perhaps try seeing if $first = true; is in there, if not add it above the check for it that you posted, and then after that query try $first = false;
Justin O'Leary
Ex-Project Manager
Ex-Lead Support Specialist

QuoteMicrosoft wants us to "Imagine life without walls"...
I say, "If there are no walls, who needs Windows?"


Useful Links:
Online Manual!
How to Help us Help you
Search
Settings Repair Tool

tsmalmbe

True.

I had reused that par of codeto draw my own "boxes", and of course the $first-variable wasn't defined. If I had known then, what I know now, the design would be a bit different. Now I just added the $first = true; to the beginning of the boardindex.

The errors are gone.

Thank you.
..:: http://www.kontrollrummet.com - Studio och musik ::.. RSS?

metallica48423

You're welcome :)

you might want to re-enable template eval, as your forum probably took a decent performance hit when you turned it off. 

DELETE FROM smf_settings WHERE variable = 'disableTemplateEval';
Justin O'Leary
Ex-Project Manager
Ex-Lead Support Specialist

QuoteMicrosoft wants us to "Imagine life without walls"...
I say, "If there are no walls, who needs Windows?"


Useful Links:
Online Manual!
How to Help us Help you
Search
Settings Repair Tool

tsmalmbe

Yes, I gathered that a performance hit was a part of the more extensive logging. Of course I only enabled it for my testsite, and left the production site running with the default logging.

But, a good point still for other readers.
..:: http://www.kontrollrummet.com - Studio och musik ::.. RSS?

Advertisement: