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 clickking 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 a
tag.
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
%{#{tag.locals.lnk.site_name}}
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 this tags I form url like: /en/singlelink?id=2
It works
very well, but now I’ve got problems with the cache. I’ve read some
documents
about Rails Caching and I’ve learned that I must form url like this:
/en/singlelink/2.
I’ve tryed 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
%{#{tag.locals.lnk.site_name}}
end
But it doesn’t work.
Is there someone who can explain me how
can I solve my caching problems?<!–
D([“mb”,“\u003cbr>\u003cbr>\u003c/span>Thank's
everybody.\u003c/font>\u003cfont face\u003d"Arial"
size\u003d"2">\u003cspan
style\u003d"font-size:10pt;font-family:Arial">\u003c/span>\u003c/font>\u003c/div>\u003c/div>\n”,0]
);
D([“ce”]);
//–>
Thank’s everybody.
___________________________________
L’email della prossima generazione? Puoi averla con la nuova Yahoo!
Mail: Yahoo Search - Ricerca nel Web | Motore di Ricerca