Extending

So i am trying to make a way to list the previous articles in a list
format not by date or month but simply by order published, also be able
to break that up into multiple pages (page one is 12 articles page 2 is
12 and so on) in a dynamic fashion. I have tried to modify the
<r:children:each limit=“12” offset=“12” order=“desc”>
tag to accept a passed variable that tells it what the current offset is
but that has been to no avail i dont care if its by passing a variable
or by using tags or making a new behavior i just want a simple page that
lists all my articles in order dynamically allocating how many articles
can be viewed per page

bueller wrote:

So i am trying to make a way to list the previous articles in a list
format not by date or month but simply by order published, also be able
to break that up into multiple pages (page one is 12 articles page 2 is
12 and so on) in a dynamic fashion. I have tried to modify the
<r:children:each limit=“12” offset=“12” order=“desc”>
tag to accept a passed variable that tells it what the current offset is
but that has been to no avail i dont care if its by passing a variable
or by using tags or making a new behavior i just want a simple page that
lists all my articles in order dynamically allocating how many articles
can be viewed per page

have you tried mucking with definition of the r:children tag?

are you using trunk or mental?

I have tried to modify the
<r:children:each limit=“12” offset=“12” order=“desc”>
tag to accept a passed variable that tells it what the current offset is

Assuming you are using mental, apply this diff to site_controller.rb:

Index: site_controller.rb

— site_controller.rb (revision 326)
+++ site_controller.rb (working copy)
@@ -13,11 +13,12 @@
def show_page
response.headers.delete(‘Cache-Control’)
url = params[:url].to_s

  • if live? and (@cache.response_cached?(url))
  • extra_params = params.reject{ | key, value | [‘action’,
    ‘controller’, ‘url’].include? key }
  • if live? and (@cache.response_cached?(url)) and extra_params.empty?
    @cache.update_response(url, response)
    @performed_render = true
    else
  •  show_uncached_page(url)
    
  •  show_uncached_page(url, false)
    
    end
    end

@@ -28,11 +29,11 @@
found if found and (found.published? or dev?)
end

  • def show_uncached_page(url)
  • def show_uncached_page(url, cache_result=true)
    @page = find_page(url)
    unless @page.nil?
    @page.process(request, response)
  •    @cache.cache_response(url, response) if live? and @page.cache?
    
  •    @cache.cache_response(url, response) if live? and @page.cache? 
    

and cache_result
@performed_render = true
else
render :template => ‘site/not_found’, :status => 404

This will change site_controller so that any reuqest containing url
parameters ?like=this&and=that will not be cached.

Now, you can reference the request parameters from within your tags:

here’s an example that just prints out the parameters:

desc %{
hi
}
tag ‘hi’ do |tag|
out = “”
tag.globals.page.request.params.each do
| param |
out += param[0].to_s + ": " + param[1].to_s + "
"
end
out
end

John (and Core)
I tried to submit my diff as a ticket to Trac, but I don’t see any way
of uploading it via new ticket… what am i missing?

Each of the apparent child pages of that page are actually a single
virtual page that uses the passed URL to determine which collection of
models to display.

So you are using a custom page type for that?
Can I see the source please? : )

Yes, remind me on Monday. I don’t have access to our SVN from home.

Sean

bueller wrote:

You have the right idea. Can you paste more of the Radius code that
you’re using? I don’t think it’s necessary to change the SiteController
to do what you want. The easiest way I’ve found to do what you’re
saying is to create virtual pages. For one page type I constructed for
kckcc.edu, I mimiced the find_page_by_url functionality of the
ArchivePage, then returned a virtual subpage that was capable of
handling the request. I used this to handle a custom model, but the same
could be done for pages. Here’s the URL:

http://www.kckcc.edu/academics/course-descriptions

Each of the apparent child pages of that page are actually a single
virtual page that uses the passed URL to determine which collection of
models to display.

Sean

Sean C. wrote:

Each of the apparent child pages of that page are actually a single
virtual page that uses the passed URL to determine which collection of
models to display.

Sean
i agree but the problem is i have no idea how to get the params passed
into the tag…going to try what is posted above but im scared about
that because he said i need mental for that code to work…is there a
tags.globas.request.params or something like that i am missing? so close
but so far

Jacob B. wrote:

Assuming you are using mental, apply this diff to site_controller.rb:

unfortunately i am using trunk (5.2.2) i am using bluehost to host and i
couldnt get mental to run on them, i am praying that this example you
showed me might help with trunk anyways.

I am going to my other computer in a few hours and i will try to use
this, if you have a version of this that definitely works for trunk id
love you even more im pretty noob overall when it comes to ruby but im
starting to get the hang of it.

Thanks everyone for trying to help me out with this i have to say i will
stick by radiant and do what i can to help indefinitely!

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs