Latest Register Log In

+ Advanced Search

Link Importance Formula

Link Importance Formula
By
08/24/04 (Edited 01/29/14)

Occasionally, you may want to sort articles by a criteria more complicated than a single field. The 'importance' field exists to allow you to do this. At Admin Panel -> Articles -> Article Settings -> "Article Importance Formula" you can define a custom formula for determining the value to fill this field. Select to sort by the importance field at Admin Panel -> Settings -> General -> "Default Ordering:" -> "Articles order".

A bit of PHP knowledge is helpful for creating a formula, but please feel free to contact support to ask how to impliment whatever importance formula you'd like to use. The current default formula, which you can customize, is
$importance = ($this->hitsoutpermonth() + $this->numcomments) + 6
This takes the number of views per month the article recieves, adds the number of comments posted to that article, and then adds 6.

You can reference any mysql field in the form $this->fieldname, or use any methods of the classes/onelink.php or classes/generic.php classes with $this->methodname().

Important Note: After you change the importance formula you must regenerate articles at Admin Panel -> Maintenance -> Regenerate in order to get your preexisting links updated to the new formula's value.





Description Creating complex sorting algorithms.
Rating
Views 1906 views. Averaging 0 views per day.