Skip to Content Skip to Menu

Need help with Avatar Matrix .4 code

  • fusion93
  • fusion93
  • OFFLINE
  • Posts: 18
  • Thanks: 0
  • Karma: 0
16 years 7 months ago #58298 by fusion93
Need help with Avatar Matrix .4 code was created by fusion93
I'm having a problem displaying the Avatar Matrix module on my site. The module works fine except in IE (Firefox works fine) the module pushes my background down and messes it all up. The website template is xhtml and apparently from doing my research, all xhtml docs must have closed tags i.e. img tags etc. The problem is I'm not a php coder and I've been stuck on this for 3 days now and I really need some help. I know it should be really simple but I just can't figure it out. I've pasted the problem code from the w3 validator and also the php file that is used. I know that the "img" tags need to be closed in the php code, but I don't know how to adjust the code to do that. Would someone be able to tell me what adjustments I need to make in this code? Any help is extremely appreciated! :cheer:

p.s. I really like the .4 version of this avatar matrix over the .5 version as the other version I had a lot of problem with. .4 works great for what I need, except its destroying my top banner in IE when the module is published.

Line 117, Column 83: document type does not allow element "p" here; missing one of "object", "applet", "map", "iframe", "button", "ins", "del" start-tag.
[code:1]…&amp;task=userProfile&amp;user=68'><p>SarahB</p><img src ="http://hardtruthne[/code:1]

Line 117, Column 198: end tag for "img" omitted, but OMITTAG NO was specified.

[code:1]…be3784d77.jpg" alt="member image"></a></div>[/code:1]

Here is the original Avatar Matrix .4 code:

[code:1]<?php
/**
* The Avatar Matrix Module
* Copyright (C) 2006 Roger Davis, PhD, www.VisionSimulations.com
* All rights reserved
* Released under GNU/GPL License : www.gnu.org/copyleft/gpl.html
* Version 0.3 August 1, 2006
* Email Address: rogerdavis@gmail.com
**/

// CSS classes that can be used to format your Avatar Matrix are
// Whole table of results: <table class='rajavatarmatrixtable'>
// Odd rows of table: <tr class='rajavatarmatrixoddrow'>
// Even rows of table: <tr class='rajavatarmatrixevenrow'>
// Title of table: <p class='rajavatarmatrixtitle'>"
// When there are no search results: <tr class='rajavatarmatrixnoresults'>

defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
global $database;

$search = $params->get( 'search' );
$across = $params->get( 'across' );
$down = $params->get( 'down' );
$setcustomavatardimensions = $params->get( 'setcustomavatardimensions' );
$imageheight = $params->get( 'imageheight' );
$imagewidth = $params->get( 'imagewidth' );
$noavatarfilename = $params->get( 'noavatarfilename' );
$maxusernamelength = $params->get( 'maxusernamelength' );
$caption1 = $params->get( 'caption1' );
$caption2 = $params->get( 'caption2' );
$caption3 = $params->get( 'caption3' );
$captionheading1 = $params->get( 'captionheading1' );
$captionheading2 = $params->get( 'captionheading2' );
$captionheading3 = $params->get( 'captionheading3' );
$counter='';
$align='';

// Perform some bounds checking

if ($across<= 0 || $down<=0) {
echo "Across and down much be greater than zero!";
return;
}

// Below we ask whether the SQL that guides the search is supplied through the backend or along the URL.

switch ($search) {
case "1":
$query = $params->get( 'querystring1' );
$title = $params->get( 'searchtitle1' );
break;
case "2":
$query = $params->get( 'querystring2' );
$title = $params->get( 'searchtitle2' );
break;
case "3":
$query = $params->get( 'querystring3' );
$title = $params->get( 'searchtitle3' );
break;
case "4":
$query = $params->get( 'querystring4' );
$title = $params->get( 'searchtitle4' );
break;
case "5":
$query = $params->get( 'querystring5' );
$title = $params->get( 'searchtitle5' );
break;
case "6":
$query = $params->get( 'querystring6' );
$title = $params->get( 'searchtitle6' );
break;
case "7":
$query = $params->get( 'querystring7' );
$title = $params->get( 'searchtitle7' );
break;
case "8":
$query = $params->get( 'querystring8' );
$title = $params->get( 'searchtitle8' );
break;
case "9":
$query = $params->get( 'querystring9' );
$title = $params->get( 'searchtitle9' );
break;
case "10":
$query = $params->get( 'querystring10' );
$title = $params->get( 'searchtitle10' );
break;
default:
// if a value for search is passed other than 1 through 5 or url, then die.
die;
}

// Prebuild some strings for use later
$noavatarpath = "<img src =\"$mosConfig_live_site/components/com_comprofiler/plugin/language/default_language/images/";
$imagelink = "<img src =\"$mosConfig_live_site/images/comprofiler/tn";
$gallerylink = "<img src =\"$mosConfig_live_site/images/comprofiler/";
$profilelink = "<a href='index.php?option=com_comprofiler&amp;task=userProfile&amp;user=";
$rowcss = 1; // by multiplying by -1 for each row, we know whether its an odd or even row
$number = $across * $down; //we know how many profiles to try to retrieve from the database, since it's a matrix of profile avatars

// See if the user wants to set custom height or width for the avatars.
if ($setcustomavatardimensions == True ) {
if ($imagewidth != 0) $setwidth = " width=\"$imagewidth\""; //set image width
if ($imageheight != 0) $setheight = " height=\"$imageheight\""; // set image height
}

