News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Banner Mod

Started by Midgard, December 10, 2004, 12:12:22 PM

Previous topic - Next topic

Grudge

Looks good, nice to see more people making mods! You should definetly package it up, it won't take too long but people will love you even more for it! What could be very cool (Though maybe too much), would be if people could "tag" the banner (For example have two groups 'top' and 'bottom') and use a function like this:

function showBanner($tag = '')
{
global $context, $db_prefix;

// Not loaded yet?
if (!isset($context['banners']))
{
$context['banners'] = array();
$loadbanner = db_query("
SELECT IMAGEURL, ALTTEXT, CLICKURL, TARGETWINDOW, TAG
FROM {$db_prefix}banners
ORDER BY rand() LIMIT 1",__FILE__, __LINE__);
while($row = mysql_fetch_assoc($loadbanner))
$context['banners'][$row['TAG']][] = array(
'image' => $row['IMAGEURL'],
'alt' => $row['ALTTEXT'],
'url' => $row['CLICKURL'],
'target' => $row['TARGETWINDOW']
);
}

// No banners with this tag?
if (empty($context['banners'][$tag]))
return;

else
{
echo '
<table width="100%" cellpadding="3" cellspacing="0">
<tr>
<td align="center" valign="middle">';

foreach($context['banners'][$tag] as $banner)
{
echo '<a href="' . $banner['url'] . '" target="' . $banner['target'] . '"><img border="0" alt="' . $banner['alt'] . '" src="' . $banner['image'] . '"></a>';
}
echo '
</td>
</tr>
</table>';
}
}


Have that in Subs.php, so it's always available. Then the user could display as many banners as they want, whereever on any page by calling showBanner in the template with the relevant 'tag'. So you could have a banner on the main page at the top, and one at the bottom, all controller by your mod. It's a great mod, I just thought I'd share my idea :)
I'm only a half geek really...

Midgard


Grudge

Yea, it would effectively allow people to group banners under different areas. For example, on this site the top banner may be called "top", we could then also have a banner at the bottom called "bottom", we then may have 4 little banners which appear in peoples inbox, and tag them all with "personal". You could even include SSI on your main page and have a tag called "main", and call the function from there. I think it would be a cool addition, but that's not to say what you haven't already done isn't great cause it is, just like to suggest new features for the future :)
I'm only a half geek really...

Midgard

i can 'tag' ... but i can't create "- Statistical informations (view and click)" feature. 'view' has work. but i can't click_count. please help me. thanks Grudge

Grudge

I'm a bit confused what you mean? Are you saying you've added some "tagging" stuff, but now you want to add a feature to count the clicks on a banner, which you can't work out? I can give you advice but I need to know exactly what you mean first :)
I'm only a half geek really...

Midgard

Quote from: Grudge on December 11, 2004, 03:50:52 AM
I'm a bit confused what you mean? Are you saying you've added some "tagging" stuff, but now you want to add a feature to count the clicks on a banner, which you can't work out? I can give you advice but I need to know exactly what you mean first :)

So sorry, i'm newbie on "english" :)

I will click-count create on clicking to an banner.

I click to banner and ...

Exp.:
query(UPDATE smf_banner SET VIEW = VIEW + 1 WHERE ID_BANNER = $bid",__FILE__,__LINK__);

But i can't this feature

Grudge

Right, you will need to make a function that redirects the user when they click on the banner. Instead of linking the banner to a URL direct, link it to:
index.php?action=bandirect;id=BANNER_ID

Then have bandirect direct to a function that does something like this:

function BannerRedirect()
{
  if (empty($_GET['id']))
    redirect;
  $_GET['id'] = (int) $_GET['id'];
  $req = db_query("SELECT URL HERE!");
  $url = mysql_fetch_assoc stuff....
  db_query("UPDATE banners SET VIEW = VIEW + 1 WHERE ID_BANNER = $_GET[id]");
  header('location: ' . $url);
  exit;
}

You'll have to fill in the rest but it gives the idea
I'm only a half geek really...

Midgard

Thanks grudge :) You are so good. Really

Midgard

i finish this job. and i can publish tomorrow. very well. i become like to package. I do to finish it all; after publish. thank you a.k.a Grudge. you've expended a lot of effort on this.

Snapshots on my local server: (so sorry, shots turkish, but it gives the idea)



Show an banner on my board index to bottom:




Banner managements:




New banner:




Delete banner:




Statistics:




Residue done. Coming soon.

Regards, Network

Peter Duggan

Looks like your images aren't showing here.

Grudge

I'm only a half geek really...

Jerry

Quote from: Peter Duggan on December 12, 2004, 09:39:09 AM
Looks like your images aren't showing here.
must be DNS problems?

Works fine for me though, this mod looks great. If only I had use for ads on my website. I might take it to use though ;)


