Forums / Developer / Caching problem.. / Comment46820

Author Topic

David Jones

Tuesday 19 September 2006 7:13:59 am

Comment46820

Yeah, I noticed that :o)

OK, here is something specfic that maybe you can help with.

On my news listing page I want to output a number of stories and then some page links to the rest.

I have this code:

{def $offset=0
				   $limit=2}
				{if is_set($view_parameters.offset)}
					{set $offset=$view_parameters.offset}
				{/if}

			{def $meny=fetch('content','list',
				 hash( 'parent_node_id', $node.node_id,
				'limit', $limit,
				 'offset', $offset ))}

			{def $meny_count=fetch('content','list_count',
				hash( 'parent_node_id', $node.node_id ))}

			
			
			<div id="col2List">
				<h3>Other Stories</h3>
					<ul>
							{foreach $meny as $element}	
							
						<li><a href={$element.url_alias|ezurl()}>{attribute_view_gui image_class=original attribute=$element.children[1].data_map.image.content.data_map.image}</a>
							<div id="col2ListIndent">
								<span class="title"><a href={$element.url_alias|ezurl()}>{attribute_view_gui attribute=$element.object.data_map.date} - {attribute_view_gui attribute=$element.object.data_map.title}</a></span>
								<span class="desc"><a href={$element.url_alias|ezurl()}>{attribute_view_gui attribute=$element.object.data_map.main_text}</a></span></div>
						</li>	
											
								
			{/foreach}													
				  </ul>
			</div>

This code shows the caching problem. I.e. it disappears on reload.

As is my understanding this is caused by the use of $node here

{def $meny=fetch('content','list',
				 hash( 'parent_node_id', $node.node_id,
				'limit', $limit,
				 'offset', $offset ))}

			{def $meny_count=fetch('content','list_count',
				hash( 'parent_node_id', $node.node_id ))}

I have tried replacing this with $pagelayout_node.node_id which does stop the content dissappearing but also prevents the pagination working properly.

The URL changes to /(offset)/2 but displays the content from the first page.

THe pagination works if I $node but only for one page load.

Any ideas, thanks for you help.

PS the image doesnt display either but that is an issue for another day *smile*