Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#109 2011-05-26 16:15:20

Teemu
Member
From: Shanghai
Registered: 2010-04-27
Posts: 60

Re: stm_article_order: Arbitrary sort order for your articles

Thanks Uli and GUg for quick responses. I did some trial and error and found that if I disable MLP, it works.

I guess next question is if anybody got it working with MLP – The Multi-Lingual Publishing Pack?

Offline

#110 2011-05-26 16:20:12

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,303

Re: stm_article_order: Arbitrary sort order for your articles

A possible step before might be altering the load order of any of both plugins.


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#111 2011-05-26 16:34:43

sacripant
Plugin Author
From: Rhône — France
Registered: 2008-06-01
Posts: 479
Website

Re: stm_article_order: Arbitrary sort order for your articles

Offline

#112 2011-05-26 16:42:08

Teemu
Member
From: Shanghai
Registered: 2010-04-27
Posts: 60

Re: stm_article_order: Arbitrary sort order for your articles

MLP has the load order “1” by default and therefore kicks in first. I made an experiment by loading smt_article_order first and then MLP second. Doesn’t help.

Offline

#113 2011-05-26 17:47:34

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: stm_article_order: Arbitrary sort order for your articles

Teemu wrote:

…found that if I disable MLP, it works.

As far as I know MLP doesn’t work with plugins that make changes to the textpattern table.

Last edited by els (2011-05-26 17:47:45)

Offline

#114 2011-05-27 07:53:15

Teemu
Member
From: Shanghai
Registered: 2010-04-27
Posts: 60

Re: stm_article_order: Arbitrary sort order for your articles

Little progress. MLP creates separate articles table for each language. So the “position” column was missing from these tables since I installed stm_article_order after MLP.

I re-installed MLP and the column “position” is now in each language article table also. No errors.

What I need now is stm_article_order to update the “position” column also in each language article table.

Now, as my programming skills are limited, I’m wondering if there would be anyone willing to help or point to me right direction.

Offline

#115 2011-05-27 10:07:06

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,303

Re: stm_article_order: Arbitrary sort order for your articles

Teemu wrote:

Now, as my programming skills are limited, I’m wondering if there would be anyone willing to help or point to me right direction.

The central relevant line should be around line 18

safe_update("textpattern", "position = $position, Section = '$section'", "ID = $ID");

Try duplicating this line and exchanging textpattern for the MLP table name. Have a look whether all position, Section, and ID are part of the MLP table, and control the use of upper and lower case.

Good luck! :)


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#116 2011-05-27 10:36:12

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,303

Re: stm_article_order: Arbitrary sort order for your articles

Teemu, make a backup of your DB, your MLP table will probably get corrupted with the first saving.


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#117 2011-05-27 13:16:29

Teemu
Member
From: Shanghai
Registered: 2010-04-27
Posts: 60

Re: stm_article_order: Arbitrary sort order for your articles

Uli,

First of all, thank you for great prompt support. I had figured out that important line in the code already but I was changing other things also, with no luck of course.

Following your suggestion I only duplicated the line for the language tables and voila…. so far so good, seems to be working!

Offline

#118 2011-05-27 13:44:39

Teemu
Member
From: Shanghai
Registered: 2010-04-27
Posts: 60

Re: stm_article_order: Arbitrary sort order for your articles

As we got this rolling… I have one more support question.

If article has multiple images, there’s no image thumbnail shown in the stm_article_order table. Any possibility that the plugin would pick the first image listed in the article image field?

Offline

#119 2011-05-27 21:37:30

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,303

Re: stm_article_order: Arbitrary sort order for your articles

Teemu wrote:

Following your suggestion I only duplicated the line for the language tables and voila…. so far so good, seems to be working!

Wow! Hadn’t expected that result! And you still have multiple languages, i.e. the contents of table “textpattern” don’t simply overwrite the MLP one?

Any possibility that the plugin would pick the first image listed in the article image field?

If I were able to improve the plugin’s image handling by myself, the thing would display GIFs and PNGs on top of only JPGs, and I’d be happy to make it display the first of multiple images. But.

Last edited by uli (2011-05-27 21:45:45)


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#120 2011-05-28 13:10:51

Teemu
Member
From: Shanghai
Registered: 2010-04-27
Posts: 60

Re: stm_article_order: Arbitrary sort order for your articles

Uli,

I’m not sure what you mean by tables overwriting. Each language version of an article has a different id, these all are in ‘textpattern’ table AND corresponding language table. Why there must be this kind of dublicated table system, I don’t know.

I found a solution also for the problem if article has multiple images, asked for tip from a php forum. Seems to be working ok. I will put the tip here just in case someone else needs it

Starting around line 51 replace this:

if(is_numeric($article['Image'])){
				$tmp .= '<span class="article_title status_'.$article['Status'].'"><a href="index.php?event=image&step=image_edit&id='.$article['Image'].'" title="Edit image" class="image-edit"><img class="article-img" src="'.hu.$img_dir.'/'.$article['Image'].'t.jpg" /></a>'.$article['Title']." <em class='article_id'><a title='Edit article' href='index.php?event=article&step=edit&ID=".$article['ID']."'>(".$article['ID'].")</a></em></span>";

With this:

$split = explode(",",$article['Image']);
$imgid = $split[0];                               
if(is_numeric($imgid)){ 
                               $tmp .= '<span class="article_title status_'.$article['Status'].'"><a href="index.php?event=image&step=image_edit&id='.$imgid.'" title="Edit image" class="image-edit"><img class="article-img" src="'.hu.$img_dir.'/'.$imgid.'t.jpg" /></a>'.$article['Title']." <em class='article_id'><a title='Edit article' href='index.php?event=article&step=edit&ID=".$article['ID']."'>(".$article['ID'].")</a></em></span>";

Last edited by Teemu (2011-05-28 13:20:51)

Offline

Board footer

Powered by FluxBB