Page 1 of 1

php-variable in {news}

Posted: Wed Apr 04, 2007 12:57 pm
by Ninjan
Hey!

Not really much of a question but I trying to make a archive for my {news} entries. Basically, I want to send a variable in {news} like this: {news start=$variable}. This obviously does not work but I hope you get my idea. I'm sending the code aswell.

{php}
if (!isset($_GET['archive'])) {
  $archive = 0;
}
else {
    $archive = (int)$_GET['archive'];
}

$archivenext = ($archive + 5);
$archiveprevious = ($archive - 5);

$n = mysql_query("SELECT news_id FROM cms_se_module_news WHERE news_category_id = '1'");
$num = mysql_num_rows($n);

echo "";

if ($archiveprevious >=0)
{
echo "Previous";
echo " ";
}

if ($archivenext Next";
}
echo "";
{/php}

{news category="news" detailpage="article" number="5" start=_$ARCHIVE_}

Re: php-variable in {news}

Posted: Sat Apr 07, 2007 5:10 am
by Vin
Why to do it in PHP... there's an attribute "showarchive" for the news tag which shows the expired news (set it to "true")... for pagination, try the user defined tag I posted in the documentation (see http://wiki.cmsmadesimple.org/index.php ... fined_Tags).