You need to sign in to do that
Don't have an account?

Help with custom Page, trying to display most viewed by all users
I have a custom knowledge page and I am trying to get the Most viewed by all users to show up like this.

Here is what I have as my controller
public with sharing class vfKeywordSearchController {
//Page Size
private Static Final Integer PAGE_NUMBER = 10;
//Search String used in ArticleList tag
public String searchstring { get; set; }
public vfKeywordSearchController() {
String qryString = 'SELECT Id, title, UrlName, LastPublishedDate, LastModifiedById FROM KnowledgeArticleVersion WHERE (PublishStatus = \'online\' and Language = \'en_US\')';
List<KnowledgeArticleVersion> articleList= Database.query(qryString);
maxSize = articleList.size() ;
}
//Keeps track of current page & max size of article list
Integer currentPage = 1;
Integer maxSize = 1;
// Returns whether we need to see previous button or not
public boolean getPrevRequired() {
return currentPage > 1;
}
// Returns whether we need to see next button or not
public boolean getNextRequired() {
return currentPage * PAGE_NUMBER < maxSize;
}
//Returns current page number
public Decimal getCurrentPageNumber() {
return this.currentPage;
}
//action for next click
public PageReference next() {
if(maxSize > this.currentPage * PAGE_NUMBER) {
this.currentPage = this.currentPage + 1;
}
return null;
}
//action for previous click
public PageReference previous() {
if(this.currentPage > 1)
this.currentPage = this.currentPage - 1;
return null;
}
}
Here is what I have as my controller
public with sharing class vfKeywordSearchController {
//Page Size
private Static Final Integer PAGE_NUMBER = 10;
//Search String used in ArticleList tag
public String searchstring { get; set; }
public vfKeywordSearchController() {
String qryString = 'SELECT Id, title, UrlName, LastPublishedDate, LastModifiedById FROM KnowledgeArticleVersion WHERE (PublishStatus = \'online\' and Language = \'en_US\')';
List<KnowledgeArticleVersion> articleList= Database.query(qryString);
maxSize = articleList.size() ;
}
//Keeps track of current page & max size of article list
Integer currentPage = 1;
Integer maxSize = 1;
// Returns whether we need to see previous button or not
public boolean getPrevRequired() {
return currentPage > 1;
}
// Returns whether we need to see next button or not
public boolean getNextRequired() {
return currentPage * PAGE_NUMBER < maxSize;
}
//Returns current page number
public Decimal getCurrentPageNumber() {
return this.currentPage;
}
//action for next click
public PageReference next() {
if(maxSize > this.currentPage * PAGE_NUMBER) {
this.currentPage = this.currentPage + 1;
}
return null;
}
//action for previous click
public PageReference previous() {
if(this.currentPage > 1)
this.currentPage = this.currentPage - 1;
return null;
}
}
You will need to find a control that will render the data you are querying in the way you are desiring.