TinyPortal

Started by lurkalot, February 12, 2005, 04:43:00 AM

Previous topic - Next topic

Kindred

When the error is.  The tpsubs file, it is almost always due to a badly coded portal block
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

stog

thx all

yes i have now unchecked the 'evaluate templates' and now get

http://www.xxx.com/index.php?
8: Undefined variable: modSettings
File: /home/xxx/user/htdocs/Themes/default/languages/GoogleMap.english.php (tp_below sub template - eval?)
Line: 42


looking at member map -- it seems to be working fine

line 42 is $txt['googleMap_DefaultZoom'] = 'The default Zoom Level';

any ideas thx so far
appreciated

Illori

that is from a different mod, you would need to post in that mods support topic.

stog

ok i have just turned off a few php code blocks that i had been playing with, and sure enough the error has gone so it seems that it is indeed a dodgy code block that is causing this ; i wonder if someone can spot what the problem is with the php code  thx again

the code is for top posters of the month (was week), and i was trying to prevent the user's profile name link from duplicating the domain when clicked.
ie www.xx.com/profile/... was linking as www.xx.com/http://www.xx.com/profile/..

global $smcFunc, $scripturl, $context, $settings;

// Top 10 Posters so far this week  (starts sunday)
$starttime = mktime() - 30 * 3600 * 24; 
// Offset based on forum time
$starttime = forum_time(false, $starttime);
// Limit of top posters
$limit = 8;
// Height and width of avatar

$width = '40px';
$height = '40px';

$request = $smcFunc['db_query']('', '
SELECT mem.id_member, mem.real_name, COUNT(*) as count_posts, mem.avatar, a.id_attach, a.attachment_type, a.filename
FROM {db_prefix}messages AS m
LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)
LEFT JOIN {db_prefix}attachments AS a ON (a.id_member = mem.id_member)
WHERE m.poster_time > {int:start_time}
AND m.id_member != 0
AND mem.show_online = 1
GROUP BY mem.id_member
ORDER BY count_posts DESC
LIMIT {int:limit}',
array(
'start_time' => $starttime,
'limit' => $limit
)
);

