Jump to content

[SOLVED] PHP Error


Recommended Posts

Hi. I have written a small PHP Script, but for some reason it does not seem to work properly. Every page I include it on returns a blank page... Here is the code...

 

<link type="text/css" href="modules/mod_yoo_login/mod_yoo_login.css.php" rel="stylesheet" />
<?php
error_reporting(0);
$jspath = JPATH_BASE.DS.'components'.DS.'com_community';
include_once($jspath.DS.'libraries'.DS.'core.php');
$avatarUrl = $user->getThumbAvatar();
$user = CFactory::getUser( $userid );
$name = $user->getDisplayName();
?>
<table border="0" cellspacing="0">
<tr>
<td>
<img src="<? echo $avatarUrl; ?>"/>
</td>
<td style="padding:5px">
<strong>
<span><? echo $name; ?></span>
</strong>
<hr />
<form action="index.php" method="post" name="login">
<span class="niftydefault" style="display: block;">
<span class="yoo-login">
<span class="logout">
<span class="logout-button-icon">
<button value="Logout" name="Submit" type="submit" title="Logout">Logout</button>
</span>
<input type="hidden" name="option" value="com_user" />
<input type="hidden" name="task" value="logout" />
<input type="hidden" name="return" value="aHR0cDovL2NvbGRjYXN0LmNvLnVrL2luZGV4LnBocA==" />
</span></span></span>
</form>
</td>
</tr>
</table>

 

Any ideas? I was thinking I may have the syntax wrong, but if I have then I cannot see where. Any help here would be very much appreciated.

Link to comment
https://forums.phpfreaks.com/topic/149381-solved-php-error/
Share on other sites

No, I will try that now, but I did manage to refine the error location to these lines... as when they are removed the page loads, obviously without the data that they feed...

 

$avatarUrl = $user->getThumbAvatar();
$user = CFactory::getUser( $userid );
$name = $user->getDisplayName();

 

I will try the error report now, thanks. :)

Link to comment
https://forums.phpfreaks.com/topic/149381-solved-php-error/#findComment-784546
Share on other sites

Nevermind, I fixed it... here was the problem...

 

I was trying to load

$avatarUrl = $user->getThumbAvatar();

 

Before

$user = CFactory::getUser($userid);

 

When it needed to second one to be loaded ready to use the data from it. A novice mistake, but thanks for your help :)

Link to comment
https://forums.phpfreaks.com/topic/149381-solved-php-error/#findComment-784550
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.