- Jerry
Find me on:
Facebook
Twitter
PlanetSMF

"If all you look for is the negative in things, you will never see the positive."

porcupinepc

Hi Network


I edited/made the required files. All looked ok in the admin screen until i entered a URL for a banner:

I typed a /  after the .com so it would look like: http://www.porcupinepc.com/logo1.jpg [nofollow]  (banner image URL)

And when i tried to save, it went back to: http://www.porcupinepc.comlogo1.jpg  with out the /

Any ideas how to fix this?

Joe

Pause

Quote from: porcupinepc on December 12, 2004, 09:04:30 PM
Hi Network


I edited/made the required files. All looked ok in the admin screen until i entered a URL for a banner:

I typed a /  after the .com so it would look like: http://www.porcupinepc.com/logo1.jpg  (banner image URL)

And when i tried to save, it went back to: http://www.porcupinepc.comlogo1.jpg  with out the /

Any ideas how to fix this?

Joe
If it's actually on the same domain as your forums, then just put the logo1.jpg in your forums directory and put logo1.jpg without the http://www.porcupinepc.com - it might not work, but it's gotta be worth a shot :)
"You and me, inside that box, now." - The Doctor

Bite Fusion
Fusion Web Network
VG Fusion
Wrestling Fusion + Wrestling Fusion Forums

Bullcat Webhosting

I'am getting 3 errors in banner management ! :(

Notice: Use of undefined constant _blank - assumed '_blank' in /home/virtual/site22/fst/var/www/html/forum/Sources/Load.php(1090) : eval()'d code on line 76
Notice: Use of undefined constant _top - assumed '_top' in /home/virtual/site22/fst/var/www/html/forum/Sources/Load.php(1090) : eval()'d code on line 76
Notice: Undefined index: banner_replace in /home/virtual/site22/fst/var/www/html/forum/Sources/Load.php(1090) : eval()'d code on line 89

the first two are located in Banner.template.php but i dont know the solution for it !

!!


Wij ondersteunen SMF forums & safe mode staat uit.

porcupinepc

Thanks mattitude but i would like a proper fix. If its a code error that i did i would like to know how to fix it properly.

If anyone is using this program and knows how to correct my glitch. Please email me

Joe

[email protected]

Midgard

Banner Mod updated and packaged.

Please contribute and bug reports send to PM me.

Download from here and check-up:
Banner Mod v2.0

porcupinepc

Network

Where does the files BannerPdb.php and Banner_v2.0.mod and package-info.xml go?

Joe

Midgard

Quote from: porcupinepc on December 13, 2004, 12:20:20 PM
Network

Where does the files BannerPdb.php and Banner_v2.0.mod and package-info.xml go?

Joe

Hey Joe,

BannerPdb.php is sql queries
Banner_v2.0.mod is SMF modification file
package-info.xml is package information file

And you go to this URL "index.php?action=packageget"

Upload your banner package on from your local machine.

And apply mod. All done.

Advertisement: