Go Back   NiceCoder Community Forums > Nicecoder Products > IndexU > Plugins

Notices

Closed Thread
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-05-2009, 08:15 AM
Active Member
 
Join Date: Nov 2007
Posts: 228
mpdaddy is on a distinguished road
Default Need help with new plugin

O.K. I give up and need help with a plugin I am currently working on. I have been trying to get this to work correctly for 2 weeks and I need some fresh eyes. Hopefully Bruce, one of the programmers, or someone else can help me solve this problem. This is a difficult one for me to put into words, by I'll give it a shot.

I am creating a banner rotation script from an idea I originally got from echo@. It stores the banner information in the database. When called for the first time, it records the users IP and the banner they were shown. The next time the page is called, it checks the database and selects a different banner than the one just displayed and updates the dabase with the new banner ID. It works flawlessly if I attach it to one html hook. However, if I attach it to more than 1 hook, it does not work correctly. Hopefully that is not too confusing, but if it is have a look for yourself.

INDEXU Deluxe - Link Management

On the front page, I have it attached to the hook "hook_html_index_welcome". You can refresh the page a million times and because I have 2 banners being displayed, it will display a different banner each time.

Now I also have it attached to the hook "hook_html_add_form_begin". Click on "Add a Listing" at the top of the page. You will see the banner near the top. Now refresh the page a couple of times. The banner is not rotating. Why?

If I remove either hook from the code, it displays perfectly on the 1 remaining hook. No matter which hooks I attach it to, if I have more than 1, it has this bug.

I already have the script set up to add, edit, and delete banners from the admin area. I would like to add the ability to add hooks from the admin area as well. I want to be able to display the banners from any hook location on multiple pages. With this bug, this plugin is almost useless unless you only want to attach it to 1 single file.

Please help me figure this one out. This could be a very useful plugin. If you need it, I can send the files so you can look it the code. I don't think it's in my code though, I think it's in the way IndexU handles the hooks in the plugins.

Regards
Wayne
__________________
For questions related to any mods I developed, please contact me by pm or email at webmaster [at] scriptdragon [dot] com
  #2 (permalink)  
Old 01-05-2009, 10:32 AM
FSGDAG's Avatar
Moderator
 
Join Date: May 2007
Location: NJ, United States
Posts: 1,687
FSGDAG is on a distinguished road
Default

Wayne...

I know nothing about this... But could it have anything to do with caching???
__________________
FSGDAG | IndexU Hosting | Owner
Website | NiceCoder Script Hosting and More! | Web4URL is For Sale!
Follow Us On Twitter | FaceBook Profile | YouTube Videos
  #3 (permalink)  
Old 01-05-2009, 11:28 AM
Administrator
 
Join Date: Jun 2002
Location: Winnipeg Canada
Posts: 4,978
Bruceper is on a distinguished road
Default

On the add.php the banner DID change for me. For the first couple of refreshes I saw the bash bosh banner 2 or 3 times and then the jbholcombe banner. Then I refreshed again and saw the bash bosh banner 2 times and then the jb banner once, after that it is now going back and forth.

I'm not a programmer, and you can gladly talk to the programmers about this, but I think the issue is related to the php session.

Perhaps what you need to do is to write a cookie as well. the cookie gets written with the LAST banner ID, the script checks it, compares it to the database and then writes the second banner ID. It keeps going until it reaches the end and starts the cycle back at the first banner.

Using this method, you could have zones (zone1=top, zone2=side etc) and you could count then all off and rotate all of them.
__________________
Apparently Dody didn't like my signature saying "not the admin" so he deleted it.
Did he not notice the fact that my title still says "administrator" and I haven't been the admin for months?
  #4 (permalink)  
Old 01-05-2009, 08:04 PM
Active Member
 
Join Date: Nov 2007
Posts: 228
mpdaddy is on a distinguished road
Default

The add.php page banner is occasionally changing but giving strange results in the database. When banner 1 displays, it enters banner 2 in the database and vice versa.

Also, if I clear the template_c folder after each refresh, it works perfectly. So FSGDAG may be somewhat close in saying that it has something to do with caching.

Using cookies for this is a great idea, I will try that if I get this problem solved.

I plan on using zones so you could set more than 1 banner per page.

What stumps me is why does it work perfectly when attached to 1 hook, but then gets this bug when I attach it to 2 or more hooks? If I remove it from the "hook_html_index_welcome" it works perfectly on the add.php page.

Regards
Wayne
__________________
For questions related to any mods I developed, please contact me by pm or email at webmaster [at] scriptdragon [dot] com
  #5 (permalink)  
Old 01-05-2009, 11:39 PM
Administrator
 
Join Date: Jun 2002
Location: Winnipeg Canada
Posts: 4,978
Bruceper is on a distinguished road
Default