$context['top_posters'] = array();
$max_num_posts = 1;
while ($row = $smcFunc['db_fetch_assoc']($request))
{
$context['top_posters'][] = array(
'name' => $row['real_name'],
'id' => $row['id_member'],
'num_posts' => $row['count_posts'],
'href' => $scripturl . '?action=profile;u=' . $row['id_member'],
'link' => '<a href="http://www.fibsboard.com/' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['real_name'] . '</a>',
'avatar' => array(
'image' => empty($row['avatar']) ? ($row['id_attach'] > 0 ? 'src="' . (empty($row['attachment_type']) ? $scripturl . '?action=dlattach;attach=' . $row['id_attach'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) . '" alt="" border="0" width="'.$width.'" height="'.$height.'" title="'.$row['real_name'].'" />' : '') : (stristr($row['avatar'], 'http://') ? 'src="' . $row['avatar'] . '" alt="" border="0" width="'.$width.'" height="'.$height.'" title="'.$row['real_name'].'" />' : 'src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($row['avatar']) . '" alt="" border="0" width="'.$width.'" height="'.$height.'" title="'.$row['real_name'].'" />'),
),
);

if ($max_num_posts < $row['count_posts'])
$max_num_posts = $row['count_posts'];
}
$smcFunc['db_free_result']($request);

foreach ($context['top_posters'] as $i => $j)
$context['top_posters'][$i]['post_percent'] = round(($j['num_posts'] * 100) / $max_num_posts);

// Tidy up
unset($max_num_posts, $row, $j, $i);

// Output our array of users with avatar, posts, and name
echo '
<table cellpadding="0" cellspacing="8">';

foreach ($context['top_posters'] as $user)
{
echo '
<tr>
<td>',empty($user['avatar']['image']) ? '<a href="http://www.xx.com/'.$user['href'].'"><img src="'.$settings['images_url'].'/noavatar.gif" width="'.$width.'" height="'.$height.'" alt="" title="' . $user['name'] . '" /></a>' : '<a href="http://www.xx.com/' . $user['href'] . '"><img ' . $user['avatar']['image']. '</a>';
echo '
</td>
<td><h5 style="margin: 4px;">' . $user['link'] . '</h5><h5 style="margin: 4px;">' . $user['num_posts'] . '</h5></td>
</tr>';
}

echo '
</table>';


i tried removing the link at href, but after saving it would re-appear

<td>',empty($user['avatar']['image']) ? '<a href="'.$user['href'].'"><img src="'.$settings['images_url'].'/noavatar.gif" width="'.$width.'" height="'.$height.'" alt="" title="' . $user['name'] . '" /></a>' : '<a href="' . $user['href'] . '"><img ' . $user['avatar']['image']. '</a>';

either way the block is causing the error?

any help appreciated

many thx

Shambles

Well, the answer is in the code block you posted. You didn't globalise $modSettings.

Code (Find & Replace) Select
global $smcFunc, $scripturl, $context, $settings, $modSettings;

stog

#2205
thx very much! sorted errors gone (the trials of a copy/paste php newbie!)

thx again  -- wierd how when template error was unchecked -- the error  pointed to membermap? -->answer perhaps (Shambles noticed "$modSettings isn't globalised in add_settings.php (not that it matters at runtime)".

also any ideas how i can get the poster to link to the poster profile correctly in my code block btw

sry about this

Shambles

You already have the linkages set up... just delete some spurious stuff

Code (replace) Select
global $smcFunc, $scripturl, $context, $settings, $modSettings;

// Top 10 Posters so far this week  (starts sunday)
$starttime = mktime() - 30 * 3600 * 24; 
// Offset based on forum time
$starttime = forum_time(false, $starttime);
// Limit of top posters
$limit = 8;
// Height and width of avatar

$width = '40px';
$height = '40px';

$request = $smcFunc['db_query']('', '
SELECT mem.id_member, mem.real_name, COUNT(*) as count_posts, mem.avatar, a.id_attach, a.attachment_type, a.filename
FROM {db_prefix}messages AS m
LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)
LEFT JOIN {db_prefix}attachments AS a ON (a.id_member = mem.id_member)
WHERE m.poster_time > {int:start_time}
AND m.id_member != 0
AND mem.show_online = 1
GROUP BY mem.id_member
ORDER BY count_posts DESC
LIMIT {int:limit}',
array(
'start_time' => $starttime,
'limit' => $limit
)
);

$context['top_posters'] = array();
$max_num_posts = 1;
while ($row = $smcFunc['db_fetch_assoc']($request))
{
$context['top_posters'][] = array(
'name' => $row['real_name'],
'id' => $row['id_member'],
'num_posts' => $row['count_posts'],
'href' => $scripturl . '?action=profile;u=' . $row['id_member'],
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['real_name'] . '</a>',
'avatar' => array(
'image' => empty($row['avatar']) ? ($row['id_attach'] > 0 ? 'src="' . (empty($row['attachment_type']) ? $scripturl . '?action=dlattach;attach=' . $row['id_attach'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) . '" alt="" border="0" width="'.$width.'" height="'.$height.'" title="'.$row['real_name'].'" />' : '') : (stristr($row['avatar'], 'http://') ? 'src="' . $row['avatar'] . '" alt="" border="0" width="'.$width.'" height="'.$height.'" title="'.$row['real_name'].'" />' : 'src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($row['avatar']) . '" alt="" border="0" width="'.$width.'" height="'.$height.'" title="'.$row['real_name'].'" />'),
),
);

if ($max_num_posts < $row['count_posts'])
$max_num_posts = $row['count_posts'];
}
$smcFunc['db_free_result']($request);

foreach ($context['top_posters'] as $i => $j)
$context['top_posters'][$i]['post_percent'] = round(($j['num_posts'] * 100) / $max_num_posts);

// Tidy up
unset($max_num_posts, $row, $j, $i);

// Output our array of users with avatar, posts, and name
echo '
<table cellpadding="0" cellspacing="8">';

foreach ($context['top_posters'] as $user)
{
echo '
<tr>
<td>',empty($user['avatar']['image']) ? '<a href="'.$user['href'].'"><img src="'.$settings['images_url'].'/noavatar.gif" width="'.$width.'" height="'.$height.'" alt="" title="' . $user['name'] . '" /></a>' : '<a href="' . $user['href'] . '"><img ' . $user['avatar']['image']. '</a>';
echo '
</td>
<td><h5 style="margin: 4px;">' . $user['link'] . '</h5><h5 style="margin: 4px;">' . $user['num_posts'] . '</h5></td>
</tr>';
}

echo '
</table>';

stog

brill really appreciate your help and everyone else's too

smf ---> giving software a good name cheers

Nory

Hello,

Little question, Is it possible to disable tinyportal on smartphones?

landyvlad

Nory - why? 

Have you tried the responsive beta version of TP ?
(more info on this on the TP forum)
I am running that, it seems very stable, and looks good on the mobile.
"Put as much effort into your question as you'd expect someone to give in an answer"

Please do not PM, IM or Email me with questions on astrophysics or theology.  You will get better and faster responses by asking homeless people in the street. Thank you.

Be the person your dog thinks you are.

Nory

Hello,

QuoteHave you tried the responsive beta version of TP ?
I don't know that!

I don't find link, could you give me?

landyvlad

Sorry Nory I didn't see your post earlier.  Hopefully someone has let you know by now, but if not:

the setting to access the public beta should be found under your profile.

For full details on how to go about it, have a read of this thread: 
http://www.tinyportal.net/index.php?topic=35780.0

Cheers  :)
"Put as much effort into your question as you'd expect someone to give in an answer"

Please do not PM, IM or Email me with questions on astrophysics or theology.  You will get better and faster responses by asking homeless people in the street. Thank you.

Be the person your dog thinks you are.

Nory

Hello,

Thank you, it's very good version.

ATAG

It works! Thank you very mutch! I've used this mod for 8 years... excellent =)

SaltedWeb

Hi there, I have tried about 8 times to access support on your site and even tried three browsers.
I read the article " blart " etc and it keeps saying they are the wrong answers.
I get having those questions its yours site I get it, but wow how annoying that is to do this 8 times and
have it not working properly. Trying to find some directions on the portal.
Any help getting to that information would be appreciated.
SW
Knowing your limitations makes you human, exceeding these limitations makes you worthy of being human.

lurkalot

Quote from: SaltedWeb on November 26, 2017, 10:55:11 PM
Hi there, I have tried about 8 times to access support on your site and even tried three browsers.
I read the article " blart " etc and it keeps saying they are the wrong answers.
I get having those questions its yours site I get it, but wow how annoying that is to do this 8 times and
have it not working properly. Trying to find some directions on the portal.
Any help getting to that information would be appreciated.
SW

Apologies for the problem.  I have sent you a PM, hopefully it should help you.

pepa

If I have a donate button on another website (not SMF) can I use this portal to display that same button in a SMF?  If so, how do I do that?

-Rock Lee-

Quote from: pepa on November 28, 2017, 11:49:44 PM
If I have a donate button on another website (not SMF) can I use this portal to display that same button in a SMF?  If so, how do I do that?

What you need to do is create a custom block and add the line of the button to use it, generally paypal comes a php that works without problems (the times you use the clear method).


Regards!
¡Regresando como cual Fenix! ~ Bomber Code
Ayudas - Aportes - Tutoriales - Y mucho mas!!!

lurkalot

Quote from: pepa on November 28, 2017, 11:49:44 PM
If I have a donate button on another website (not SMF) can I use this portal to display that same button in a SMF?  If so, how do I do that?

If I remember correctly, you should be able to grab the paypal donate button code which they provide, and dump it in a HTML / JavaScript block.

The one I have at the bottom of my photography site works ok.  ;)

SaltedWeb

Quote from: pepa on November 28, 2017, 11:49:44 PM
If I have a donate button on another website (not SMF) can I use this portal to display that same button in a SMF?  If so, how do I do that?
Didn't see a PM in my Box waited a few days, ended up going with a different Portal , thanks though.
Knowing your limitations makes you human, exceeding these limitations makes you worthy of being human.

Advertisement: