Hi everybody,

I've developed an extension that display a list of links taken from a 
database table in a page of my site called links.

By clicking on the title of a link a "singlelink" page will be opened.

In this page  is displayed a description of the link.
To select the single link I've created two tags.

This tag pass the "link id" by the URL and another tag get the id from 
the URL and select the record from the db table.

This is the code of my tags:

tag "links:each:link_to_single" do |tag|
   curURL = request.request_uri
   %{<a 
href="#{curURL}/singlelink?id=#{tag.locals.lnk.id}">#{tag.locals.lnk.site_name}</a>}
  end

 tag "links:single" do |tag|
    content = ''
     curId = request.params['id']
     lnk = Link.find_by_id curId
     tag.locals.lnk = lnk
     content << tag.expand
    content
  end

With these tags I form an url like: /en/singlelink?id=2

It works well, but now I've got problems with the cache. I've read some 
documents about Rails Caching and I've learned that I have to form an 
url like this: /en/singlelink/2.

I've tried to add in the file "extension.rb" a map.connect like this:

    map.comnect 'en/singlelink/:id'
        :controller => 'links'
        :requirements => { :id => /\d+/},
        :page => nil

and change the tag in this way:

tag "links:each:link_to_single" do |tag|
   curURL = request.request_uri
   %{<a 
href="#{curURL}/singlelink/#{tag.locals.lnk.id}">#{tag.locals.lnk.site_name}</a>}
  end

But it doesn't work.
Is there someone who can explain me how can I solve my caching problems?

Thanks everybody.


-- 
Posted via http://www.ruby-forum.com/.
_______________________________________________
Radiant mailing list
Post:   Radiant@lists.radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

Reply via email to