You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@roller.apache.org by "M. Purbo" <m....@media-trust.com> on 2005/12/22 03:52:22 UTC

[Question]custom weblog display pagination

Dear Members,

I'm trying to make roller to display all weblog entries in a usual
paginated page, e.g. like google search result. Something like:

<< 1 2 ... >>

entry 1
....

<< 1 2 ... >>

in which each page would display a configurable number of entries, say 10.

My question is:

1. is it possible at all to do this without customizing source code
(only by creating theme and/or .vm files using roller default vm library)

2. if i do have to customize the source code, is the following steps are
the right way to go (in general):

2.1. extends/customize PageModel
2.2. extends/customize BasePageServlet
2.3. create my own vm library (e.g. with macros for nextPage, prevPage,
etc.) that calls the customized PageModel
2.4. create a theme using this vm library

3. is it a wise thing to do at all (to customize roller). or is it safer
just to make a seperate web-app/action that would read directly from
roller database, and display it using JSP, for example.

Thank you in advance.

Purbo

Re: [Question]custom weblog display pagination

Posted by Dave Johnson <da...@rollerweblogger.org>.
On Dec 21, 2005, at 9:52 PM, M. Purbo wrote:
> I'm trying to make roller to display all weblog entries in a usual
> paginated page, e.g. like google search result. Something like:
> ...
> 2. if i do have to customize the source code, is the following steps 
> are
> the right way to go (in general):
>
> 2.1. extends/customize PageModel
> 2.2. extends/customize BasePageServlet
> 2.3. create my own vm library (e.g. with macros for nextPage, prevPage,
> etc.) that calls the customized PageModel
> 2.4. create a theme using this vm library

That looks correct.


> 3. is it a wise thing to do at all (to customize roller). or is it 
> safer
> just to make a seperate web-app/action that would read directly from
> roller database, and display it using JSP, for example.

I think you'll want to customize Roller. Where possible, you should
keep your code separate from Roller.

For example, put your source code in:
     sandbox/pagination/src

And then tell Roller's build to compile it by adding this to 
custom/custom-src-web.xmlf:
     <src dir="${basedir}/sandbox/pagination/src" />

And put your web files (e.g. velocity scripts) in a web dir structure 
under:
     sandbox/pagination/web

And then tell Roller's build to included it by adding this to 
custom/custom-web.xmlf:

    <copy todir="${build.stage_web}" overwrite="true">
       <fileset dir="${basedir}/sandbox/pagination/web">
          <include name="**/**" />
       </fileset>
    </copy>

If you extend PageModel, tell Roller to use your new one by setting the 
property:
    velocity.pagemodel.classname=


Hope that helps.

If you'd like to contribute this work to Roller: the custom for larger 
changes
(like this one) is to write a short proposal on the wiki, then submit a 
patch
for our review.

- Dave