Forum OpenACS Q&A: Re: Re: Controlling paginator link output

Collapse
Posted by Sean Redmond on

It's pretty basic:

if { [regexp {^(.+)/theme/([0-9]+)$} [ad_conn url] match root theme_id] } {
    rp_form_put theme_id $theme_id
    rp_internal_redirect /www/research/luce/one-theme
}

Based on what you said I tried this:

if { [regexp {^(.+)/theme/([0-9]+)$} [ad_conn url] match root theme_id] } {
    if { [ns_set find [rp_getform] page] < 0 } {
	rp_form_put theme_id $theme_id
    }	
    rp_internal_redirect /www/research/luce/one-theme
}

Which works, thanks. At least it gets around the server error.

However, its the second-best solution since it totally contradicts the purpose of using a .vuh for prettified URLs. I figured that to have any control over it one would have to create a new list template with custom paginator output. However, having delved into acs-templating/resources/lists/table.adp, it's worse than that. The list template does not do any formatting, of the URL (the value, here, of @paginator_pages.url@:

<if \@paginator.current_page@ ne \@paginator_pages.page@>
    <if \@paginator_pages.page@ lt 10>&nbsp;&nbsp;</if><a 
    href="\@paginator_pages.url@" title="\@paginator_pages.context@">\@paginator_pages.page@</a>
</if>
The URLs are created as a property of the paginator in template::list::render (in acs-templating/tcl/list-procs.tcl), like so:
# Add URL to the pages
template::multirow -local extend paginator_pages url 

template::multirow -local foreach paginator_pages {
    set url [get_url -name $list_properties(name) -override [list [list page $page]]]
}

It hink the only thing to do is create an alternate template that reformats the URL after the fact. Something like:

<a 
    href="<% [munge_the_url \@paginator_pages.url@] %>"
    title="\@paginator_pages.context@">
        \@paginator_pages.page@
</a>