No, I didn't disabled cache, but I'm using 'translator' extension which
changes behaviour of radiant's caching subsystem.
Here is my some changes to *translate_response_cache.rb*:
ResponseCache.class_eval {
# in here, we're just adding a two-letter language suffix to cached
pages to make sure that the wrong
# language doesn't get served up because it has been cached
inappropriately. we could change this to
# cache in a separate directory (i.e. en/), but for now, we're just
adding the extension
private
def translator_path(path)
#path =~ /\.css|\.js$/ ? path :
kk_request.suffixize(kk_request.language)
path =~ /\.css|\.js$/ ? path : [ path,
kk_request.session["gsession_color"], kk_request.session["gsession_design"],
kk_request.suffixize(kk_request.language) ].join( "_" )
end
As a result I have this files in my cache folder:
selene# ll
total 28
drwxrwxrwx 2 root www 512 Jul 27 23:22 _css
-rw-rw-rw- 1 root www 22972 Jul 27 23:22 index_blue_full__az-AZ.data
-rw-rw-rw- 1 root www 185 Jul 27 23:22 index_blue_full__az-AZ.yml
For example, if user requests 'red' & 'full' version of site, then
*'index_red_full__az-AZ'
*will be requested. If there is no cached file, then page will be generated
by radiant from db and then cached in this folder.
That is solution, I think. I'am using radiant v0.7.1. My site supports many
colors (design types) languages and light/full-version.
________________
Regards,
Mamed Mamedov
Sent from Baku, Azerbaijan
On Mon, Jul 27, 2009 at 11:27 PM, Jim Gay <[email protected]> wrote:
>
> On Jul 27, 2009, at 2:24 PM, Mamed Mamedov wrote:
>
> Hi everybody!
>>
>> Here how I have resolved my problem with changing page's layout
>> on-the-fly:)
>> I have created my own extension folder with my namespace-tags for unusual
>> tasks.
>>
>> desc %{
>> Works like design switcher.
>> }
>> tag 'gsession:design' do |tag|
>> design_type = request.session["gsession_design"]
>> if design_type == nil
>> design_type = GenieSessionExtension.defaults[:design]
>> request.session["gsession_design"] = design_type
>> end
>> design_type.strip!
>> if layout = Layout.find_by_name(tag.attr["#{design_type}"])
>> tag.globals.page.layout = layout
>> tag.globals.page.render
>> end
>> end
>>
>> Usage:
>> I have created layout named "master-index" with only one line in it:
>> <r:gsession:design full="full-index" light="light-index" />
>>
>> With 2 arguments, which describes layout names for 'full' and 'light'
>> version of my site. You can define 'gsession_*design*' session variable at
>> any time by hitting, for example:* /genie/set/design/light*
>> All my pages have selected 'master-index' layout.
>> That is all, while page is rendered my tag switches current layout to
>> 'full-index' or 'light-index' named layouts.
>>
>> Waiting for comments ... Thank you:)
>>
>
> Have you disabled caching to do this?
>
>
>
>> ________________
>> Regards,
>> Mamed Mamedov
>>
>>
>>
>>
>> On Thu, Jul 16, 2009 at 6:16 PM, Sean Cribbs <[email protected]>
>> wrote:
>>
>> If all of your pages have the same layout at any time, make sure all
>>> descendant pages have their layout set to <inherit> and then your
>>> extension
>>> could change the layout on the root page.
>>> However, it would not be trivial to do this on a per-user basis. Have
>>> you
>>> considered something like a combination of Javascript and CSS that lets
>>> your
>>> users switch layouts?
>>>
>>> Sean
>>>
>>> Mamed Mamedov wrote:
>>>
>>> Hi everybody!
>>>>
>>>> I have a little question: how can I change page's layout from within my
>>>> extension?
>>>> Problem is, that I have 2 different page layouts for my site: [
>>>> full-version
>>>> and light-version ].
>>>> I want to write a mini-extension to switch between designs of my site
>>>> throw
>>>> hitting: /design/set/full and /design/set/light or /design/reset
>>>> And I'am saving current design variable in current user's session.
>>>>
>>>> And now, just need to change current page's layout on the fly
>>>> accordingly
>>>> to
>>>> session value.
>>>> ________________
>>>> Regards,
>>>> Mamed Mamedov
>>>>
>>> _______________________________________________
> Radiant mailing list
> Post: [email protected]
> Search: http://radiantcms.org/mailing-list/search/
> Site: http://lists.radiantcms.org/mailman/listinfo/radiant
>
_______________________________________________
Radiant mailing list
Post: [email protected]
Search: http://radiantcms.org/mailing-list/search/
Site: http://lists.radiantcms.org/mailman/listinfo/radiant