News:

Wondering if this will always be free?  See why free is better.

Main Menu

Affiliates System

Started by Diego Andrés, December 04, 2008, 07:29:28 AM

Previous topic - Next topic

[unplugged]

That was one of the ways I had tried and could only ever get a single, but random, banner to show. No matter the number I set for the LIMIT, it would always just show one. I tried again just to make sure and it is the same result. Thank you very much for your time. I really appreciate it.
« Next Edit: Tomorrow at 08:34:45 PM by SunKing »   <---- « someone stole my sig... :o »



SA™

try this one

function ssi_random_affiliate()
{
   global $scripturl, $smcFunc;

$muliplayer_rrequest = $smcFunc['db_query']('', '
SELECT title, approved, id_affiliates, image
FROM {db_prefix}affiliates
WHERE  approved = 1
ORDER BY RAND()
LIMIT 6',
array(

)
);

$content = array();

while ($row = $smcFunc['db_fetch_assoc']($muliplayer_rrequest))
{
$content[] = array(
'title' => $row['title'],
'image' => $row['image'],
'id_affiliates' => $row['id_affiliates'],
'approved' => $row['approved'],
);
}
//return $content;

foreach ($content as $row)

echo' <a href="' . $scripturl . '?action=affiliates;sa=out;idaff=', $row['id_affiliates'],'"><img src="'.$row['image'].'" width="88" height="31" alt="'.$row['title'].'"></a>';
}
http://samods.github.io/SAChatBar/

Xbox Live: smokerthecheese 360 or xbone
My Work
Piano Movers / Delivery service
QuoteMy allies are dead.
I'm 'bout to be too.
Zombies are chasing me.
F*** it, I'm screwed -___-

[unplugged]

Now it shows nothing at all.
« Next Edit: Tomorrow at 08:34:45 PM by SunKing »   <---- « someone stole my sig... :o »



SA™

sry this one works jsut tested it

//random affiliates
function ssi_random_affiliate()
{
   global $scripturl, $smcFunc;

$muliplayer_rrequest = $smcFunc['db_query']('', '
SELECT title, approved, id_affiliates, image
FROM {db_prefix}affiliates
WHERE  approved = 1
ORDER BY RAND()
LIMIT 6',
array(

)
);

$content = array();

while ($row = $smcFunc['db_fetch_assoc']($muliplayer_rrequest))
{
$content[] = array(
'title' => $row['title'],
'image' => $row['image'],
'id_affiliates' => $row['id_affiliates'],
'approved' => $row['approved'],
);
}
//return $content;

foreach ($content as $row)

echo' <a href="' . $scripturl . '?action=affiliates;sa=out;idaff=', $row['id_affiliates'],'"><img src="'.$row['image'].'" width="88" height="31" alt="'.$row['title'].'"></a>';

}
http://samods.github.io/SAChatBar/

Xbox Live: smokerthecheese 360 or xbone
My Work
Piano Movers / Delivery service
QuoteMy allies are dead.
I'm 'bout to be too.
Zombies are chasing me.
F*** it, I'm screwed -___-

[unplugged]

Spot on bud. Thanks so much for your time! To make it easier to control the number of banners shown you can do it like this:

//random affiliates
function ssi_random_affiliate($limit)
{
   global $scripturl, $smcFunc;
   
   $rand_aff = $smcFunc['db_query']('', "
      SELECT title, approved, id_affiliates, image
      FROM {db_prefix}affiliates
      WHERE  approved = 1
   ORDER BY RAND()
    LIMIT $limit",
   array(
   
   )
);

   $content = array();
   
   while ($row = $smcFunc['db_fetch_assoc']($rand_aff))
   {     
      $content[] = array(
      'title' => $row['title'],
      'image' => $row['image'],
      'id_affiliates' => $row['id_affiliates'],
      'approved' => $row['approved'],
      );   
   }
      //return $content;
     
      foreach ($content as $row)
     
      echo' <a href="' . $scripturl . '?action=affiliates;sa=out;idaff=', $row['id_affiliates'],'"><img src="'.$row['image'].'" width="88" height="31" alt="'.$row['title'].'"></a>';
   
}


then just put how many banners you want showing inside the function like ssi_random_affiliate(12).
« Next Edit: Tomorrow at 08:34:45 PM by SunKing »   <---- « someone stole my sig... :o »



SA™

