Interspire Product Knowledge Base

Would you like to...

Print this page Print this page

Email this page Email this page

Post a comment Post a comment

Subscribe me

Add to favorites Add to favorites

Remove Highlighting Remove Highlighting

Edit this Article

Export to PDF

User Opinions (0 votes)

No users have voted.

How would you rate this answer?



Thank you for rating this answer.

How can I get all the featured articles to display in one category?

This guide is for ArticleLive NX 1.6 versions only.

This guide will allow you to make one category show the featured articles from all categories. However, if an article is placed in this category and is not marked as featured, then it will not show up in the category.

First step is to create a category and get its ID number. To get its ID number, simply hover over the Edit link of the category and in the URL will be something along the lines of &catId=x where x is the category ID number.

For this example i'll use the number 23 as the ID number.

Open up:

/templates/{your template}/Panels/ViewCategoryAdvancedPanel.php

find:

$query = sprintf("select count(a.articleid) as count from %sarticles a inner join %susers u on a.AuthorID = u.UserID inner join %scategoryassociations ca on a.ArticleID = ca.ArticleID where CategoryID IN(%s) and Visible=1 and a.Status=1 and unix_timestamp(StartDate) <= %s and IsFinished=1 and (unix_timestamp(ExpiryDate) >= %s or EnableExpiry=0)", $GLOBALS["AL_CFG"]["tablePrefix"], $GLOBALS["AL_CFG"]["tablePrefix"], $GLOBALS["AL_CFG"]["tablePrefix"], $this->catlist, time(), time());

It could be different per template, so just look for the beginning bit, they will all start like:

$query = sprintf("select count(a.articleid) as count...

We need to keep the query for all categories except our featured one. So alter it to be like this:

if($GLOBALS["CategoryId"] == 23){
$query = sprintf("select count(a.articleid) as count from %sarticles a inner join %susers u on a.AuthorID = u.UserID where Visible=1 and a.Status=1 and Featured=1 and unix_timestamp(StartDate) <= %s and IsFinished=1 and (unix_timestamp(ExpiryDate) >= %s or EnableExpiry=0)", $GLOBALS["AL_CFG"]["tablePrefix"], $GLOBALS["AL_CFG"]["tablePrefix"], time(), time());
}else{
// PUT THE ORIGINAL CODE HERE
}


That will take care of the paging (<< Prev 1 2 3 Next >>) query. Copy the original code from before and place it where mentioned, also change the number 23 in the first line to your category ID.

Now further down look for something like this:

$query = sprintf("select *, unix_timestamp(StartDate) as SD from %sarticles as art
inner join %susers as u on art.AuthorID = u.UserID
inner join %scategoryassociations as ca on art.ArticleID = ca.ArticleID
where CategoryID='%s' and
Visible=1 and
art.Status=1 and
unix_timestamp(StartDate) <= %s and
IsFinished=1 and
(unix_timestamp(ExpiryDate) >= %s or EnableExpiry=0)
group by art.ArticleID
order by art.SortOrder ASC, StartDate DESC, art.ArticleID DESC
LIMIT %d, %d", $GLOBALS["AL_CFG"]["tablePrefix"], $GLOBALS["AL_CFG"]["tablePrefix"], $GLOBALS["AL_CFG"]["tablePrefix"], $GLOBALS['CategoryId'], time(), time(), $this->offset, $this->perpage);


Again it may differ slightly, but it should be almost right under the line: function GetArticles()

Now we are pretty much repeating before:

if($GLOBALS["CategoryId"] == 23){
$query = sprintf("select *, unix_timestamp(StartDate) as SD from %sarticles as art
inner join %susers as u on art.AuthorID = u.UserID
where Featured=1 and
Visible=1 and
art.Status=1 and
unix_timestamp(StartDate) <= %s and
IsFinished=1 and
(unix_timestamp(ExpiryDate) >= %s or EnableExpiry=0)
group by art.ArticleID
order by art.SortOrder ASC, StartDate DESC, art.ArticleID DESC
LIMIT %d, %d", $GLOBALS["AL_CFG"]["tablePrefix"], $GLOBALS["AL_CFG"]["tablePrefix"], time(), time(), $this->offset, $this->perpage);
}else{
// PUT THE ORIGINAL CODE HERE
}


This will then list all the featured articles in this category.

Thats it! If you have any troubles with this guide, just send in a support ticket from your client area.

Powered by Interspire Knowledge Manager - World's #1 Best Selling FAQ and Knowledge Base Software