![]()
|
|
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
Fatal error: PHP notice in file /var/www/virtual/plugins.tvorwa.de/htdocs/wcf/templates/compiled/29_0_1_teamlist.php (87): Trying to get property of non-object
Information:
error message: PHP notice in file /var/www/virtual/plugins.tvorwa.de/htdocs/wcf/templates/compiled/29_0_1_teamlist.php (87): Trying to get property of non-object
error code: 0
file: /var/www/virtual/plugins.tvorwa.de/htdocs/wcf/lib/system/WCF.class.php (281)
php version: 5.3.3-7+squeeze13
wcf version: 1.1.9 (Tempest)
date: Sat, 28 Jul 2012 02:31:37 +0000
request: /index.php?page=AboutUs&
referer: http://plugins.tvorwa.de/
Stacktrace:
#0 /var/www/virtual/plugins.tvorwa.de/htdocs/wcf/templates/compiled/29_0_1_teamlist.php(87): WCF::handleError(8, 'Trying to get p...', '/var/www/virtua...', 87, Array)
#1 /var/www/virtual/plugins.tvorwa.de/htdocs/wcf/lib/system/template/Template.class.php(267): include('/var/www/virtua...')
#2 /var/www/virtual/plugins.tvorwa.de/htdocs/wcf/lib/page/AbstractPage.class.php(100): Template->display('teamlist')
#3 /var/www/virtual/plugins.tvorwa.de/htdocs/wcf/lib/page/AbstractPage.class.php(46): AbstractPage->show()
#4 /var/www/virtual/plugins.tvorwa.de/htdocs/wcf/lib/util/RequestHandler.class.php(64): AbstractPage->__construct()
#5 /var/www/virtual/plugins.tvorwa.de/htdocs/wcf/lib/util/RequestHandler.class.php(92): RequestHandler->__construct('AboutUs', Array, 'page')
#6 /var/www/virtual/plugins.tvorwa.de/htdocs/index.php(8): RequestHandler::handle(Array)
#7 {main}
|
|
|
Source code |
1 |
{if $user_id < 0}<img alt="" src="{@RELATIVE_WCF_DIR}images/{$avatar}" /></div>{else}{$user_id->user->GetAvatar()}{/if}
|

also verschiedene userIch wollte um setzen das wenn die user_id > 0 ist der Avatar des User geladen wird. Also auch von einem anderen User. Nur hab ich Probleme bei der Umsetzung
|
|
PHP Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
//wcf imports
...
require_once(WCF_DIR.'lib/data/user/UserProfile.class.php');
class .... {
public $userProfiles = null;
public $defaultAvatar = "....";
....
public function getUsers() {
$userProfiles = array();
$sql = "SELECT userID
FROM wcf1_user
WHERE ...";
$result = WCF::getDB()->sendQuery($sql);
while($row = WCF::getDB()->fetchArray($result)) {
$userProfiles[] = new UserProfile($row['userID']);
}
}
...
public function assignVariables() {
parent::assignVariables();
WCF::getTPL()->assign(array(
'userProfiles' => $userProfiles,
'defaultAvatar' => $defaultAvatar
));
}
...
}
|
|
|
Template source code |
1 2 3 |
{foreach from=userProfiles item=userProfile} <img src="{if $userProfile->userID > 0}$userProfile->getAvatar(){else}{@RELATIVE_WCF_DIR}images/{$defaultAvatar}{/if}" alt=""/> {/foreach} |
|
|
PHP Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
<?php
// wcf imports
require_once(WCF_DIR.'lib/page/AbstractPage.class.php');
require_once(WCF_DIR.'lib/page/util/menu/HeaderMenu.class.php');
require_once(WCF_DIR.'lib/data/user/UserProfile.class.php');
HeaderMenu::setActiveMenuItem('wcf.header.menu.aboutus');
class AboutUsPage extends AbstractPage {
public $templateName = 'teamlist';
public $AboutUsData;
public $AboutUsStructure;
public $Position;
public $maxPositionData;
public $userProfiles = null;
public function readParameters() {
parent::readParameters();
if (isset($_GET['category'])) $this->categoryID = intval($_GET['category']);
}
public function getUsers() {
$userProfiles = array();
$sql = "SELECT userID FROM wcf1_user";
$result = WCF::getDB()->sendQuery($sql);
while($row = WCF::getDB()->fetchArray($result)) {
$this->userProfiles[] = new UserProfile($row['userID']);
}
}
public function readData() {
$sql = "SELECT * FROM wcf".WCF_N."_aboutus_category";
$result = WCF::getDB()->sendQuery($sql);
$row = WCF::getDB()->fetchArray($result);
$this->category = $row['categoryName'];
$this->categoryDescription = $row['categoryDescription'];
}
public function assignVariables() {
parent::assignVariables();
$this->getMaxPosition();
$this->getData();
$this->getUsers();
WCF::getTPL()->assign(array(
'groups' => $this->AboutUsStructure,
'members' => $this->AboutUsData,
'maxPositionData' => $this->maxPositionData,
'maxPositionStructure' => $this->maxPositionStructure,
'userProfiles' => $this->userProfiles,
));
}
protected function getMaxPosition() {
$sql = "SELECT c_id, showOrder FROM wcf".WCF_N."_aboutus_category ORDER BY showOrder ASC";
$result = WCF::getDB()->sendQuery($sql);
$this->maxPositionStructure = WCF::getDB()->countRows($result);
while ($row = WCF::getDB()->fetchArray($result)) {
$this->Position[] = $row;
}
if($this->Position){
foreach ($this->Position as $key => $data){
$sql = "SELECT m_id FROM wcf".WCF_N."_aboutus_member WHERE c_id =".$data['c_id'];
$result = WCF::getDB()->sendQuery($sql);
$this->maxPositionData[] = WCF::getDB()->countRows($result);
}
}
}
protected function makeStructure() {
$sql = "SELECT * FROM wcf".WCF_N."_aboutus_category ORDER BY showOrder ASC";
$result = WCF::getDB()->sendQuery($sql);
while ($row = WCF::getDB()->fetchArray($result)) {
$this->AboutUsStructure[] = $row;
}
}
protected function getData() {
$this->makeStructure();
if ($this->AboutUsStructure){
foreach ($this->AboutUsStructure as $key => $data){
$sql = "SELECT * FROM wcf".WCF_N."_aboutus_member WHERE c_id =".$data['c_id']." ORDER BY showOrder ASC";
$result = WCF::getDB()->sendQuery($sql);
while ($row = WCF::getDB()->fetchArray($result)) {
$this->AboutUsData[] = $row;
/*if($this->AboutUsData[]->u_id > 0){
$sql = "SELECT * FROM wcf".WCF_N."_user WHERE userID = ".$this->AboutUsData[]->u_id;
$result1 = WCF::getDB()->sendQuery($sql);
while ($row1 = WCF::getDB()->fetchArray($result1)) {
$this->AboutUsData[]->avatar = new Avatar($row["avatarID"]);
}
}*/
}
}
}
}
}
?>
|
|
|
Template source code |
1 2 3 4 5 6 |
{foreach from=$userProfiles item=userProfile} {if $userProfile->userID == $user_id} {@$userProfile->getAvatar()} {/if} {/foreach} {if $user_id == 0}<img src="{@RELATIVE_WCF_DIR}images/{$avatar}" alt=""/>{/if} |
Forum Software: Burning Board® 3.1.7, developed by WoltLab® GmbH