Форумы / Cotonti / Extensions / Top donations plugin

Kingsley
#1 06.06.2011 10:38

Hi,

Finally found the time to start with php, but im kinda stuck because i do not know where to look :(

I wrote a small plugin for displaying top 5 donations om the main. but it won't display the output for some reason, although the output is retreived. This is my code:

 

"<?PHP
/* ====================
[BEGIN_SED_EXTPLUGIN]
Code=recentdonations
Part=
File=recentdonations
Hooks=standalone
Tags= header.tpl {PLUGIN_RECENTDONATIONS}
Order=10
[END_SED_EXTPLUGIN]
==================== */

/**
 * Displays top5 latest donations
 *
 * @author Kingsley
 * @copyright Copyright (c) Madkings.nl 2011
 * @license BSD
 */


if (!defined('SED_CODE') || !defined('SED_PLUG')) { die('Wrong URL.'); }

// table where donations are
$donations ='cot_donations';

$sql1 = sed_sql_query("SELECT `donation_username`, `donation_date`, `donation_amount` FROM $donations ORDER BY donation_date DESC LIMIT 5");
$total1 = sed_sql_numrows($sql1);

$html .= '<table class="cells">';
while ($row = sed_sql_fetcharray($sql1))
{
    
    $html .= '<tr><td>'. $row['donation_username'].'</td>';
    $html .= '<td>'. $row['donation_date'].'</td>';
    $html .= '<td>'. $row['donation_amount'].'</td></tr>';
}
$html.= '</table>';

$t-> assign(array(
    "PLUGIN_RECENTDONATIONS" => $html,
));



?>

and the setup:

<?PHP
/* ====================
[BEGIN_SED_EXTPLUGIN]
Code=recentdonations
Name=Recent Donations
Description=Lists of latest donations
Version=0.1
Date=2011-june-03
Author=Kingsley
Copyright= Madkings.nl
Notes=BSD License
SQL=
Auth_guests=R
Lock_guests=W12345A
Auth_members=R
Lock_members=W12345A
[END_SED_EXTPLUGIN]

==================== */

/**
 * Displays lists of latest donations
 *
 * @author Kingsley
 * @copyright Copyright (c) Madkings.nl 2011
 * @license BSD
 */

defined('SED_CODE') or die('Wrong URL');

?>

Can some-one please tell me what I am overlooking? thank you



Mynt
#2 06.06.2011 11:13
I am a little rusty with PHP, so bare with me, have you tried just using array buckets instead to see if you can output the data in debug? $html .= ''. $row['donation_username'].''; $html .= ''. $row['donation_date'].''; $html .= ''. $row['donation_amount'].''; use $html .= ''. $row[0].''; $html .= ''. $row[1].''; $html .= ''. $row[2].''; ?
"I only sleep when I know I won't miss a thing."
Dayver
#3 06.06.2011 12:27
/* ====================
[BEGIN_SED_EXTPLUGIN]
...
Hooks=standalone
Tags= header.tpl {PLUGIN_RECENTDONATIONS}
...
[END_SED_EXTPLUGIN]
==================== */

ок may be

/* ====================
[BEGIN_SED_EXTPLUGIN]
...
Hooks=heder.tags
Tags= header.tpl {PLUGIN_RECENTDONATIONS}
...
[END_SED_EXTPLUGIN]
==================== */
Pavlo Tkachenko aka Dayver
Kingsley
#4 06.06.2011 13:31

oke, that broke my site :(

http://www.x-ecutionerz.com

How can I fix that?

Added 23 minutes later:

MEH

 

I dont understand. My localhost is a exact copy of my live site (only a couple of days difference between db backup). On my localhost the site keeps functioning (although no output is displayed from my plugin) but on my life site, it fucks it all up and breaks it..

 

Grrrrrrrrrr

 

*buys some fake breasts, puts em on, shaves beard and wiggles ass*

Help please :(

Отредактировано: Kingsley (06.06.2011 13:56, 12 лет назад)
Dayver
#5 06.06.2011 14:03

sorry

Hooks=header.tags
Pavlo Tkachenko aka Dayver
Kingsley
#6 06.06.2011 14:09

I know Dayver

I am certain it isn't caused by that typo, which I already had corrected myself..

Added 5 hours later:

bloody hell

 

the difference between || and &&

just overlooked that a thousand times :s

iz fixed now :)

Added 3 minutes later:

will tweak it and then I will release my first plugin LOL

Отредактировано: Kingsley (06.06.2011 19:21, 12 лет назад)
Dyllon
#7 06.06.2011 23:31
My only suggestion is: Dont put HTML in your plugins. Instead, assign tags to each of your variables ($row[donation_username] etc.). This way It will accommodate everyones needs for their templates. I'm posting this from my iPhone so it's hard to give you an example, but simply looking at another coders work is a great way to learn.
We are what we repeatedly do. Excellence then, is not an act, but a habit.
Kingsley
#8 07.06.2011 11:20

thought it to be a bit over the top for such a small plugin, but you're right, it's a good exercise..