GetSimple Support Forum
Random Ads - ver: 1.0 - Printable Version

+- GetSimple Support Forum (http://get-simple.info/forums)
+-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3)
+--- Forum: Plugins (http://get-simple.info/forums/forumdisplay.php?fid=13)
+--- Thread: Random Ads - ver: 1.0 (/showthread.php?tid=2136)

Pages: 1 2


Random Ads - ver: 1.0 - mikeh - 2011-09-02

Random Ads Plugin

This is a simple and easy to use plugin for displaying random ads, banners, or other content on your website.

You have the ability to create and manage categories and add ads (or other content) to those categories. You can also edit/delete ads and categories.

Click Here To Go To Extend Plugin Page

Installation:
  • Drag the RandomAds.php file to your plugins directory and navigate to 'pages->Random Ads' in your Admin Panel.
  • There is a help page within the admin panel to explain how to include the random ads in your template.


Screenshots:

View All Ads:

[Image: view.jpg]


Add New Ad:

[Image: add.jpg]


Manage Categories:

[Image: categories.jpg]


Help:

[Image: help.jpg]


Any suggestions to improve usability/functionality are appreciated.


Random Ads - ver: 1.0 - libygo - 2011-09-02

How work it ???
I install, but show only title, not content.


Random Ads - ver: 1.0 - libygo - 2011-09-02

libygo Wrote:How work it ???
I install, but show only title, not content.
it would be nice to add editor ($ toolbar) in the textarea


Random Ads - ver: 1.0 - mikeh - 2011-09-02

libygo Wrote:
libygo Wrote:How work it ???
I install, but show only title, not content.
it would be nice to add editor ($ toolbar) in the textarea

Thanks for your suggestion. I chose against this because I thought it might mess with formatting and spacing for the ads for inexperienced users.

Anyone else vote for ckeditor instead of plain textarea?


Random Ads - ver: 1.0 - libygo - 2011-09-02

mikeh Wrote:Thanks for your suggestion. I chose against this because I thought it might add some needed coding.
Anyone else vote for ckeditor instead of plain textarea?
But I do not understand how the plug-in work.
I create categories (news), after create ads (title, choose a category, writing content), and in template include: <?php display_ads('news'); ?>.
In site see only title, how show content?


Random Ads - ver: 1.0 - filupn - 2011-09-02

I could see myself using this to show random testimonials on a site...

mikeh Wrote:Any suggestions to improve usability/functionality are appreciated.

Here's some suggestions:
  • When saving an item and there is an error, such as no category chosen, all previously entered data is lost. Could you populate the form after the error with the previously entered data?
  • Since a user can't add a new item if there are no categories defined, it would be nice if the add new item form did not appear until there was at least one category. Instead there should be a message prompting the user to create a category first.
  • It would be nice to be able to change the category of an item after it's been saved.

None of these are biggies. Very nice for a first release!


Random Ads - ver: 1.0 - mikeh - 2011-09-02

mikeh Wrote:
libygo Wrote:
libygo Wrote:How work it ???
I install, but show only title, not content.
it would be nice to add editor ($ toolbar) in the textarea

Thanks for your suggestion. I chose against this because I thought it might add some needed coding.
Anyone else vote for ckeditor instead of plain textarea?

I have uploaded ver: 1.0 to Extend
  • Changed textareas to use CKeditor
  • Fixed issue where theme function was pulling title instead of content



Random Ads - ver: 1.0 - mikeh - 2011-09-02

libygo Wrote:
mikeh Wrote:Thanks for your suggestion. I chose against this because I thought it might add some needed coding.
Anyone else vote for ckeditor instead of plain textarea?
But I do not understand how the plug-in work.
I create categories (news), after create ads (title, choose a category, writing content), and in template include: <?php display_ads('news'); ?>.
In site see only title, how show content?

Just download the new copy and drag it to your plugins folder. It will immediately fix this problem. Sorry about that.


Random Ads - ver: 1.0 - libygo - 2011-09-02

Nice!!!
Plug-in opens great opportunities.
If in category 1 ads, does not want to work.
If some finish this plugin can replace components.
Good plugin, thanks.


Random Ads - ver: 1.0 - mikeh - 2011-09-02

libygo Wrote:Nice!!!
Plug-in opens great opportunities.
If in category 1 ads, does not want to work.
If some finish this plugin can replace components.
Good plugin, thanks.

Ver: 1.1 Uploaded To Extend
  • Fixed issue preventing first category to be used in theme



Random Ads - ver: 1.0 - filupn - 2011-09-02

filupn Wrote:I could see myself using this to show random testimonials on a site...

mikeh Wrote:Any suggestions to improve usability/functionality are appreciated.

Here's some suggestions:
  • When saving an item and there is an error, such as no category chosen, all previously entered data is lost. Could you populate the form after the error with the previously entered data?
  • Since a user can't add a new item if there are no categories defined, it would be nice if the add new item form did not appear until there was at least one category. Instead there should be a message prompting the user to create a category first.
  • It would be nice to be able to change the category of an item after it's been saved.

None of these are biggies. Very nice for a first release!

In addition, for people using it on client sites for things other than ads, it might be nice to be able to call the items something else. Maybe an option to input a custom name, such as "Testimonials". With that it'd be perfect!


Random Ads - ver: 1.0 - mikeh - 2011-09-02

filupn Wrote:
filupn Wrote:I could see myself using this to show random testimonials on a site...

mikeh Wrote:Any suggestions to improve usability/functionality are appreciated.

Here's some suggestions:
  • When saving an item and there is an error, such as no category chosen, all previously entered data is lost. Could you populate the form after the error with the previously entered data?
  • Since a user can't add a new item if there are no categories defined, it would be nice if the add new item form did not appear until there was at least one category. Instead there should be a message prompting the user to create a category first.
  • It would be nice to be able to change the category of an item after it's been saved.

None of these are biggies. Very nice for a first release!

In addition, for people using it on client sites for things other than ads, it might be nice to be able to call the items something else. Maybe an option to input a custom name, such as "Testimonials". With that it'd be perfect!

Good suggestion, i'll try and get to that tonight. My intentions were to make a random banner plugin but your right, it can be randomized anything.


Random Ads - ver: 1.0 - polyfragmented - 2011-09-02

Again, awesome work, Mike! Smile


Random Ads - ver: 1.0 - libygo - 2011-09-02

Hi!
Is problem:
If create category and in category create one ad, plug-in dont work.
If create two ads, work good.
You can change this?


Random Ads - ver: 1.0 - mikeh - 2011-09-02

libygo Wrote:Hi!
Is problem:
If create category and in category create one ad, plug-in dont work.
If create two ads, work good.
You can change this?

I will fix this issue. For now, I suggest if you want only 1 ad in a category, to make 2 identical ads.

Thanks


Random Ads - ver: 1.0 - [/root.] - 2011-09-05

Hi, thanks for the plugin.

Please add the function to enable/disable the ads Smile


Random Ads - ver: 1.0 - filupn - 2011-09-05

You can turn off the ads just by disabling the plugin in the GS admin.


Random Ads - ver: 1.0 - filupn - 2011-09-05

Or, do you mean enabling/disabling ads on an individual basis? Yes, I agree that would be useful.


Random Ads - ver: 1.0 - pchulpleusden - 2011-09-08

First of all thanks for this great plug-in, I was looking for one like this.

mikeh Wrote:
libygo Wrote:Hi!
Is problem:
If create category and in category create one ad, plug-in dont work.
If create two ads, work good.
You can change this?

I will fix this issue. For now, I suggest if you want only 1 ad in a category, to make 2 identical ads.

Thanks
A little bit of help on that one:

Replace the old function display_ads:
Code:
function display_ads($category)
{
    $ad_count = 0;
    if(file_exists(ADSDATAFILE))
    {    
        $category_file = getXML(ADSDATAFILE);
    }
    foreach($category_file->category as $category_name)
    {
        if($category_name->categoryname == $category)        
        {
                    
            foreach($category_name->ad as $ad_counter)
            {
                $ad_count++;
            }

            $category_array = xml2array($category_name);
                $ad_count = rand (0, ($ad_count - 1));
                echo $category_array['ad'][$ad_count]->contents;
    
        }
    }
    

}

With my new one and it should be working.

Code:
function display_ads($category)
{
    $ad_count = -1;
    if(file_exists(ADSDATAFILE))
    {    
        $category_file = getXML(ADSDATAFILE);
    }
    foreach($category_file->category as $category_name)
    {
        if($category_name->categoryname == $category)        
        {
            foreach($category_name->ad as $ad_counter)
            {
                $ad_count++;
            }
            $category_array = xml2array($category_name);
            
            if($ad_count===0){
                echo $category_array['ad']['contents'];
            }else{
                $ad_count = rand (0, ($ad_count));
                echo $category_array['ad'][$ad_count]->contents;
            }
        }
    }
    

}

I'm also working on an option to show more than just one ad on a page.


Random Ads - ver: 1.0 - reff - 2011-09-09

Hi guys
I cannot get the plugin working correctly. All tags inside of an advertisement's text seem to be processed by PHP's htmlspecialchars() function. That's why none of ADs are shown properly. But everything's OK if I enter regular text without HTML tags inside.
Can anyone help?


Random Ads - ver: 1.0 - andyash - 2011-09-12

reff Wrote:Hi guys
I cannot get the plugin working correctly. All tags inside of an advertisement's text seem to be processed by PHP's htmlspecialchars() function. That's why none of ADs are shown properly. But everything's OK if I enter regular text without HTML tags inside.
Can anyone help?
There is a bug which adds \ before " in the html tags (with each edit it adds many more) thus messing up the entire code. I have tried to to use it to show random images but it messes up all the code and the images don't show up. If I manually edit and correct the mistakes in the file random_ads.xml, everything works fine but I need to know how to fix this bug since the moment I add an Ad it will mess up the code again.


Random Ads - ver: 1.0 - rb42 - 2011-09-14

andyash Wrote:There is a bug which adds \ before " in the html tags (with each edit it adds many more) thus messing up the entire code. I have tried to to use it to show random images but it messes up all the code and the images don't show up. If I manually edit and correct the mistakes in the file random_ads.xml, everything works fine but I need to know how to fix this bug since the moment I add an Ad it will mess up the code again.

Oh, good, then it's not just me. I had this issue (or something really similar) with the events plug-in as well. IMG and link code get munged with the quotes and they show an error on my public-facing pages (you can view the url for an image and see clearly why it didnt work). I tried just the local path for images and full URLs and didnt have much luck. And when I return to edit an ad I've tried to put an image in (and saved it) the editor hangs.

I wondered if there was something in the way the plugin calls the editor or processes the results I could change, I mean, if the page editor also uses CKEditor and it doesent have this problem, can I just use the same code (more or less) inside the plugin?


Random Ads - ver: 1.0 - mikeh - 2011-09-14

andyash Wrote:
reff Wrote:Hi guys
I cannot get the plugin working correctly. All tags inside of an advertisement's text seem to be processed by PHP's htmlspecialchars() function. That's why none of ADs are shown properly. But everything's OK if I enter regular text without HTML tags inside.
Can anyone help?
There is a bug which adds \ before " in the html tags (with each edit it adds many more) thus messing up the entire code. I have tried to to use it to show random images but it messes up all the code and the images don't show up. If I manually edit and correct the mistakes in the file random_ads.xml, everything works fine but I need to know how to fix this bug since the moment I add an Ad it will mess up the code again.

can you please provide me an example of coding where it does this too?


Random Ads - ver: 1.0 - pchulpleusden - 2011-09-14

I've rewrote the file which now works as far as I know good. Futher I changed the XML-file, I know find it more structured but that's my opinion. There is also an option to change the amount of ads you want to show, but they don't show correct in all layouts. So you may have to make some changes by yourself if it doesn't show correctly. The only thing you have to do is change $number_ads and it shows as many ads you want. I hope it works correctly now, the problem above is also corrected in this file.


Random Ads - ver: 1.0 - Suikerklontje - 2011-11-16

The plugin works fine! Thanks ...

I miss only the timer, now with every new page load or refresh to get a new ad. Suppose I have 3 seconds to show an advertisement and then the following should be shown.

This is already possible by modifying code in the plugin or must be built. Is a missed option.