Article Sorting Order problems

Get help with installation and running phpwcms here. Please do not post bug reports or feature requests here.
Post Reply
Nik2004
Posts: 132
Joined: Mon 9. Aug 2004, 14:31
Location: Athens,Greece

Article Sorting Order problems

Post by Nik2004 »

I would like to sort articles by start date AND manual. So, if I manually set an order, this should take precendence over start date, but if no sort order is defined, then start date should be used.

In Release 1.1RC4 I had done this by code hacking. However, Release 1.3 has option buttons to select sort types but no sort order type combinations seem to be possible. What is the suggested way to do it?

Or, if there is no simple way available, what is the smallest change in source code to have it hardcoded? Manual, if set, should take precendence over any other sort method selected.
Nik2004
Posts: 132
Joined: Mon 9. Aug 2004, 14:31
Location: Athens,Greece

Transferred to other thread

Post by Nik2004 »

A reply here was related to another thread. This issue remains open.
Nik2004
Posts: 132
Joined: Mon 9. Aug 2004, 14:31
Location: Athens,Greece

Post by Nik2004 »

Since I still have no reply on this.

In the meantime, I found out that during upgrade (initially from 1.1RC4, now 1.3.3) all articles acquired an article_sort auto value and I see that all newly added articles also acquire auto incremented values. This is different from the initial version where article_sort was always 0 unless the arrow keys were used.

My problem is that I want to have some article(s) always placed first, and all others be sorted by date_begin. Now that all articles have article_sort values, I cannot use the trick I was using (I used to set article_sort to such articles at -10 and keep all others 0).

So, could someone suggest a proper solution so that I can continue to use date_begin as a sort criterion while having some articles always at the top?
User avatar
Oliver Georgi
Site Admin
Posts: 9919
Joined: Fri 3. Oct 2003, 22:22
Contact:

Post by Oliver Georgi »

Have a look at content part "teaser"!!!

This is more flexible - because I think you want to have portal like page rendering for only some pages/articles - mainly home or sublevel top page.

You can also use multiple content parts "teaser" per page - and set checkbox which avoid multiple rendering of same article teaser on same page.

Teaser can be defined by automatic (date) or being sorted manually.

Oliver
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон
Nik2004
Posts: 132
Joined: Mon 9. Aug 2004, 14:31
Location: Athens,Greece

Post by Nik2004 »

Thanks Oliver, I will have to try it and see how to leverage its advantages. However, in the meantime, I have (from the older versions) some articles playing the role of "introduction" in each category, and I want to have each one of them listed on top of the respective category.

I found the following simple solution:

I added a db field in phpwcms_article table called article_anchor (int(1) default value 0). If I set the article_anchor value to 1 for an article (manually, in the db), then this article should be anchored on top of all articles in the category; for all other articles (for which article_anchor=0), the sort rule selected on the admin should apply.

This can be done very easily by changing the source code at include/inc_front/front.func.inc.php (line 446). So, the line:

Code: Select all

$sql .= "ORDER BY ".$ao[2];
should be changed to:

Code: Select all

$sql .= "ORDER BY article_anchor DESC, ".$ao[2];
That's all. In fact, I liked this feature very much (because it is implemented so easily) and I thought that, if you agree, this can be generalized and incorporated in future versions of phpwcms in the following form: In article admin, you just have to add another checkbox which could be titled: "Anchor at top of category". Then this article would always be displayed at top, regardless the sort rule selected which will apply to all other articles in the category. I find that this feature adds basic flexibility to override sort order for a particular article. (You may want to implement such functionality in a different, more generic and feature-rich way, of course, but this was just an idea.)

I posted my solution in case someone else might need it.
User avatar
Oliver Georgi
Site Admin
Posts: 9919
Joined: Fri 3. Oct 2003, 22:22
Contact:

Post by Oliver Georgi »

might be and I agree - but this will work for 1 article only. You - at the moment - only need 1. Hm but I want to have 5 and the second should be the first and then number 3 - and so on...

Believe me! It's stupid to have settings again and again! Use teasers for portal like page! Think about your content structure! Better to split such page.

Oliver
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон
Nik2004
Posts: 132
Joined: Mon 9. Aug 2004, 14:31
Location: Athens,Greece

Post by Nik2004 »

I have trouble finding documentation and examples of teaser content part usage (I got confused with threads describing teaser hack etc. and phpwcms-docu.de does not include documentation about it). Can someone provide some detailed info and examples?
User avatar
Jensensen
Posts: 3000
Joined: Tue 17. Oct 2006, 21:11
Location: auf der mlauer

Post by Jensensen »

{so_much} | Knick-Knack. | GitHub
Umlaute im URL sind meistens immer Kacke.
Post Reply