Wiki Plume Community : Lastressource

HomePage :: Categories :: PageIndex :: RecentChanges :: RecentlyCommented :: Login/Register

Display the last resources from the last but one


If you want to siplay two or three times the last resources published on your website and want to avoid the same to be displayed twice, this script is for you. You just have to replace the 'last loop' with this one. These lines were created by Titto, aked to by Buma.

First step


Open the template in which you need to mak the modification, it's here : /manager/templates/default/... the three points mean for example category_homepage.php

Look for the Last Loop... you see it ? it can be something like that...

<?php pxGetLastResources(); ?>
<?php while (!$last->EOF() ): ?>
<p><a href="<?php pxLastResPath(); ?>"><?php pxLastResTitle(); ?></a></p>
<?php $last->moveNext(); endwhile; ?>



Second step


Then you just have to replace it with these lines:


<?php pxGetLastResources(); ?>
<?php $i = 1; ?>
<?php while (!$last->EOF() ): ?>
<?php if ($i >= 2): ?>
<p><a href="<?php pxLastResPath(); ?>"><?php pxLastResTitle(); ?></a></p>
<?php endif; $i  ; ?>
<?php $last->moveNext(); endwhile; ?>



Look at you page now... yeah, that's done, fine...

By the way, you can replace this

<?php if ($i >= 2): ?>


with this

<?php if ($i >= 3): ?>


to display the last resources -2 etc...

Want more explanations ?


Explanations



We have created a meter and a function that tells to display the last resources, with $i superior to the value you choose (here >2)

$i



$i >= 2




Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by Wikka Wakka Wiki 1.1.6.1
Page was generated in 0.4226 seconds