TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
Stats
  • Total Posts: 196,021
  • Total Topics: 21,332
  • Online today: 582
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 353
  • Total: 353

Undefined Variable: Render & Undefined Index: single_page

Started by shelzmike, August 02, 2008, 09:40:42 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

shelzmike

I am getting 3 errors that occur for everyone only on the frontpage.

To start, here are the specs: no url (test site only for now - however, I have a good environment with mods, standard users, guests, admins, etc. - all me, of course, but you get the point.)

SMF: 1.1.5
TP: 1.052
Mods Installed:(besides TP)
Youtube BBCode: 2.3
View Single PM 1.3
Google Tagged: 1.4
Ultimate Profile 0.8.5
Avatars at index 1.5

Here are the errors I am getting:

8: Undefined variable: render
File: D:\Hosting\3105563\html\forum\Themes\default\TPortal.template.php (main sub template - eval?)
Line: 930

line 930 in reference here is: (actually, this is the whole block, line 930 starts with $render
// render the text
echo '</div><div class="tp_articletext" style="font-size: 110%; padding-left: 10px;">';

$render .= tp_rendermode($story);



Next Error:
8: Undefined index: single_page
File: D:\Hosting\3105563\html\forum\Themes\default\TPortal.template.php (main sub template - eval?)
Line: 922

Line 922 block: (922 specifically starts with if($context)..and ends with [single_page].
if($context['TPortal']['print_articles']==1 && $context['TPortal']['single_page'])
$opts[] = '<a href="' . $story['print_href'] . '"><img style="margin: 0 6px 0 6px;" src="' . $settings['tp_images_url'] . '/TPprint.gif" alt="" /></a>';

echo implode(" | ",$opts);


Third Error:
8: Undefined index: 9999
File: D:\Hosting\3105563\html\forum\Sources\TPortal.php
Line: 1490

Line 1490 block from TPortal.php (line 1490 starts $context['TPortal'..and ends ['category']];)
$current_comments=$row['comments'];
$context['TPortal']['current_category']=$context['TPortal']['catnames'][$row['category']];
if(!empty($mypage))
$context['page_title'] = $row['subject'];
else
$context['page_title'] = $context['TPortal']['current_category'];




G6Cad

Quick search for all three errors came up with this.

First Error [Bug]
http://www.tinyportal.net/index.php?topic=23888.0

Second Error [Bug]

Discussed in the Alpha team board and are related to the ADV Shoutbox and the bugs will be fixed by Storm.

Third Error [ Bug ]

http://www.tinyportal.net/index.php?topic=24255.0

They will be fixed in th next release or a future release of TP.


shelzmike

Hey, thanks for that - I swear I searched, but didn't come up with that stuff - I will try to do a better job next time before I ask. Thanks!

Mike

G6Cad

It's ok, sometimes it can be hard to find things. But most often, just copy the error and place it in the search box and it will show you the topics :)

chrissomebody

#4
Please make sure that you read this in its entirety before making any actions!
If you are using a code editor that shows you the line numbers:
The key to fixing line 922 single page errors is to change line 922 from
if($context['TPortal']['print_articles']==1 && $context['TPortal']['single_page'])

to:
if($context['TPortal']['print_articles']==1)

The key to fixing line 930 render errors is to change line 930 from
$render .= tp_rendermode($story);

to:
tp_rendermode($story);


If you are not using a code editor that shows line numbers, be careful! There are a lot of lines that look like this! The following shows a detailed solution for single_page errors on line: 922 and render errors on line: 930. The lines involved are the same to fix the single_page error in line 922 and the render error in line 930.

line 922 single_page errors can be fixed with the following:

find (it begins at line 905):

if(isset($story['options']['views']) || $story['is_boardnews'])
$opts[] = $story['views'] . ' ' . $txt['tp-views'];

if(isset($story['options']['comments']) || $story['is_boardnews']){
if($story['is_boardnews'] && ($story['comments']>1 || $story['comments']==0))
$what=$txt[110];
elseif($story['is_boardnews'] && $story['comments']==1)
$what=$txt[146];
else
$what='<a href="'.$scripturl.'?page='.$story['id'].'#tp-comment">'.$txt['tp-comments'].'</a>';

$opts[] = $story['comments'] . ' ' . $what ;
}
if(isset($story['options']['rating']))
$opts[] = $txt['tp-ratingaverage'] . ' ' . ($context['TPortal']['showstars'] ? (str_repeat('<img src="'.$settings['default_theme_url'].'/images/tinyportal/TPblue.gif" style="width: .7em; height: .7em; margin-right: 2px;" alt="" />', $story['rating_average'])) : $story['rating_average']) . ' (' . $story['rating_votes'] . ' ' . $txt['tp-ratingvotes'] . ')';


if($context['TPortal']['print_articles']==1 && $context['TPortal']['single_page'])
$opts[] = '<a href="' . $story['print_href'] . '"><img style="margin: 0 6px 0 6px;" src="' . $settings['tp_images_url'] . '/TPprint.gif" alt="" /></a>';

echo implode(" | ",$opts);

// render the text
echo '</div><div class="tp_articletext" style="font-size: 110%; padding-left: 10px;">';

$render .= tp_rendermode($story);


replace with:
if(isset($story['options']['views']) || $story['is_boardnews'])
$opts[] = $story['views'] . ' ' . $txt['tp-views'];

if(isset($story['options']['comments']) || $story['is_boardnews']){
if($story['is_boardnews'] && ($story['comments']>1 || $story['comments']==0))
$what=$txt[110];
elseif($story['is_boardnews'] && $story['comments']==1)
$what=$txt[146];
else
$what='<a href="'.$scripturl.'?page='.$story['id'].'#tp-comment">'.$txt['tp-comments'].'</a>';

$opts[] = $story['comments'] . ' ' . $what ;
}
if(isset($story['options']['rating']))
$opts[] = $txt['tp-ratingaverage'] . ' ' . ($context['TPortal']['showstars'] ? (str_repeat('<img src="'.$settings['default_theme_url'].'/images/tinyportal/TPblue.gif" style="width: .7em; height: .7em; margin-right: 2px;" alt="" />', $story['rating_average'])) : $story['rating_average']) . ' (' . $story['rating_votes'] . ' ' . $txt['tp-ratingvotes'] . ')';


if($context['TPortal']['print_articles']==1 )
$opts[] = '<a href="' . $story['print_href'] . '"><img style="margin: 0 6px 0 6px;" src="' . $settings['tp_images_url'] . '/TPprint.gif" alt="" /></a>';

echo implode(" | ",$opts);

// render the text
echo '</div><div class="tp_articletext" style="font-size: 110%; padding-left: 10px;">';

$render .= tp_rendermode($story);




For line 930 errors, find code (again, it begins at line 905):
if(isset($story['options']['views']) || $story['is_boardnews'])
$opts[] = $story['views'] . ' ' . $txt['tp-views'];

if(isset($story['options']['comments']) || $story['is_boardnews']){
if($story['is_boardnews'] && ($story['comments']>1 || $story['comments']==0))
$what=$txt[110];
elseif($story['is_boardnews'] && $story['comments']==1)
$what=$txt[146];
else
$what='<a href="'.$scripturl.'?page='.$story['id'].'#tp-comment">'.$txt['tp-comments'].'</a>';

$opts[] = $story['comments'] . ' ' . $what ;
}
if(isset($story['options']['rating']))
$opts[] = $txt['tp-ratingaverage'] . ' ' . ($context['TPortal']['showstars'] ? (str_repeat('<img src="'.$settings['default_theme_url'].'/images/tinyportal/TPblue.gif" style="width: .7em; height: .7em; margin-right: 2px;" alt="" />', $story['rating_average'])) : $story['rating_average']) . ' (' . $story['rating_votes'] . ' ' . $txt['tp-ratingvotes'] . ')';


if($context['TPortal']['print_articles']==1 && $context['TPortal']['single_page'])
$opts[] = '<a href="' . $story['print_href'] . '"><img style="margin: 0 6px 0 6px;" src="' . $settings['tp_images_url'] . '/TPprint.gif" alt="" /></a>';

echo implode(" | ",$opts);

// render the text
echo '</div><div class="tp_articletext" style="font-size: 110%; padding-left: 10px;">';

$render .= tp_rendermode($story);


replace with:
if(isset($story['options']['views']) || $story['is_boardnews'])
$opts[] = $story['views'] . ' ' . $txt['tp-views'];

if(isset($story['options']['comments']) || $story['is_boardnews']){
if($story['is_boardnews'] && ($story['comments']>1 || $story['comments']==0))
$what=$txt[110];
elseif($story['is_boardnews'] && $story['comments']==1)
$what=$txt[146];
else
$what='<a href="'.$scripturl.'?page='.$story['id'].'#tp-comment">'.$txt['tp-comments'].'</a>';

$opts[] = $story['comments'] . ' ' . $what ;
}
if(isset($story['options']['rating']))
$opts[] = $txt['tp-ratingaverage'] . ' ' . ($context['TPortal']['showstars'] ? (str_repeat('<img src="'.$settings['default_theme_url'].'/images/tinyportal/TPblue.gif" style="width: .7em; height: .7em; margin-right: 2px;" alt="" />', $story['rating_average'])) : $story['rating_average']) . ' (' . $story['rating_votes'] . ' ' . $txt['tp-ratingvotes'] . ')';


if($context['TPortal']['print_articles']==1 && $context['TPortal']['single_page'])
$opts[] = '<a href="' . $story['print_href'] . '"><img style="margin: 0 6px 0 6px;" src="' . $settings['tp_images_url'] . '/TPprint.gif" alt="" /></a>';

echo implode(" | ",$opts);

// render the text
echo '</div><div class="tp_articletext" style="font-size: 110%; padding-left: 10px;">';

tp_rendermode($story);




If you are having problems with line 922 AND 930, find code (begins at line 905):
if(isset($story['options']['views']) || $story['is_boardnews'])
$opts[] = $story['views'] . ' ' . $txt['tp-views'];

if(isset($story['options']['comments']) || $story['is_boardnews']){
if($story['is_boardnews'] && ($story['comments']>1 || $story['comments']==0))
$what=$txt[110];
elseif($story['is_boardnews'] && $story['comments']==1)
$what=$txt[146];
else
$what='<a href="'.$scripturl.'?page='.$story['id'].'#tp-comment">'.$txt['tp-comments'].'</a>';

$opts[] = $story['comments'] . ' ' . $what ;
}
if(isset($story['options']['rating']))
$opts[] = $txt['tp-ratingaverage'] . ' ' . ($context['TPortal']['showstars'] ? (str_repeat('<img src="'.$settings['default_theme_url'].'/images/tinyportal/TPblue.gif" style="width: .7em; height: .7em; margin-right: 2px;" alt="" />', $story['rating_average'])) : $story['rating_average']) . ' (' . $story['rating_votes'] . ' ' . $txt['tp-ratingvotes'] . ')';


if($context['TPortal']['print_articles']==1 && $context['TPortal']['single_page'])
$opts[] = '<a href="' . $story['print_href'] . '"><img style="margin: 0 6px 0 6px;" src="' . $settings['tp_images_url'] . '/TPprint.gif" alt="" /></a>';

echo implode(" | ",$opts);

// render the text
echo '</div><div class="tp_articletext" style="font-size: 110%; padding-left: 10px;">';

$render .= tp_rendermode($story);


replace with:
if(isset($story['options']['views']) || $story['is_boardnews'])
$opts[] = $story['views'] . ' ' . $txt['tp-views'];

if(isset($story['options']['comments']) || $story['is_boardnews']){
if($story['is_boardnews'] && ($story['comments']>1 || $story['comments']==0))
$what=$txt[110];
elseif($story['is_boardnews'] && $story['comments']==1)
$what=$txt[146];
else
$what='<a href="'.$scripturl.'?page='.$story['id'].'#tp-comment">'.$txt['tp-comments'].'</a>';

$opts[] = $story['comments'] . ' ' . $what ;
}
if(isset($story['options']['rating']))
$opts[] = $txt['tp-ratingaverage'] . ' ' . ($context['TPortal']['showstars'] ? (str_repeat('<img src="'.$settings['default_theme_url'].'/images/tinyportal/TPblue.gif" style="width: .7em; height: .7em; margin-right: 2px;" alt="" />', $story['rating_average'])) : $story['rating_average']) . ' (' . $story['rating_votes'] . ' ' . $txt['tp-ratingvotes'] . ')';


if($context['TPortal']['print_articles']==1)
$opts[] = '<a href="' . $story['print_href'] . '"><img style="margin: 0 6px 0 6px;" src="' . $settings['tp_images_url'] . '/TPprint.gif" alt="" /></a>';

echo implode(" | ",$opts);

// render the text
echo '</div><div class="tp_articletext" style="font-size: 110%; padding-left: 10px;">';

tp_rendermode($story);


If you are not sure that you are editing the proper code, make sure the second line (line 906) is:

if(isset($story['options']['views']) || $story['is_boardnews'])

and your last line (line 930) is:

$render .= tp_rendermode($story);

Edit:

To the TP staff: I just wanted to make sure that this fix isn't just a band-aid that will cause some other problem later.

Thanks, Chris
P.S.: You can see v1.0.5 beta 1 working flawlessly at:

http://www.talkkid.com/neighborhood

i am running articles and blocks containing html, bbc, and php (including adsense), and it works perfectly for everything now


This website is proudly hosted on Crocweb Cloud Website Hosting.