thanbks for the tip i was trying to figar that out but couldent thanks  ;)
http://samods.github.io/SAChatBar/

Xbox Live: smokerthecheese 360 or xbone
My Work
Piano Movers / Delivery service
QuoteMy allies are dead.
I'm 'bout to be too.
Zombies are chasing me.
F*** it, I'm screwed -___-

Chit-Chat ChatterBox Boss

Great work SunKing and sleepy ..... I might actually use this little trick you two figured out!

P.S.
Sorry I haven't been on your two sites lately I have been very busy with work, family ..... and now I got addicted to my old time MMORPG game again  ::) plus updating my site with a few things. I will be getting over to both your sites very soon!
Chit-Chat ChatterBox

Our site is open to everyone. It is a resource for anyone and everyone to talk about anything and everything you could possibly think of. It's a great place to come and talk, ask questions, or just simply hang out. We offer many great features. All we ask is that you follow by the site rules. Hope to see you around!
www.chitchatchatterbox.com
Remember in the "Referral" box to put "Caleb" while registering.

Chit-Chat ChatterBox Boss

Actually I just tried it on mine .... used the above code but its doing same exact as what it did before using that code... no change it isn't random any ideas?
Chit-Chat ChatterBox

Our site is open to everyone. It is a resource for anyone and everyone to talk about anything and everything you could possibly think of. It's a great place to come and talk, ask questions, or just simply hang out. We offer many great features. All we ask is that you follow by the site rules. Hope to see you around!
www.chitchatchatterbox.com
Remember in the "Referral" box to put "Caleb" while registering.

SA™

try ssi.php

find