Perhaps because plugins are cached by default (I don't know how to disable that) so that IndexU will run faster without having to include files each time a plugin is loaded.
__________________
Apparently Dody didn't like my signature saying "not the admin" so he deleted it.
Did he not notice the fact that my title still says "administrator" and I haven't been the admin for months?
  #6 (permalink)  
Old 01-06-2009, 12:38 AM
nakos's Avatar
Nicecoder Team
 
Join Date: Aug 2008
Posts: 49
nakos is on a distinguished road
Default

you could solve your problem by store your banner contents in the variable before you send to hook_html. for example

Code:
Content visible to registered users only. Please register at http://www.nicecoder.com/community/register.php
then the $idx_banner_html sent to hook_html, you also send the $random_banner to template by hook_php or your plugin script that handle it.

that is my logic. if you dont mind, could you share your script? may be i could help.
  #7 (permalink)  
Old 01-06-2009, 08:12 AM
Active Member
 
Join Date: Nov 2007
Posts: 228
mpdaddy is on a distinguished road
Default

Of course I can share it. I appreciate the help. I have attached the entire plugin to this post. The hooks for displaying the images/banners are on lines 147 & 178 of the image-rotator-plugin.php file.

I tried storing the banner contents in a variable before calling using something similar to:

Code:
Content visible to registered users only. Please register at http://www.nicecoder.com/community/register.php
Then I attached it to the hooks with:

Code:
Content visible to registered users only. Please register at http://www.nicecoder.com/community/register.php
I have tried a million different ways of doing that entire function. It was written, re-written, re-written, and on and on. I hope some fresh eyes will help.

If anyone else would like to try the plugin out, feel free to install it. Just keep in mind that it is not production ready and has not had extensive testing. If you want to try it out and give me your feedback or feature requests, that would be great. Please do not use it on a live site, use a test installation to test it.

After installing the plugin, there will be an added menu on the left in the admin area. The menu allows you to add, edit, and delete images. The only required field is the image itself, all others are optional.

Just remember, it's maybe only 70% done. I want to solve this problem before I waste my time on adding more features and cleaning up the code.

Regards
Wayne
Attached Files
File Type: zip image-rotator.zip (43.1 KB, 5 views)
__________________
For questions related to any mods I developed, please contact me by pm or email at webmaster [at] scriptdragon [dot] com
  #8 (permalink)  
Old 02-02-2009, 06:37 PM
echo@'s Avatar
Active Member
 
Join Date: Oct 2007
Location: UK Essex
Posts: 594
echo@ is on a distinguished road
Default

Nakos did you find the solution?

BTW this is a very very cool plugin even if it is 70% complete
__________________
____________________________
http://www.articleconveyer.com
Give Your Articles Exposure


  #9 (permalink)  
Old 02-02-2009, 07:22 PM
nakos's Avatar
Nicecoder Team
 
Join Date: Aug 2008
Posts: 49
nakos is on a distinguished road
Default

sorry, i have long time didn't visit this thread, i just downloaded the plugin.

i'll try.
  #10 (permalink)  
Old 02-03-2009, 12:35 AM
nakos's Avatar
Nicecoder Team
 
Join Date: Aug 2008
Posts: 49
nakos is on a distinguished road
Default

hello,

i have tried, there is weakness on hook_php_init, that is run before filtered, perhaps the process catched by RunPreFilter. then i tried to set hook on hook_php_add_begin, it work out.

for next version, i have added some hooks on lib.filter.php, you could download it from svn [http://nicecoder.com/svn/index.php?act=changeset&id=973].

if you have got the latest svn, let modify your code
from
Code:
Content visible to registered users only. Please register at http://www.nicecoder.com/community/register.php
to
Code:
Content visible to registered users only. Please register at http://www.nicecoder.com/community/register.php

Last edited by nakos; 02-03-2009 at 01:00 AM.
  #11 (permalink)  
Old 02-04-2009, 04:00 AM
Active Member
 
Join Date: Nov 2007
Posts: 228
mpdaddy is on a distinguished road
Default

Thank you nakos for helping out. I quit working on the plugin because I could not get this worked out, hopefully that will do the trick. Now I will see if I can finish it.

Regards
Wayne
__________________
For questions related to any mods I developed, please contact me by pm or email at webmaster [at] scriptdragon [dot] com
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Do you use the VB plugin? Bruceper Customers Lounge 16 03-13-2009 12:47 AM
Plugin HELP Rockyuk INDEXU DELUXE v1.x 3 01-01-2009 11:59 AM
More plugin hooks please mpdaddy INDEXU DELUXE v1.x 28 11-05-2008 12:56 AM
Plugin Ideas echo@ INDEXU DELUXE v1.x 1 10-06-2008 02:09 PM
Indexu to Vb plugin echo@ INDEXU DELUXE v1.x 1 09-26-2008 04:08 PM


All times are GMT -5. The time now is 09:29 AM.


Powered by vBulletin®
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO