MyBB Central
My Ad Manager v1.2 - Printable Version

+- MyBB Central (http://www.mybbcentral.com)
+-- Forum: Mybb 1.6x Series Topics (http://www.mybbcentral.com/forum-34.html)
+--- Forum: Mybb 1.6x Official Central Plugins and Hacks (http://www.mybbcentral.com/forum-35.html)
+--- Thread: My Ad Manager v1.2 (/thread-7733.html)

Pages: 1 2 3 4 5 6 7


RE: My Ad Manager v1.2 - dalawh - May 07, 2012

Surprised MyBBCentral does not have better support. I wasn't able to get the plugin working. I decided to use the plugin from yaldaram. Yaldaram's plugins work the same way, but it actually works and good support.


RE: My Ad Manager v1.2 - ExiledVip3r - May 22, 2012

Thanks, just what I'm looking for.

EDIT: Plugin doesn't work, won't display anything and by the looks of this thread has been broken for awhile with no support. <sarcasm>So glad I paid for this</sarcasm>


RE: My Ad Manager v1.2 - labrocca - May 22, 2012

Plugins works perfectly fine for latest MyBB version. I use it all the time with zero problems.

Please explain the issues you're having.


RE: My Ad Manager v1.2 - ExiledVip3r - May 22, 2012

(May 22, 2012, 09:04 PM)labrocca Wrote: Plugins works perfectly fine for latest MyBB version. I use it all the time with zero problems.

Please explain the issues you're having.

The html comment tokens the myads function looks for to replace with the ad code don't exist and the plugin does not insert these tokens into any template so the ads never get inserted.

I've since fixed the plugin myself by adding some code to insert these tokens into the templates.

As a side note recommendation from another programmer. I also replaced the pointless preg_replace() the plugin was using to do so the actual insertion. preg_replace() is for regex, the plugin needs no regex to do a simple literal text replace; str_replace() is much faster in this case.

PHP Code:
//New replacer
$page str_replace('<!-- start: footer -->','<!-- start: footer --><div class="footerad" align="center">'.$mybb->settings['footad'].'</div>',$page);
//Original replacer
$page preg_replace('#'.preg_quote('<!-- start: footer -->').'#'"<!-- start: footer --><div class=\"footerad\" align=\"center\">"$mybb->settings['footad'] ."</div>"$page); 

Top line is both easier to read and performs better. Both because the usage of str_replace over regex. Plus the fundamental difference between single and double quotes, which is bigger than most people realize. A string in double quotes has to be parsed, which makes your concatenating with it puzzling, while single quotes are not parsed and simply interpreted as is.

These are drops in the bucket sure, saving microseconds. These things add up however, and you should always aim for good code.


RE: My Ad Manager v1.2 - labrocca - May 23, 2012

Did you disable template comments in your settings? It's a default MyBB setting under "Server and Optimization Options" labeled "Output template start/end comments?".

Plugins works perfectly fine without your edits.


RE: My Ad Manager v1.2 - ExiledVip3r - May 23, 2012

(May 23, 2012, 02:27 AM)labrocca Wrote: Did you disable template comments in your settings? It's a default MyBB setting under "Server and Optimization Options" labeled "Output template start/end comments?".

Plugins works perfectly fine without your edits.

It is disabled, if the plugin relies so heavily on that you should mention it somewhere. And honestly it'd be better to be running off unique tokens rather than the built in template comments; Would perform the exact same and have better compatibility. Not like it's hard to implement, couple extra lines of code to insert the tokens into templates.

"Works perfectly fine" is one thing, doesn't mean it's well made.


RE: My Ad Manager v1.2 - Lieutenant Kitty - May 26, 2012

Thanks for this Labrocca, couldn't get my other ad plugins to work correctly, great plugin Smile


RE: My Ad Manager v1.2 - FBI - Jun 09, 2012

Just installed!
This plugin is works properly on latest MyBB 1.6.8 (with or without Output template start/end comments activated) Wink

I am thinking of idea about adding function displaying banner once at that day (by click close button/else). But tomorrow, it shows up again Smile
Maybe javascript reading cookies is the solution to reduce query..


RE: My Ad Manager v1.2 - creativefreak - Jun 10, 2012

Thanks Labrocca! It's working all fine!


RE: My Ad Manager v1.2 - gemmk1 - Jun 20, 2012

Just what i was looking for thank you so much