debut question

Hi..

Problem is as follows: I would like to use the debut_xxx criterion and in one case it works fine (using code: <a href="rubrique.php3?id_rubrique=1&debut_lugu=5">)

And now the real question: Is it possible to NOT to use id_rubrique=1 but just id_rubrique or something similar instead. I have the rubrique.html page to display several different rubriques (1, 2, 3), so I am not very happy to do different templates for all of them. But for now it seems, i can't write dynamic code into the <a href> link. Or can I somehow?

Regards,
Meelis

Meelis Friedenthal wrote:

Hi..

Problem is as follows: I would like to use the debut_xxx criterion and in one case it works fine (using code: <a href="rubrique.php3?id_rubrique=1&debut_lugu=5">)

And now the real question: Is it possible to NOT to use id_rubrique=1 but just id_rubrique or something similar instead. I have the rubrique.html page to display several different rubriques (1, 2, 3), so I am not very happy to do different templates for all of them. But for now it seems, i can't write dynamic code into the <a href> link. Or can I somehow?

Far more interesting question that it first appeared to me :slight_smile:
Lets say we have a rubrique.html with some articles and this code:

<BOUCLE_overview(RUBRIQUES) {id_rubrique}>

<!-- this shows 10 articles, if you want other figures you have to change it here and once in the php bit -->
<BOUCLE_overview_10(ARTICLES) {id_rubrique} {debut_xxx,10}>
<!-- of course insert here what you want :wink: -->
<a href=#URL_ARTICLE>#TITLE</a><br>
</BOUCLE_overview_10>

<?
// this bit counts how many article are in the rubrique youre in, dont know if theres a spip command to do it
$countarticles = 0;
<BOUCLE_count(ARTICLES) {id_rubrique}>
$countarticles++;
</BOUCLE_count>;

// this variable says how many articles the first loop is showing, so you have to change it too when you change the number above
$numbershown = 10;

$xxxback = $debut_xxx - $numbershown;
$xxxnext = $debut_xxx + $numbershown;
$shownfrom = $debut_xxx+1;
$shownto = $xxxnext;
if ($xxxnext>$countarticles) {$shownto = $countarticles; }

// and here the navigational output, which should be improved :smiley: but it works so far
// this gives you which articles are shown
echo "<br>SHOWN ARTICLES: " . $shownfrom . " - " . $shownto . "<br>";
// directs you back one part result part (if you arent on the first one)
if ($xxxback>=0) {echo"<a href=\"#URL_RUBRIQUE&debut_xxx=" . $xxxback . "\">ONE PAGE BACK</a><br>";}
// directs you to the next part result page if there are any more results
if ($xxxnext<$countarticles) {echo"<a href=\"#URL_RUBRIQUE&debut_xxx=" . $xxxnext . "\">NEXT PAGE</a><br>";}
?>
</BOUCLE_overview>

So i hope this helps you out. it may not be beautiful bit it works if you just copy and paste it into your rubrique.html :slight_smile:

Its a bitch to test btw because you cant use the "clear page from cache" button for the part result pages :frowning:
you have to either manually purge the sitecache when you make changes or set the rubriques delay to 0 when you want to see your changes right away.

See ya
Chris