Page 1 of 1

[SOLVED] article content sorting is not correct - dev 1.1.9

Posted: Tue 1. Feb 2005, 02:50
by purnsam
Hi!

I'm using dev 1.1.9 now and found that article move up/down function is not correct. Please look attached image - compare status bar path and reail content part ID.

Is this bug?

Here is image.

Image
real ID = 38 and 42, status path = 38 and 47


Image
real ID = 38 and 43, status path = 38 and 39

Regards,

Posted: Tue 1. Feb 2005, 08:09
by rushclub
do you have set the right sortation in the admin area. there you have different possibilities to sort different categories. take a look in there. you have to set the categorie to »manual (arrow up/down)«

cheers
rush

Posted: Tue 1. Feb 2005, 08:25
by Oliver Georgi
do you use content anywhere?

Oliver

manual arrow up/down is already set.

Posted: Tue 1. Feb 2005, 09:31
by purnsam
rushclub wrote:do you have set the right sortation in the admin area. there you have different possibilities to sort different categories. take a look in there. you have to set the categorie to »manual (arrow up/down)«

cheers
rush
yes. manual arrow up/down is already set.

I use content anywhere

Posted: Tue 1. Feb 2005, 09:33
by purnsam
Oliver Georgi wrote:do you use content anywhere?

Oliver
When I use content anywhere, this sorting problem happens.

Posted: Tue 1. Feb 2005, 09:36
by Oliver Georgi
OK, what I thought - is not really a sorting problem.

It always sorts all content parts - including the one selected for content anywhere. Will be changed later.

Oliver

Found answer!

Posted: Wed 2. Feb 2005, 01:41
by purnsam
Oliver Georgi wrote:OK, what I thought - is not really a sorting problem.

It always sorts all content parts - including the one selected for content anywhere. Will be changed later.

Oliver
According to your advice, I changed include/inc_tmpl/articlecontent.list.tmpl.php

line 162

from
" ORDER BY acontent_sorting, acontent_id;";

to

" ORDER BY acontent_block, acontent_sorting, acontent_id;";

Not, it's solved.

Thanks for your advice, Oliver.

Posted: Wed 2. Feb 2005, 08:05
by Oliver Georgi
hey thanks, that solves part 1 ;-)

Oliver

Posted: Wed 2. Feb 2005, 08:22
by Oliver Georgi
Ok you have forced me to do the rest too ;-)

In include/inc_tmpl/articlecontent.list.tmpl.php starting at line 160 change as follow and ending above this line of comment:

Code: Select all

//Listing zugehöriger Artikel Content Teile

Code: Select all

			$sql  = "SELECT acontent_id, acontent_sorting, acontent_trash, acontent_block FROM ".DB_PREPEND."phpwcms_articlecontent ";
			$sql .= "WHERE acontent_aid=".$article["article_id"]." ORDER BY acontent_block, acontent_sorting, acontent_id";
			if($result = mysql_query($sql, $db) or die("error while listing contents for this article")) {
				$sc = 0; $scc = 0; //Sort-Zwischenzähler
				while($row = mysql_fetch_row($result)) {
					$scc++;
					if($row[2] == 0) {
						$sc++;
						$sbutton[$sc]["id"]    = $row[0];
						$sbutton[$sc]["sort"]  = $row[1];
						$sbutton[$sc]["block"] = $row[3];
					}
				}
			}
			if($sc) {
				//Jetzt aufbauen der Sortieranweisung
				foreach($sbutton as $key => $value) {
					if($key == 1) {
						// if 1st content part in list
						$sbutton[$key]["top"] = "<img src=\"img/button/sort_top_0.gif\" border=\"0\">";
						
					} elseif(isset($sbutton[$key-1]["block"]) && $sbutton[$key-1]["block"] != $sbutton[$key]["block"]) {
						// if this content part is selected for different block than previous
						$sbutton[$key]["top"] = "<img src=\"img/button/sort_top_0.gif\" border=\"0\">";
						
					} else {
						$sbutton[$key]["top"] = "<a href=\"include/inc_act/act_articlecontent.php?sort=".
						$sbutton[$key]["id"].":".$sbutton[$key-1]["sort"]."|".
						$sbutton[$key-1]["id"].":".$sbutton[$key]["sort"].
						"\" title=\"".$BL['be_article_cnt_up']."\"><img src=\"img/button/sort_top_1.gif\" border=\"0\"></a>";
					}
					if($key == $sc) {
						// if this is the last content part in list
						$sbutton[$key]["bottom"] = "<img src=\"img/button/sort_bottom_0.gif\" border=\"0\">";
					
					} elseif(isset($sbutton[$key+1]["block"]) && $sbutton[$key+1]["block"] != $sbutton[$key]["block"]) {
						// if this is the last content part in current block and next is different
						$sbutton[$key]["bottom"] = "<img src=\"img/button/sort_bottom_0.gif\" border=\"0\">";
					
					} else {
						$sbutton[$key]["bottom"] = "<a href=\"include/inc_act/act_articlecontent.php?sort=".
						$sbutton[$key]["id"].":".$sbutton[$key+1]["sort"]."|".
						$sbutton[$key+1]["id"].":".$sbutton[$key]["sort"].
						"\" title=\"".$BL['be_article_cnt_down']."\"><img src=\"img/button/sort_bottom_1.gif\" border=\"0\"></a>";
					}
					$sbutton_string[$sbutton[$key]["id"]] = $sbutton[$key]["top"].
					"<img src=\"img/leer.gif\" width=\"1\" height=\"1\">".
					$sbutton[$key]["bottom"];
				}
				unset($sbutton);
			}

Perfect!!!

Posted: Wed 2. Feb 2005, 08:46
by purnsam
Thanks! Oliver.

Now, sorting in block is perfect. :D