I’m fiddling around with Mode Revo. 2.x and the new API. I’ve created a small ’test’ snippet containing the code below:
<?php
$criteria = $modx->newQuery('modResource');
$criteria->where(array('parent' => $parent));
$criteria->sortby('publishedon','DESC');
$criteria->limit(3,0);
$children = $modx->resource->getMany('Children',$criteria);
foreach ($children as $child)
{
$year=date('Y', strtotime($child->get('publishedon')));
$month=date('m', strtotime($child->get('publishedon')));
$day=date('d', strtotime($child->get('publishedon')));
$permalink=$child->get('alias');
echo '<div id="header_' . $child->get('pagetitle') . '">' . $child->get('pagetitle') . '</div>' . "\n";
echo '<div class="front_page_item_date">' . date('F jS, Y', strtotime($child->get('publishedon'))) . '</div>' . "\n";
echo '<div class="front_page_item_header">' . $child->get('pagetitle') . '</div>' . "\n";
echo '<div class="front_page_item_content">' . substr($child->get('content'), 0, 512) . '...</div>' . "\n";
echo '<div id="front_page_item_comments_' . $child->get('pagetitle') . '">0</div>' . "\n";
echo '<div class="front_page_item_read_more"><a href="http://www.website.com/' . $category . '/articles/' . $year . '/' . $month . '/' . $day . '/' . $child->get('alias') . '">Read more...</a></div>' . "\n";
}
?>
When I call the same snippet multiple times on the same page every instance of the same snippet gives exact the same result:
[[test? &category=CatA &parent=6]]
[[test? &category=CatB &parent=7]]
[[test? &category=CatC &parent=8]]
I’ve turned all the caching meganisms of in the manager. But it stil seems there are things cached. Is this a bug or a feature in MODx Revo. 2.x. If it’s a feature could some give me a hint to solve this?
<?php
$criteria = $modx->newQuery('modResource');
$criteria->where(array('parent' => $parent));
$criteria->sortby('publishedon','DESC');
$criteria->limit(3,0);
$children = $modx->resource->getMany('Children',$criteria);
foreach ($children as $child)
{
$year=date('Y', strtotime($child->get('publishedon')));
$month=date('m', strtotime($child->get('publishedon')));
$day=date('d', strtotime($child->get('publishedon')));
$permalink=$child->get('alias');
echo '<div id="header_' . $child->get('pagetitle') . '">' . $child->get('pagetitle') . '</div>' . "\n";
echo '<div class="front_page_item_date">' . date('F jS, Y', strtotime($child->get('publishedon'))) . '</div>' . "\n";
echo '<div class="front_page_item_header">' . $child->get('pagetitle') . '</div>' . "\n";
echo '<div class="front_page_item_content">' . substr($child->get('content'), 0, 512) . '...</div>' . "\n";
echo '<div id="front_page_item_comments_' . $child->get('pagetitle') . '">0</div>' . "\n";
echo '<div class="front_page_item_read_more"><a href="http://www.website.com/' . $category . '/articles/' . $year . '/' . $month . '/' . $day . '/' . $child->get('alias') . '">Read more...</a></div>' . "\n";
}
?>
When I call the same snippet multiple times on the same page every instance of the same snippet gives exact the same result:
[[test? &category=CatA &parent=6]]
[[test? &category=CatB &parent=7]]
[[test? &category=CatC &parent=8]]
I’ve turned all the caching meganisms of in the manager. But it stil seems there are things cached. Is this a bug or a feature in MODx Revo. 2.x. If it’s a feature could some give me a hint to solve this?