TextLinkAds Typo Sidebar Plugin

Based on “Displaying ads from TextLinkAds in a rails application”, here’s the first release of my typo sidebar plugin to display ads from TextLinkAds. The plugin uses typo built-in caching as I explained before.

Download

Download either textlinkadssidebar.zip or textlinkadssidebar.tgz.

Installation

Unzip (unzip textlinkadssidebar.zip) or untar (tar xzvf textlinkadssidebar.tgz) directly into the components/sidebars/ directory of your typo installation.

Configuration

Using the sidebar tab of the admin section of typo, you’ll find an Item named “Text-Link-Ads” on the left hand side.

Simply drag it to the right side where at the desired location (the higher the better!).

Enter a title for that section (here I use nanoRAILS Sponsors).

Fill in your XML KEY from the “Get ad code” section on TextLinkAds.

Enter your affiliate ID (so you can get paid for referrals).

Enter the text for the referral link (I have “Advertise on nanoRails”).

Click on the Publish Changes button.

Once you refresh your blog, you will have a TextLinkAds section.

Text Link Ads

6/15/06 update: to use in the trunk of typo (1055 currently), you will need textlinkadssidebar-1055.zip or textlinkadssidebar-1055.tgz.

The short of it is that sidebar plugins have changed quite a bit! You may be better off recreating from scratch using one of the available ones.

The longer story is that you no longer need a configure.rhtml. Instead, you use the setting helper to describe each setting. You need to subclass Sidebars::ComponentPlugin instead of Sidebars::Plugin. You also need to remove the configure method and the way you specify the display name and and the description is also done with a helper.

Oh yeah, the file content.rhtml is unchanged :D

Tags: , , , ,