unction ssi_random_affiliate()
{
   global $scripturl, $smcFunc;

$request = $smcFunc['db_query']('', "
SELECT
title, approved, id_affiliates, image
FROM {db_prefix}affiliates
WHERE  approved = 1
ORDER BY RAND()
");

$random = array();
$row = $smcFunc['db_fetch_assoc']($request);
censorText($row['title']);

$random[] = array(
'title' => '<a href="' . $scripturl . '?action=affiliates;sa=out;idaff=', $row['id_affiliates'],'">'.$row['title'].'</a>',
);
$smcFunc['db_free_result']($request);

foreach ($random as $affiliate)
echo' <a href="' . $scripturl . '?action=affiliates;sa=out;idaff=', $row['id_affiliates'],'"><img src="'.$row['image'].'" width="88" height="31" alt="'.$row['title'].'"></a>';
}


replace with

//random affiliates
function ssi_random_affiliate($limit)
{
   global $scripturl, $smcFunc;
   
   $rand_aff = $smcFunc['db_query']('', "
      SELECT title, approved, id_affiliates, image
      FROM {db_prefix}affiliates
      WHERE  approved = 1
   ORDER BY RAND()
    LIMIT $limit",
   array(
   
   )
);

   $content = array();
   
   while ($row = $smcFunc['db_fetch_assoc']($rand_aff))
   {     
      $content[] = array(
      'title' => $row['title'],
      'image' => $row['image'],
      'id_affiliates' => $row['id_affiliates'],
      'approved' => $row['approved'],
      );   
   }
      //return $content;
     
      foreach ($content as $row)
     
      echo' <a href="' . $scripturl . '?action=affiliates;sa=out;idaff=', $row['id_affiliates'],'"><img src="'.$row['image'].'" width="88" height="31" alt="'.$row['title'].'"></a>';
   
}


and call it like so

ssi_random_affiliate(12);

repalce twelve with how many you want


http://samods.github.io/SAChatBar/

Xbox Live: smokerthecheese 360 or xbone
My Work
Piano Movers / Delivery service
QuoteMy allies are dead.
I'm 'bout to be too.
Zombies are chasing me.
F*** it, I'm screwed -___-

Chit-Chat ChatterBox Boss

Right now I have this.


// Affiliates SSI Function
function ssi_affiliates()
{
global $scripturl, $smcFunc, $txt, $settings, $modSettings, $context;

loadLanguage('Stats');

$result = $smcFunc['db_query']('', '
SELECT a.id_affiliates, a.image, a.description
FROM {db_prefix}affiliates AS a
WHERE  approved = 1
ORDER BY a.id_affiliates DESC',
      array(
      )
   );
   $context['aff'] = array();
   while ($row = $smcFunc['db_fetch_assoc']($result))
   {
      $context['aff'][] = array(
        'id' => $row['id_affiliates'],
'image' => $row['image'],
'description' => $row['description'],
      );
   }
   $smcFunc['db_free_result']($result);
   
echo'<table border="0" width="100%" align="center" class="smfNews">
<tr><td><marquee direction="', empty($modSettings['scrolldirection']) ? 'left' : 'right', '" onmouseover="scrollAmount=', $modSettings['How_Fast_To_Scrollmo'],'" onmouseout="scrollAmount=', $modSettings['How_Fast_To_Scroll'],'">';

foreach ( $context['aff'] as $aff)
echo '
<a href="', $scripturl, '?action=affiliates;sa=out;idaff=', $aff['id'],'" target="_blank">
<img src="', $aff['image'],'"  width="88" height="31" alt="', $aff['description'],'" />';

echo'</marquee></td>
</tr>
</table>';
}
//random affiliates
function ssi_random_affiliate($limit)
{
   global $scripturl, $smcFunc;
   
   $rand_aff = $smcFunc['db_query']('', "
      SELECT title, approved, id_affiliates, image
      FROM {db_prefix}affiliates
      WHERE  approved = 1
   ORDER BY RAND()
    LIMIT $limit",
   array(
   
   )
);

   $content = array();
   
   while ($row = $smcFunc['db_fetch_assoc']($rand_aff))
   {     
      $content[] = array(
      'title' => $row['title'],
      'image' => $row['image'],
      'id_affiliates' => $row['id_affiliates'],
      'approved' => $row['approved'],
      );   
   }
      //return $content;
     
      foreach ($content as $row)
     
      echo' <a href="' . $scripturl . '?action=affiliates;sa=out;idaff=', $row['id_affiliates'],'"><img src="'.$row['image'].'" width="88" height="31" alt="'.$row['title'].'"></a>';
   
}
Chit-Chat ChatterBox

Our site is open to everyone. It is a resource for anyone and everyone to talk about anything and everything you could possibly think of. It's a great place to come and talk, ask questions, or just simply hang out. We offer many great features. All we ask is that you follow by the site rules. Hope to see you around!
www.chitchatchatterbox.com
Remember in the "Referral" box to put "Caleb" while registering.

SA™

http://samods.github.io/SAChatBar/

Xbox Live: smokerthecheese 360 or xbone
My Work
Piano Movers / Delivery service
QuoteMy allies are dead.
I'm 'bout to be too.
Zombies are chasing me.
F*** it, I'm screwed -___-

Chit-Chat ChatterBox Boss

It isn't changing anything all of it is showing as the same ..... they aren't scrolling in a random order ..... maybe I am stupid and thats not what it was supposed to do?
Chit-Chat ChatterBox

Our site is open to everyone. It is a resource for anyone and everyone to talk about anything and everything you could possibly think of. It's a great place to come and talk, ask questions, or just simply hang out. We offer many great features. All we ask is that you follow by the site rules. Hope to see you around!
www.chitchatchatterbox.com
Remember in the "Referral" box to put "Caleb" while registering.

SA™

to use the random affilite like i said im my other post

where ever you want it to display just add

ssi_random_affiliate(10);


you are using the
ssi_affiliates(); i guess ?

http://samods.github.io/SAChatBar/

Xbox Live: smokerthecheese 360 or xbone
My Work
Piano Movers / Delivery service
QuoteMy allies are dead.
I'm 'bout to be too.
Zombies are chasing me.
F*** it, I'm screwed -___-

Chit-Chat ChatterBox Boss

#313
Quote from: sleepy-arcade.ath.cx on June 08, 2009, 03:31:10 AM
to use the random affilite like i said im my other post

where ever you want it to display just add

ssi_random_affiliate(10);


you are using the
ssi_affiliates(); i guess ?

oh i have to go into the other sa affiliate files and whereever it is ssi_affiliates(); I have to change to  ssi_random_affiliate(10); ..... I want it to work on the boardindex scroll and SP so I will go edit them.

* Chit-Chat ChatterBox Boss feels retarded for not doing that before  :-[

~Edit
Only file I see ssi_affiliates();  in is  ./ssi_examples.php
Chit-Chat ChatterBox

Our site is open to everyone. It is a resource for anyone and everyone to talk about anything and everything you could possibly think of. It's a great place to come and talk, ask questions, or just simply hang out. We offer many great features. All we ask is that you follow by the site rules. Hope to see you around!
www.chitchatchatterbox.com
Remember in the "Referral" box to put "Caleb" while registering.

SA™

hmm chit lol im confused now what are  you trying to acomplesh lol

you dont need to touch ssi_examples.php all you need to do is add the aboe code to ssi.php then where you want it to be diplayed you just put

ssi_random_affiliate(10);

so if you wanted it in a portal block you add ssi_random_affiliate(10); to a php block
http://samods.github.io/SAChatBar/

Xbox Live: smokerthecheese 360 or xbone
My Work
Piano Movers / Delivery service
QuoteMy allies are dead.
I'm 'bout to be too.
Zombies are chasing me.
F*** it, I'm screwed -___-

Chit-Chat ChatterBox Boss

ah yes ok ... I wanted it to scroll ... where i having it scrolling on the boardindex and SP pages in a random order not always scrolling the same way everytime
Chit-Chat ChatterBox

Our site is open to everyone. It is a resource for anyone and everyone to talk about anything and everything you could possibly think of. It's a great place to come and talk, ask questions, or just simply hang out. We offer many great features. All we ask is that you follow by the site rules. Hope to see you around!
www.chitchatchatterbox.com
Remember in the "Referral" box to put "Caleb" while registering.

[unplugged]

I have this code placed in the infocenter section of my BoardIndex.template.php and it scrolls and displays in random order (on each page refresh):

echo '<marquee direction="', empty($modSettings['scrolldirection']) ? 'left' : 'right', '" onmouseover="scrollAmount=', $modSettings['How_Fast_To_Scrollmo'],'" onmouseout="scrollAmount=', $modSettings['How_Fast_To_Scroll'],'">';
ssi_random_affiliate(12);
echo '</marquee>';


As sleepy said, the 12 can be changed to any number of banners you want displayed. You can see it working here. (Refresh to see a random order.)
« Next Edit: Tomorrow at 08:34:45 PM by SunKing »   <---- « someone stole my sig... :o »



SA™

http://samods.github.io/SAChatBar/

Xbox Live: smokerthecheese 360 or xbone
My Work
Piano Movers / Delivery service
QuoteMy allies are dead.
I'm 'bout to be too.
Zombies are chasing me.
F*** it, I'm screwed -___-

Chit-Chat ChatterBox Boss

Chit-Chat ChatterBox

Our site is open to everyone. It is a resource for anyone and everyone to talk about anything and everything you could possibly think of. It's a great place to come and talk, ask questions, or just simply hang out. We offer many great features. All we ask is that you follow by the site rules. Hope to see you around!
www.chitchatchatterbox.com
Remember in the "Referral" box to put "Caleb" while registering.

Chit-Chat ChatterBox Boss

I have been trying to play with this now for a few days for the SP php block code. How would I get this random to work on that?


global $smcFunc, $context, $settings, $modSettings, $txt, $scripturl;

$result = $smcFunc['db_query']('', '
   SELECT a.id_affiliates, a.image, a.description
   FROM {db_prefix}affiliates AS a
   WHERE  approved = 1
   ORDER BY a.id_affiliates DESC'
   );

$affiliates = array();
while ($row = $smcFunc['db_fetch_assoc']($result))
{
   $affiliates[] = array(
      'id' => $row['id_affiliates'],
      'image' => $row['image'],
      'description' => $row['description'],
   );
}
$smcFunc['db_free_result']($result);

   echo '   
<marquee direction="', empty($modSettings['scrolldirection']) ? 'left' : 'right', '" onmouseover="scrollAmount=', $modSettings['How_Fast_To_Scrollmo'],'" onmouseout="scrollAmount=', $modSettings['How_Fast_To_Scroll'],'">';

   foreach ($affiliates as $item)
      echo '
      <a href="', $scripturl, '?action=affiliates;sa=out;idaff=', $item['id'],'" target="_blank">
   <img src="', $item['image'],'"  onload="ImageResizer.createOn(this);"  title="', $item['description'],'" alt="', $item['description'],'" /></a>';

   echo '
</marquee>';
Chit-Chat ChatterBox

Our site is open to everyone. It is a resource for anyone and everyone to talk about anything and everything you could possibly think of. It's a great place to come and talk, ask questions, or just simply hang out. We offer many great features. All we ask is that you follow by the site rules. Hope to see you around!
www.chitchatchatterbox.com
Remember in the "Referral" box to put "Caleb" while registering.

Advertisement: