Forums / Setup & design / Problems gettng offset to work correctly

Problems gettng offset to work correctly

Author Message

arthur foelsche

Saturday 24 May 2003 12:24:40 am

Hi- I asked a similar question earlier and though i've made some progress, there seems to be one key piece missing from how this is functioning. Basically i want to use one of the navigator's to be able to browse all of the articles under a given node. Here's the code i'm using:

{* get total number of articles*}
{let item_count=fetch('content','list_count', hash('parent_node_id',158,'class_filter_array',array(2),'class_filter_type','include','depth', 0))}

{* set the number of articles to display per page *
{let page_limit=20}

{* include the navigator *}
{* page_uri is set to nothing so it returns index.php/news/offset/XX/ *}
{include name=navigator
uri='design:navigator/google.tpl'
page_uri=concat('','','')
item_count=$item_count
view_parameters=hash(offset,$offset)
item_limit=$page_limit}


{* fetch the articles *}
{section name=news loop=fetch('content','list',hash(parent_node_id, 158,limit,$page_limit,offset,$view_parameters.offset,class_filter_type, "include", class_filter_array, array(2), "sort_by", array("published", false()), "depth", 0))}

{* print the article date *}
{$news:item.data_map.article_date.data_int|datetime(custom,"%M %d, %Y") }

{* print article url *}
<a href={concat("/content/view/full/",$child:item.node_id)|ezurl}>

{* print article title *}
{attribute_view_gui attribute=$news:item.data_map.pagetitle}</a>

{/section}
{/let}{/let}

while the output from this works fine for the first page, none of the pages work from it. How do can i actually implement the offset so the fetch call takes it?

thanks!

Selmah Maxim

Saturday 24 May 2003 9:32:32 am

Hi ..

it`s must take alone from the php code, such offset/#

what u get ?

there was bug with this, did u checked the bug fix ?

arthur foelsche

Saturday 24 May 2003 12:18:36 pm

Hi- I'm running 3.0.1, but i did do the bug fix that was mentioned where the language stuff had to be changed. I guess the nub of my question is how to actually get the value of offset from the url? I know that with {$module_result.uri} i get /news/offset/XX so my plan was to try to chop the /news/offset off from {$module_result.uri} and just endup with the value, but i can't figure this out. Any ideas?

Thanks for trying to answer my question... I'm still trying to learn lots and the learning curve is pretty slow for me...

arthur foelsche

Monday 26 May 2003 3:07:31 pm

This is the code that i ended up using to use a fetch function grab the latest articles published to a specific node and navigate them using the google navigator. Let
me know if it works for you.

{* set the top node from which to generate pages *}
{let topnode=24}

{* set the parrent node from which to grab content *}
{let theparent=158}

{* set number of items per page *}
{let page_limit=20}

{* get total number of articles*}
{let item_count=fetch('content','list_count', hash('parent_node_id',$theparent,'class_filter_array',array(2),'class_filter_type','include','depth', 0))}

{* if its not the first page, show page X of X *}
{section show=ne($view_parameters.offset,0)}
<b>Page {sum($view_parameters.offset,1)} of {round(div($item_count,$page_limit))}</b><br>
{/section}

{* grab and loop the news content *}
{section name=news loop=fetch('content','list', hash(parent_node_id, $theparent, limit, $page_limit, offset,mul($view_parameters.offset,$page_limit), class_filter_type, "include", class_filter_array, array(2), "sort_by", array("published", false()), "depth", 0))}

{* print the date *}
{$news:item.object.published|datetime(custom,"%M %d, %Y")}

{* print a url and title of article *}
<a href={concat("/content/view/full/",$news:item.node_id)|ezurl}>{attribute_view_gui attribute=$news:item.data_map.pagetitle}</a>

{* end grab and loop *}
{/section}

<b>Go to page:</b>
{include name=navigator
uri='design:navigator/google.tpl'
page_uri=concat('/content/view','/full/',$topnode)
item_count=div($item_count,$page_limit)
view_parameters=$view_parameters
item_limit=$view_parameters}

{/let}
{/let}
{/let}
{/let}

Jerry Jalava

Friday 20 June 2003 8:06:29 am

Hi,

I would need some ideas how to complete this situation...
Here's what I need to complete:
I have folder "Articles" (Section 3),
It contains folders witch are the "categories",
Those folders contains "articles" (class 2)

When client goes to url www.url/articles/ she sees a list of newest articles in each category.
ie:
Category Name (link to category)
Article title (link to article)
Published time
Intro text
Publisher name And Picture (This one I don't even know how to fetch)

And when the client goes to url www.url/articles/category_name/ she sees a list of all articles in that category with offset of 15.
ie:
Article title (link to article)
Published time
Intro text
Publisher name And Picture

I would be more than happy to receive even hints how to accomplish this situation... The BEST would be if someone have working example of this kind of thing...

I'm sure I'm not the only one who would have use for this kind of article listing... ;)

Thanks already and happy Mid-summer
Yours,
Jerry Jalava