Sorting News Module Category List
-
Anastasis
Sorting News Module Category List
When you add new categories into the News module, it appends each new item to the end of the list. It would be useful if there was the option to display this list sorted or even better to determine the order, but even a simple sort would be better than now. For the end user adding new news items with a lot of different categories it would speed entry and reduce the likelihood of error by missing a category.
Is this possible or does it require a code change? Maybe it could be worked around by having a script to sort the categories records in the database that could be used every time categories are updated as a sort of housekeeping task?
Is this possible or does it require a code change? Maybe it could be worked around by having a script to sort the categories records in the database that could be used every time categories are updated as a sort of housekeeping task?
-
alby
Re: Sorting News Module Category List
Add in call module {news sortby="news_category" browsecat="1"}Anastasis wrote: When you add new categories into the News module, it appends each new item to the end of the list. It would be useful if there was the option to display this list sorted or even better to determine the order, but even a simple sort would be better than now. For the end user adding new news items with a lot of different categories it would speed entry and reduce the likelihood of error by missing a category.
Is this possible or does it require a code change? Maybe it could be worked around by having a script to sort the categories records in the database that could be used every time categories are updated as a sort of housekeeping task?
From help:
Code: Select all
sortby="news_date" - Field to sort by. Options are: "news_date", "summary", "news_data", "news_category", "news_title". Defaults to "news_date".
browsecat="1" - Shows a browseable category list.
-
Anastasis
Re: Sorting News Module Category List
Thanks Alby for your reply.
However, doesn't this only affect the output of the website page in the browser. I want to be able to sort the category list in the admin when adding news articles so when a new category gets added it doesn't appear last in the list of categories.
Or have I misunderstood?
However, doesn't this only affect the output of the website page in the browser. I want to be able to sort the category list in the admin when adding news articles so when a new category gets added it doesn't appear last in the list of categories.
Or have I misunderstood?
-
alby
Re: Sorting News Module Category List
Ok, I have misunderstood in frontend.Anastasis wrote: Thanks Alby for your reply.
However, doesn't this only affect the output of the website page in the browser. I want to be able to sort the category list in the admin when adding news articles so when a new category gets added it doesn't appear last in the list of categories.
Or have I misunderstood?
Categories are sorting with hierarchy.
If you don't use categories hierarchy (current svn News or in rc2) in function.admin_categoriestab.php:
Code: Select all
substitute:
$query = "SELECT * FROM ".cms_db_prefix()."module_news_categories ORDER BY hierarchy";
with:
$query = "SELECT * FROM ".cms_db_prefix()."module_news_categories ORDER BY long_name";
-
Anastasis
Re: Sorting News Module Category List
Alby
Thanks again. I cannot find a function.admin_categoriestab.php in my /modules/News folder. There are some action. and method. php files but not this one. Am I looking in the wrong place?
Thanks again. I cannot find a function.admin_categoriestab.php in my /modules/News folder. There are some action. and method. php files but not this one. Am I looking in the wrong place?
-
alby
Re: Sorting News Module Category List
No, it's correct but it's valid for News SVN version or in rc2 version.Anastasis wrote: Thanks again. I cannot find a function.admin_categoriestab.php in my /modules/News folder. There are some action. and method. php files but not this one. Am I looking in the wrong place?
Ok, for old
action.defaultadmin.php
check:
Code: Select all
echo $this->StartTab('categories', $params);
#Put together a list of current categories...
$entryarray = array();
$query = "SELECT * FROM ".cms_db_prefix()."module_news_categories ORDER BY hierarchy";
Code: Select all
$query = "SELECT * FROM ".cms_db_prefix()."module_news_categories ORDER BY long_name";
Alby
-
Anastasis
Re: Sorting News Module Category List
Alby - thanks again.
Just got round to changing and testing this and it doesn't seem to make any difference. The category list is displayed in the same order in the Categories combo on the Articles tab and likewise on the Categories tab.
EDIT: I tell a lie - well an honest mistake!
The list on the Categories tab is now sorted but not on the Articles tab - which would be the place an Editor selects from - is not. Is there a way to get that to sort the same?
Just got round to changing and testing this and it doesn't seem to make any difference. The category list is displayed in the same order in the Categories combo on the Articles tab and likewise on the Categories tab.
EDIT: I tell a lie - well an honest mistake!
The list on the Categories tab is now sorted but not on the Articles tab - which would be the place an Editor selects from - is not. Is there a way to get that to sort the same?
Last edited by Anastasis on Wed May 30, 2007 11:11 pm, edited 1 time in total.
-
alby
Re: Sorting News Module Category List
Ok, for full sort replacement, substitute:Anastasis wrote: Alby - thanks again.
Just got round to changing and testing this and it doesn't seem to make any difference. The category list is displayed in the same order in the Categories combo on the Articles tab and likewise on the Categories tab.
EDIT: I tell a lie - well an honest mistake!
The list on the Categories tab is now sorted but not on the Articles tab - which would be the place an Editor selects from - is not. Is there a way to get that to sort the same?
with:$query = "SELECT * FROM ".cms_db_prefix()."module_news_categories ORDER BY hierarchy";
there are:$query = "SELECT * FROM ".cms_db_prefix()."module_news_categories ORDER BY long_name";
1 substitute in action.addarticle.php
1 substitute in action.editarticle.php
3 substitute in action.defaultadmin.php
Alby
-
Anastasis
Re: Sorting News Module Category List
Absolutely perfect - thanks Alby. Brilliant!alby wrote: Ok, for full sort replacement, substitute:with:$query = "SELECT * FROM ".cms_db_prefix()."module_news_categories ORDER BY hierarchy";there are:$query = "SELECT * FROM ".cms_db_prefix()."module_news_categories ORDER BY long_name";
1 substitute in action.addarticle.php
1 substitute in action.editarticle.php
3 substitute in action.defaultadmin.php
I cannot understand why the default sort order for this is by hierarchy. It makes no sense either when adding categories or using them when working as an editor. You would always want them to be sorted alphabetically wouldn't you, particularly as the sort respects the parent/child categories as well?
For what reason are they sorted the way they are by default?
-
alby
Re: Sorting News Module Category List
Categories are building with hierarchy in mind (type structure of site page) and view reflects this way too.Anastasis wrote:Absolutely perfect - thanks Alby. Brilliant!alby wrote: Ok, for full sort replacement, substitute:with:$query = "SELECT * FROM ".cms_db_prefix()."module_news_categories ORDER BY hierarchy";there are:$query = "SELECT * FROM ".cms_db_prefix()."module_news_categories ORDER BY long_name";
1 substitute in action.addarticle.php
1 substitute in action.editarticle.php
3 substitute in action.defaultadmin.php
I cannot understand why the default sort order for this is by hierarchy. It makes no sense either when adding categories or using them when working as an editor. You would always want them to be sorted alphabetically wouldn't you, particularly as the sort respects the parent/child categories as well?
For what reason are they sorted the way they are by default?
In News I don't use category hierarchy but, in general, is better. I think
Alby