20 Responses to “TextLinkAds Typo Sidebar Plugin”

  1. Frederic de Villamil June 10, 2006 at 11:47 pm #

    Hello,
    doesn’t seem to work with typo trunk. Too bad.

  2. Pascal June 10, 2006 at 11:47 pm #

    Sorry to hear that, Frederic.
    What kind of error are you getting?
    I’ll install a trunk version and try it late tonight.

  3. Frederic de Villamil June 10, 2006 at 11:47 pm #

    I drag it, but it doesn’t drop, staying in outer space, and when I try to save the sidebar, your plugin fields are set to null, and the whold sidebar crashes. I had to remove the plugin manually from the database.
    I’ll have a deeper look when I have time.

  4. Pascal June 10, 2006 at 11:47 pm #

    Hmm, ok. Anything in the log?

  5. Frederic de Villamil June 10, 2006 at 11:47 pm #

    Yes, sorry for the flood

    Processing SidebarController#set_active (for 82.225.38.5 at 2006-06-15 10:01:26) [POST]
    Session ID: 7e840102ffc01477ae41d68e1d830aa8
    Parameters: {“action”=>”set_active”, “controller”=>”admin/sidebar”, “active”=>["static-4", "static-11", "static-8", "textlinkads", "xml-13", "static-7", "static-10", "category-1", "archives-6", "tag-9"]}
    Rendering admin/sidebar/set_active
    Start rendering component ({:layout=>false, :controller=>Plugins::Sidebars::TextlinkadsController, :action=>”configure_wrapper”}):

    Processing TextlinkadsController#configure_wrapper (for 82.225.38.5 at 2006-06-15 10:01:26)

    ActionController::MissingTemplate (Missing template /home/www/fredericdevillamil.com/public/../config/../app/views/plugins/sidebars/textlinkads/configure.rhtml):
    /vendor/rails/actionpack/lib/action_controller/base.rb:1003:in `assert_existence_of_template_file’
    /vendor/rails/actionpack/lib/action_controller/base.rb:697:in `render_file’
    /vendor/rails/actionpack/lib/action_controller/base.rb:621:in `render_with_no_layout’
    /vendor/rails/actionpack/lib/action_controller/base.rb:742:in `render_without_layout’
    /vendor/rails/actionpack/lib/action_controller/base.rb:691:in `render_action’
    /vendor/rails/actionpack/lib/action_controller/base.rb:643:in `render_with_no_layout’
    /vendor/rails/actionpack/lib/action_controller/layout.rb:251:in `render_without_benchmark’
    /vendor/rails/actionpack/lib/action_controller/benchmarking.rb:53:in `render’
    /usr/lib/ruby/1.8/benchmark.rb:293:in `measure’
    /vendor/rails/actionpack/lib/action_controller/benchmarking.rb:53:in `render’
    /lib/sidebars/plugin.rb:212:in `configure_wrapper’
    /vendor/rails/actionpack/lib/action_controller/base.rb:910:in `perform_action_without_filters’
    /vendor/rails/actionpack/lib/action_controller/filters.rb:368:in `perform_action_without_benchmark’
    /vendor/rails/actionpack/lib/action_controller/benchmarking.rb:69:in `perform_action_without_rescue’
    /usr/lib/ruby/1.8/benchmark.rb:293:in `measure’
    /vendor/rails/actionpack/lib/action_controller/benchmarking.rb:69:in `perform_action_without_rescue’
    /vendor/rails/actionpack/lib/action_controller/rescue.rb:82:in `perform_action’
    /vendor/rails/actionpack/lib/action_controller/base.rb:381:in `process_without_filters’
    /vendor/rails/actionpack/lib/action_controller/filters.rb:377:in `process_without_session_management_support’
    /vendor/rails/actionpack/lib/action_controller/session_management.rb:117:in `process’
    /vendor/rails/actionpack/lib/action_controller/components.rb:71:in `process_with_components’
    /vendor/rails/actionpack/lib/action_controller/components.rb:137:in `component_response’
    /vendor/rails/actionpack/lib/action_controller/components.rb:108:in `render_component_as_string’
    /vendor/rails/actionpack/lib/action_controller/components.rb:169:in `component_logging_with_unfiltered_options’
    /lib/rails_patch/components.rb:10:in `component_logging’
    /vendor/rails/actionpack/lib/action_controller/components.rb:107:in `render_component_as_string’
    /vendor/rails/actionpack/lib/action_controller/components.rb:44:in `render_component’
    /app/views/admin/sidebar/_active.rhtml:7:in `_run_rhtml_admin_sidebar__active’
    /vendor/rails/actionpack/lib/action_view/base.rb:314:in `compile_and_render_template’
    /vendor/rails/actionpack/lib/action_view/base.rb:290:in `render_template’
    /vendor/rails/actionpack/lib/action_view/base.rb:249:in `render_file’
    /vendor/rails/actionpack/lib/action_view/base.rb:264:in `render’
    /vendor/rails/actionpack/lib/action_view/partials.rb:59:in `render_partial’
    /vendor/rails/actionpack/lib/action_controller/benchmarking.rb:33:in `benchmark’
    /vendor/rails/actionpack/lib/action_view/partials.rb:58:in `render_partial’
    /vendor/rails/actionpack/lib/action_view/base.rb:276:in `render’
    /vendor/rails/actionpack/lib/action_view/helpers/prototype_helper.rb:647:in `render’
    /vendor/rails/actionpack/lib/action_view/helpers/prototype_helper.rb:547:in `replace’
    /app/views/admin/sidebar/set_active.rjs:5:in `__bind_1150358486_803370′
    /vendor/rails/activerecord/lib/../../activesupport/lib/active_support/core_ext/object/extending.rb:44:in `instance_exec’
    /vendor/rails/actionpack/lib/action_view/helpers/prototype_helper.rb:377:in `initialize’
    /vendor/rails/actionpack/lib/action_view/helpers/prototype_helper.rb:669:in `update_page’
    /app/views/admin/sidebar/set_active.rjs:0:in `_run_rjs_admin_sidebar_set_active’
    /vendor/rails/actionpack/lib/action_view/base.rb:314:in `compile_and_render_template’
    /vendor/rails/actionpack/lib/action_view/base.rb:290:in `render_template’
    /vendor/rails/actionpack/lib/action_view/base.rb:249:in `render_file’
    /vendor/rails/actionpack/lib/action_controller/base.rb:699:in `render_file’
    /vendor/rails/actionpack/lib/action_controller/base.rb:621:in `render_with_no_layout’
    /vendor/rails/actionpack/lib/action_controller/layout.rb:251:in `render_without_benchmark’
    /vendor/rails/actionpack/lib/action_controller/benchmarking.rb:53:in `render’
    /usr/lib/ruby/1.8/benchmark.rb:293:in `measure’
    /vendor/rails/actionpack/lib/action_controller/benchmarking.rb:53:in `render’
    /vendor/rails/actionpack/lib/action_controller/base.rb:911:in `perform_action_without_filters’
    /vendor/rails/actionpack/lib/action_controller/filters.rb:368:in `perform_action_without_benchmark’
    /vendor/rails/actionpack/lib/action_controller/benchmarking.rb:69:in `perform_action_without_rescue’
    /usr/lib/ruby/1.8/benchmark.rb:293:in `measure’
    /vendor/rails/actionpack/lib/action_controller/benchmarking.rb:69:in `perform_action_without_rescue’
    /vendor/rails/actionpack/lib/action_controller/rescue.rb:82:in `perform_action’
    /vendor/rails/actionpack/lib/action_controller/base.rb:381:in `process_without_filters’
    /vendor/rails/actionpack/lib/action_controller/filters.rb:377:in `process_without_session_management_support’
    /vendor/rails/actionpack/lib/action_controller/session_management.rb:117:in `process’
    /vendor/rails/railties/lib/dispatcher.rb:38:in `dispatch’
    /vendor/rails/railties/lib/fcgi_handler.rb:150:in `process_request’
    /vendor/rails/railties/lib/fcgi_handler.rb:54:in `process!’
    /usr/lib/ruby/1.8/fcgi.rb:600:in `each_cgi’
    /usr/lib/ruby/1.8/fcgi.rb:597:in `each_cgi’
    /vendor/rails/railties/lib/fcgi_handler.rb:53:in `process!’
    /vendor/rails/railties/lib/fcgi_handler.rb:23:in `process!’
    /home/www/fredericdevillamil.com/public/dispatch.fcgi:24

    End of component rendering

    RuntimeError (Controller stack got out of kilter!):
    /app/models/blog.rb:110:in `after’
    /vendor/rails/actionpack/lib/action_controller/filters.rb:227:in `around_filter’
    /vendor/rails/actionpack/lib/action_controller/filters.rb:401:in `call_filters’
    /vendor/rails/actionpack/lib/action_controller/filters.rb:394:in `call_filters’
    /vendor/rails/actionpack/lib/action_controller/filters.rb:389:in `after_action’
    /vendor/rails/actionpack/lib/action_controller/filters.rb:369:in `perform_action_without_benchmark’
    /vendor/rails/actionpack/lib/action_controller/benchmarking.rb:69:in `perform_action_without_rescue’
    /usr/lib/ruby/1.8/benchmark.rb:293:in `measure’
    /vendor/rails/actionpack/lib/action_controller/benchmarking.rb:69:in `perform_action_without_rescue’
    /vendor/rails/actionpack/lib/action_controller/rescue.rb:82:in `perform_action’
    /vendor/rails/actionpack/lib/action_controller/base.rb:381:in `process_without_filters’
    /vendor/rails/actionpack/lib/action_controller/filters.rb:377:in `process_without_session_management_support’
    /vendor/rails/actionpack/lib/action_controller/session_management.rb:117:in `process’
    /vendor/rails/railties/lib/dispatcher.rb:38:in `dispatch’
    /vendor/rails/railties/lib/fcgi_handler.rb:150:in `process_request’
    /vendor/rails/railties/lib/fcgi_handler.rb:54:in `process!’
    /usr/lib/ruby/1.8/fcgi.rb:600:in `each_cgi’
    /usr/lib/ruby/1.8/fcgi.rb:597:in `each_cgi’
    /vendor/rails/railties/lib/fcgi_handler.rb:53:in `process!’
    /vendor/rails/railties/lib/fcgi_handler.rb:23:in `process!’
    /home/www/fredericdevillamil.com/public/dispatch.fcgi:24

  6. Pascal June 10, 2006 at 11:47 pm #

    Alright, after struggling to get the database to initialize correctly with the latest and greatest of typo, I got the plugin to work. Almost a rewrite. Let me know if that one works for you.

  7. Pascal June 10, 2006 at 11:47 pm #

    huh, spooky. You posted the stack trace, which is not going to be pretty in IE, I’m afraid. and I posted a working solution within the next minute. I call this almost perfect timing.

  8. Pascal June 10, 2006 at 11:47 pm #

    Ok, and as a bonus, I fixed the “flood” comment so that it doesn’t take over the whole page and used the “code” style.

  9. Frederic de Villamil June 10, 2006 at 11:47 pm #

    404… *sob*

  10. Pascal June 10, 2006 at 11:47 pm #

    Big OOPS :(
    Sorry about that. I fixed the name of the files (and I verified the links worked this time.

  11. Frederic de Villamil June 10, 2006 at 11:47 pm #

    great ! Thank you very much

  12. Frederic de Villamil June 10, 2006 at 11:47 pm #

    have you made a new version of your plugin that is compatible with typo new plugin architecture ? (plugins in /vendor/plugins/)

  13. Pascal June 10, 2006 at 11:47 pm #

    Not yet, and I won’t be able to look at it till next weekend because my DSL at home is being upgraded, and this seems to be a very painful and slow process :(

  14. Frederic de Villamil June 10, 2006 at 11:47 pm #

    Damn, it seems I’m not the only one who have DLS migration issues. My company has been using a RTC line since 2 days because of this. I’ll come back a little bit later.

  15. Pascal June 10, 2006 at 11:47 pm #

    Frederic, I have a newer version of my plugin available from [A new Rails plugin for TextLinkAds (including support for Feedvertising)](http://blog.nanorails.com/articles/2006/10/01/a-new-rails-plugin-for-textlinkads-including-support-for-feedvertising)

    This is no longer a typo plugin, so this should no longer break as typo plugin support gets improved.

    BTW, it took 5 days to get the new DSL from the time the first one was cut, but now the new 6Mbps is really kickass!

  16. Jason June 10, 2006 at 11:47 pm #

    A way to fix your flickr plugin on typo is here:

    http://www.dotrb.com/articles/2006/12/23/problem-with-the-flickr-sidebar-plugin-on-the-typo-blog

  17. Pascal June 10, 2006 at 11:47 pm #

    Thanks for the tip, Jason. This problem does not affect the TextLinkAds plugin, though.

  18. Jesse June 10, 2006 at 11:47 pm #

    I have Typo 4.0.3 (I believe that’s the latest stable). Text Link Ads don’t show up in the list of sidebar modules with the above instructions. Any suggestions?

  19. Pascal June 10, 2006 at 11:47 pm #

    Jesse, for typo 4.0.3, you should have better luck with the [new approach](http://blog.nanorails.com/articles/2006/10/01/a-new-rails-plugin-for-textlinkads-including-support-for-feedvertising) I took. It is a pure rails plugin, no longer specific to typo and will work in other apps such as Mephisto for example.

  20. Idetrorce June 10, 2006 at 11:47 pm #

    very interesting, but I don’t agree with you
    Idetrorce