$Accumulator = "<table class='rajavatarmatrixtable'>";

////////////////////////////////////////////////////////////////////
//LOOKS LIKE WE'RE READY TO CONSTRUCT THE MATRIX!!!!!!!!!!!!!!!!!!
////////////////////////////////////////////////////////////////////

$query .= " LIMIT $number"; //we limit the search. Pass some rediculously large number to show the whole membership.
$database ->setQuery ($query);
$results = $database->loadObjectList();

if (empty($results)) {
echo "<p class='rajavatarmatrixnoresults'>" . "Sorry, no profiles found" . "</p>";
return;
}

foreach($results as $result){
if ($counter % $across == 0) { //if the remainder is 0, then we're at the beginning of a new row! else, just generate code for a table cell.
$rowcss = -$rowcss;
if ($rowcss == 1) { //we want to allow the admin to change the color of odd and even rows so that it's easier for users to digest the search results
$Accumulator .= "<tr class='rajavatarmatrixoddrow'><td>\n";
} else {
$Accumulator .= "<tr class='rajavatarmatrixevenrow'><td>\n";
}
}
else {
$Accumulator .= "<td" . $align . ">\n";
}

$avatarcaption1="";
$avatarcaption2="";
$avatarcaption3="";

if (empty($caption1)==false && is_null($result->$caption1)==false) $avatarcaption1 = "<p class='avatarcaption1'>" . $captionheading1 . $result->$caption1 . "</p>" ;
if (empty($caption2)==false && is_null($result->$caption2)==false) $avatarcaption2 = "<p class='avatarcaption2'>" . $captionheading2 . $result->$caption2 . "</p>" ;
if (empty($caption3)==false && is_null($result->$caption3)==false) $avatarcaption3 = "<p class='avatarcaption3'>" . $captionheading3 . $result->$caption3 . "</p>" ;

$imagefilename = $result->avatar;
if ($imagefilename==Null) $imagefilename= $noavatarfilename;
$imagefilename = $imagefilename . "\" alt=\"member image\"";
if ($imagewidth != 0) $imagefilename = $imagefilename . $setwidth;
if ($imageheight != 0) $imagefilename = $imagefilename . $setheight;

$query_name = "SELECT id,username FROM #__users WHERE id = ".$result->user_id;
$database ->setQuery ($query_name);
$usernames = $database->loadObjectList();

foreach($usernames as $username){
if (substr_count ( $imagefilename, $noavatarfilename)!=0) {
$profile = "<div>" . $profilelink . $result->id . "'><p>" . $username->username . "</p>" . $noavatarpath . $imagefilename . ">" . $avatarcaption1 . $avatarcaption2 . $avatarcaption3 . "</a></div>\n";
}
elseif(preg_match('/(gallery)/',$imagefilename)){
$profile = "<div>" . $profilelink . $result->id . "'><p>" . $username->username . "</p>" . $gallerylink . $imagefilename . ">" . $avatarcaption1 . $avatarcaption2 . $avatarcaption3 . "</a></div>\n";
}
elseif(preg_match('/(jpg)/',$imagefilename)){
$profile = "<div>" . $profilelink . $result->id . "'><p>" . $username->username . "</p>" . $imagelink . $imagefilename . ">" . $avatarcaption1 . $avatarcaption2 . $avatarcaption3 . "</a></div>\n";
}
elseif(preg_match('/(png)/',$imagefilename)){
$profile = "<div>" . $profilelink . $result->id . "'><p>" . $username->username . "</p>" . $imagelink . $imagefilename . ">" . $avatarcaption1 . $avatarcaption2 . $avatarcaption3 . "</a></div>\n";
}
elseif(preg_match('/(gif)/',$imagefilename)){
$profile = "<div>" . $profilelink . $result->id . "'><p>" . $username->username . "</p>" . $imagelink . $imagefilename . ">" . $avatarcaption1 . $avatarcaption2 . $avatarcaption3 . "</a></div>\n";
}
elseif(preg_match('/(bmp)/',$imagefilename)){
$profile = "<div>" . $profilelink . $result->id . "'><p>" . $username->username . "</p>" . $imagelink . $imagefilename . ">" . $avatarcaption1 . $avatarcaption2 . $avatarcaption3 . "</a></div>\n";
}
elseif(preg_match('/(jpeg)/',$imagefilename)){
$profile = "<div>" . $profilelink . $result->id . "'><p>" . $username->username . "</p>" . $imagelink . $imagefilename . ">" . $avatarcaption1 . $avatarcaption2 . $avatarcaption3 . "</a></div>\n";
}
elseif(preg_match('/(tif)/',$imagefilename)){
$profile = "<div>" . $profilelink . $result->id . "'><p>" . $username->username . "</p>" . $imagelink . $imagefilename . ">" . $avatarcaption1 . $avatarcaption2 . $avatarcaption3 . "</a></div>\n";
}
}

$Accumulator = $Accumulator . $profile;
$counter++; //keep track of the number of profiles written out

if ($counter % $across == 0) { //need to close the table row and/or table cell
$Accumulator .= "</td></tr>\n";
}
else {
$Accumulator .= "</td>\n";
}

if ($counter > $number) { //we've reached the maximum number of results to return, so break out of the for-each loop. note that we may not generate enough table cells to fill the last row, and this is okay.
break;
}
}

$Accumulator .= "</table>\n";

//display the results
if (empty($title) == false) echo "<p class='rajavatarmatrixtitle'>" . $title . "</p>";
echo $Accumulator;
return;

?>[/code:1]

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum