SimplePortal

Customization => Blocks and Modifications => Block Requests => Topic started by: Enko on May 08, 2011, 10:54:34 AM

Title: Custom Block Affiliates
Post by: Enko on May 08, 2011, 10:54:34 AM
Hello there!

need a little help here.

I want to get the right codec to have this block:

http://www.chileanime.cl/

I am talking about the left block called Affiliates

any help will be appreciated
Title: Re: Custom Block Affiliates
Post by: grafitus on May 09, 2011, 03:02:17 PM
You can use this in PHP block:
Code: [Select]
$affiliates = array(
array(
'title' => 'Web Warez',
'url' => 'http://www.virtualwarez.es',
'image' => 'http://i53.tinypic.com/ogaz50.png',
),
array(
'title' => 'Blog de Misumi',
'url' => 'http://misumi.com.ar/',
'image' => 'http://misumi.no-ip.biz/imagenes/proyectosmisumi-88x31.gif',
),
);

echo '

<marquee behavior="scroll" align="center" direction="up" scrollamount="2" scrolldelay="20" onmouseover="this.stop()" onmouseout="this.start()">
<div style="text-align: center;">';
foreach ($affiliates as $affiliate)
echo '
<a href="', $affiliate['url'], '"', (isset($affiliate['title']) ? ' title="' . $affiliate['title'] . '"' : ''), '><img src="', $affiliate['image'], '" alt="', (isset($affiliate['title']) ? $affiliate['title'] : ''), '" /></a>';
echo '
</div>
</marquee>';
Title: Re: Custom Block Affiliates
Post by: Enko on May 09, 2011, 11:43:04 PM
thank you very much, it works!

sir, can you tell me how can I add more banners?
Title: Re: Custom Block Affiliates
Post by: AngelinaBelle on May 10, 2011, 12:24:31 PM
If, by "banners", you mean more of those images that scroll in the marquee, here is how:
For each affiliates item you wish to add, you will need a title, URL, and image url.
Then you will create an array like the first one grafitus created for you. You can see how he filled in the title, url, and image for you:
Code: [Select]
   array(
      'title' => 'Web Warez',
      'url' => 'http://www.virtualwarez.es',
      'image' => 'http://i53.tinypic.com/ogaz50.png',
   )

Next, you list them all inside the affiliates array. You can see that the array definition begins with '(' and ends with ')'. And, inside the affiliates array $affiliates=array( ........   ), you have a list of these arrays. There is a comma "," after each element in the list of arrays.

So, for each affiliate, add another array to the list of arrays in the big $affiliates array.

This might sound confusing if you are new to php. So why don't you give it a try for one of the banners you wish to add. Someone will be happy to let you know if you've done it right.
After you do 1 or 2, you'll get the hang of it, I'm sure.
Title: Re: Custom Block Affiliates
Post by: Enko on May 12, 2011, 12:22:50 PM
thank you, AngelinaBelle
SimplePortal 2.3.8 © 2008-2024, SimplePortal