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

Recent

Welcome to TinyPortal. Please login or sign up.

April 19, 2024, 04:14:43 AM

Login with username, password and session length
Members
  • Total Members: 3,885
  • Latest: Growner
Stats
  • Total Posts: 195,164
  • Total Topics: 21,219
  • Online today: 266
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 0
  • Guests: 235
  • Total: 235

[SOLVED] Undefined Index : modSettings

Started by alan s, August 22, 2008, 12:11:20 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

alan s

SMF version: SMF 1.1.5
TP version: 1.0 beta 1
Theme name and version: SMF Default with a few colour modifications

Okay , So filling the error logs when someone goes to the index page ( index.php ) Which displays articles in this case , is the error

Quote
8: Undefined variable: modSettings
File: /home/bimeiden/domains/bimeiden.nl/public_html/Themes/default/TPBlocks.template.php(52) : eval()'d code
Linel: 122

I have look in TPBlocks.template.php and there is no $modSettings on line 122 , just a "}"

I have also done a search and cannot find any other reports of this problem.

IchBin

Any custom code in articles or blocks? I get at least a page or 2 in the search for this. Make sure you search from the main search page and not just within a single board.

alan s

There are 2 bits of custom code in the blocks , Only plain text/images in articles.

Code 1 , upcoming members birthdays displays there age , username and avatar.


echo '<style type="text/css">
<!--
div.scroll {
height: 200px;
width: 160px;
overflow: auto;
padding: 6px;
}
-->
</style> ';

echo '<div class="scroll">';
/*
Upcoming Member Birthdays With Avatar & Age
August 10, 2008 / Tim Antley / www.BayouMX.com
- updated to display avatars per request (Blouogies)
- updated with option to display age or not

Script for retrieving upcoming member birthdays for current month.
Calculates age and links to profile by member's name.
Admin can justify output to the left, center, or right by $justify variable.

Optional: Can list birthdays by month specified in URL; use ?month=xx
Optional: Can parse birthdays from certain day to end of month; use ?day=xx
Optional: Specify justification through URL; ?justify=right
Optional: Set number of birthdays to return; ?limit=5 (defaults to list all)
Optional: Use avatar display; can also set max height & width
Optional: Display of member's age

Note: In order to use both URL options, the second and following parameters
MUST use an ampersand (&) instead of a question mark.
Example: list_birthdays.php?month=7&day=15  << Will list from the 15th to end of July.

Does not parse URL parameters for valid input; i.e. month #13 = nothing!
Nobody reads all this!
*/
$current_date = getdate();
$month_number = sprintf("%02d", $current_date['mon']);

$justify = 'left'; // Valid options: 'left', 'center', or 'right'
$limit = 0; // Integer value for length of list

$avatar_on = true; // Use avatar in output: true or false
$avatar_height = '45'; // Set height of avatar
$avatar_width = '45'; // Set width of avatar
$blank_image = 'http://www.bimeiden.nl/plaatjes/blank_1x1.gif'; // URL to where you placed the blank avatar file...

$display_age = true; // Display member's age: true or false

// Warranty void if edited past this line!  ;)

if(!empty($_GET['justify'])) $justify = $_GET['justify'];
if(!empty($_GET['limit'])) $limit = $_GET['limit'];
if(!empty($_GET['month'])) $month_number = $_GET['month'];
if(!empty($_GET['day'])) $current_date['mday'] = $_GET['day'];

if($limit == 0) $count = -1;

global $db_prefix, $scripturl;

    $query = db_query(
    "SELECT ID_MEMBER, memberName, birthdate
     FROM {$db_prefix}members
     WHERE birthdate LIKE '%-%$month_number%-%'
     AND birthdate NOT LIKE '0001-01-01'
     ORDER BY birthdate ASC", __FILE__, __LINE__);

while (($row = mysql_fetch_array($query)) && ($count < $limit))
{
if($limit != 0) $count++;

if(empty($row['birthdate'])) return;

$dob_year = strtok($row['birthdate'], '-');
$dob_month = strtok('-');
$dob_day = strtok('-');
$age = sprintf("%2d", ($current_date['year'] - $dob_year));

if($current_date['mday'] <= $dob_day)
{
if($current_date['mday'] == $dob_day)
{
$class = 'highlight';
}
else
{
$class = '';
}

$current_ID = $row['ID_MEMBER'];

$avatar = '';

if($avatar_on) // query to retrieve member's avatar # in attachment directory; bypass if avatar_on = false
{

$avatar = '<img src="' . $blank_image . '" height="' . $avatar_height . '" width=" '. $avatar_width . '" border="0" />';

$query2 = db_query(
"SELECT ID_ATTACH
FROM {$db_prefix}attachments
WHERE ID_MEMBER = '$current_ID'", __FILE__, __LINE__);

$result = mysql_fetch_array($query2);

if(!empty($result['ID_ATTACH']))
{
$avatar = '<img src="' . $scripturl . '?action=dlattach;attach=' . $result['ID_ATTACH'] .
';type=avatar" height="' . $avatar_height . '" width=" '. $avatar_width . '" border="0" />';
}
else
{
$query3 = db_query(
"SELECT avatar
FROM {$db_prefix}members
WHERE ID_MEMBER = '$current_ID'", __FILE__, __LINE__);

$result = mysql_fetch_array($query3);

if(!empty($result['avatar']))
{
$avatar = '<img src="' . $modSettings['avatar_url'] . '/' . $result['avatar'] . '" height="' .
$avatar_height . '" width=" '. $avatar_width . '" border="0" />';
}
}
}

$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">';

if($display_age)
{
$age = ' (' . $age . ') ';
}
else
{
$age = ' ';
}

if(strtolower($justify) == 'left')
{
echo'<div class="smalltext" align="left"><span class="'.$class.'">';
echo $link . $avatar . '</a>' . $age . $link . $row['memberName'] . '</a>';
echo '</span></div>';
}
elseif(strtolower($justify) == 'right')
{
echo'<div class="smalltext" align="right"><span class="'.$class.'">';
echo $link . $row['memberName'] . '</a>';
echo $age . $link . $avatar . '</a></span></div>';
}
elseif(strtolower($justify) == 'center')
{
echo'<div class="smalltext" align="center"><span class="'.$class.'">';
echo $link . $avatar . '</a> ' . $link . $row['memberName'] . '</a>';
echo $age . '</span></div>';
}
else
{
echo '<b>Invalid justification specified: ("'.$justify.'")</b><br>';
echo 'Use "left", "center", or "right" for script.<hr>';
die();
}
}
}
echo '</div>';


Code 2 , Emebeds a clock into a block


<center><embed src="http://www.anubiscreations.be/klokjes/clock11.swf" width="126" height="126" wmode="transparent" type="application/x-shockwave-flash" quality="high">
</embed></center>


Thanks

- Alan

Ianedres

AlanS,

Try putting $modSetting after the global statement in the birthday snippet I wrote.

Something like:
global $db_prefix, $scripturl, $modSetting;

and see if that cures the error you are getting.

alan s

I have tried that , The error still appears.

Thanks

- Alan

Ianedres

Haven't forgotten about you... just been very busy.

Looking it over, it almost looks to be too simple- but I suggested $modSetting and omitted the trailing 's' from the variable. Also, php is case-sensitive, so be sure to place the capital 'S' in the middle.

Will be on stand-by while you try this suggestion.  ???

alan s


Ianedres

Good to know that fixed it. Will marked as [SOLVED]...  8)