TinyPortal

Development => Support => Topic started by: Nolt on February 19, 2011, 11:11:53 PM

Title: Error with TPortal.lang.php
Post by: Nolt on February 19, 2011, 11:11:53 PM
Recently on my forum I have lot of errors in my log, It tells me something is not right in TPortal.lang.php (both charset) on line ex. 372 or 373. This file isn't so large and doesn't have so many lines.

I've attached screen from SMF log section.
Thanks for any anserws and help.
Title: Re: Error with TPortal.lang.php
Post by: IchBin on February 19, 2011, 11:50:07 PM
In order to see the real error you need to disable template eval. In SMF2 you can do this in the server settings. In SMF 1 you have to run a database query like this:

REPLACE INTO smf_settings VALUES ('disableTemplateEval', 1);

After that, the error should point the correct place. The errors don't look like TP errors to me. If they are, they are likely caused from a bad piece of code in a block or something.
Title: Re: Error with TPortal.lang.php
Post by: Nolt on February 20, 2011, 10:13:23 AM
You were right :) It's something with template (SMF2.0) it tells:

Undefined variable: link_num
372: <li class="link_home">', ($link_num == count($context['linktree']) < 1) ? '

Undefined variable: scripturl
373: <a href="'.$scripturl.'" title="Home"><img class="link_home" src="'.$settings['images_url'].'/theme/home.png" alt="*" /></a>' : '', '</li>';

Im not a codder, maybe someone know what is wrong here?
Title: Re: Error with TPortal.lang.php
Post by: IchBin on February 20, 2011, 06:50:37 PM
Can you post the file(s) where this code appears? The $scripturl probably just needs to be put in the global line. Don't know about the first one though without seeing the code in the file.
Title: Re: Error with TPortal.lang.php
Post by: Nolt on February 20, 2011, 10:06:01 PM
Error appears only in one file, index.template.php. File attached.
Title: Re: Error with TPortal.lang.php
Post by: IchBin on February 21, 2011, 01:53:44 AM
Not sure what the exact point of your code is ATM. But here is the problem.

global $context, $settings, $options, $shown_linktree;

// If linktree is empty, just return - also allow an override.
if (empty($context['linktree']) || (!empty($context['dont_default_linktree']) && !$force_show))
return;

echo '
<div class="navigate_section">
<div class="navigate_sectionLeft"><div class="navigate_sectionRight">
<ul>
<li class="link_home">', ($link_num == count($context['linktree']) < 1) ? '
<a href="'.$scripturl.'" title="Home"><img class="link_home" src="'.$settings['images_url'].'/theme/home.png" alt="*" /></a>' : '', '</li>';


Neither $link_num or $scripturl are defined. You can fix the $scripturl  by adding that variable to the global line like this:
global $context, $settings, $options, $shown_linktree, $scripturl;

For the $link_num, it looks to me like your code needs to be reworked a little. Try this file out and see if it still works the same way you need it to.
Title: Re: Error with TPortal.lang.php
Post by: Nolt on February 21, 2011, 11:31:41 AM
Thanks IchBin :) now error log is empty.   O0