Cotonti / Open Source PHP Content Management FrameworkContent Management Framework

Forumlar / Cotonti / Extensions / Support / XSAffiliates, show more then 1 random image in index.tpl

DemptD
#1 2009-08-30 22:04
How can i do that?

Heres xsaff.index.php:

if (!defined('SED_CODE')) { die('Wrong URL.'); }
$sqlxsaff = sed_sql_query("SELECT * FROM $db_xsaff_aff WHERE aff_active='1' ORDER BY RAND() LIMIT 0,1");
$rowxsaff = sed_sql_fetcharray($sqlxsaff);

$t->assign("XSAFF_IMAGES", "<div class='centerall'><a href='plug.php?e=xsaff&m=redirect&id=".$rowxsaff['aff_id']."'><img src='plugins/xsaff/affimg/".sed_cc($rowxsaff['aff_img'])."' style='width:88px;height:31px;border:0px' alt='".sed_cc($rowxsaff['aff_desc'])."' /></a></div>");

?>
Kilandor
#2 2009-08-31 03:28
$sqlxsaff = sed_sql_query("SELECT * FROM $db_xsaff_aff WHERE aff_active='1' ORDER BY RAND() LIMIT 0,NUM_YOU_WANT_TO_SHOW");
while($rowxsaff = sed_sql_fetcharray($sqlxsaff))
{
	$t->assign("XSAFF_IMAGES", "<div class='centerall'><a href='plug.php?e=xsaff&m=redirect&id=".$rowxsaff['aff_id']."'><img src='plugins/xsaff/affimg/".sed_cc($rowxsaff['aff_img'])."' style='width:88px;height:31px;border:0px' alt='".sed_cc($rowxsaff['aff_desc'])."' /></a></div>");
	$t->parse("MAIN.XSAFF");
}

Just change NUM_YOU_WANT_TO_SHOW to how many you want to see, and add a new block(begin/end) around the tag called XSAFF
DemptD
#3 2009-08-31 04:08
i changed the number to 3 and did it like this in index.tpl:

<!-- BEGIN: AFF -->
{XSAFF_IMAGES}
<!-- END: AFF -->

Is that right? it didnt work, nothing showed up then.
Xerora
#4 2009-08-31 06:42
$sqlxsaff = sed_sql_query("SELECT * FROM $db_xsaff_aff WHERE aff_active='1' ORDER BY RAND() LIMIT 0,3");
while($rowxsaff = sed_sql_fetcharray($sqlxsaff))
{
	$t->assign("XSAFF_IMAGES" => "<div class='centerall'><a href='plug.php?e=xsaff&m=redirect&id=".$rowxsaff['aff_id']."'><img src='plugins/xsaff/affimg/".sed_cc($rowxsaff['aff_img'])."' style='width:88px;height:31px;border:0px' alt='".sed_cc($rowxsaff['aff_desc'])."' /></a></div>");
	$t->parse("MAIN.XSAFF");
}

Try that.

XSAFF_IMAGES wasn't getting assigned to anything in the previous post.
Kilandor
#5 2009-08-31 06:54
Th block shoulda been XSAFF not AFF Mine was fine => is only for when your using an array :)
DemptD
#6 2009-08-31 09:55
changed it to:

<!-- BEGIN: XSAFF -->
{XSAFF_IMAGES}
<!-- END: XSAFF -->

didnt work..

And with Xerora's modification the index wouldnt load :P
Xerora
#7 2009-08-31 11:18
ooops looked over it too quick :p