php-variable in {news}

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Locked
Ninjan

php-variable in {news}

Post 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_}
Vin

Re: php-variable in {news}

Post 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).
Locked

Return to “CMSMS Core”