Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#145 2013-04-19 15:21:54

FCS_Websites
Member
From: Nottingham, UK
Registered: 2009-03-23
Posts: 19
Website

Re: stm_article_order: Arbitrary sort order for your articles

Hi guys,

Great work on resurrecting this plugin, clients love it :)

I’m a bit confused about versions here – are there two development forks going on? (0.24 and 0.3)

I’m trying to get stm_link_to_prev and next working with little success, tried both forks and updated to TXP 4.5.4 too.

Cheers, Nick


“Eat food. Not too much. Mostly plants.” – Michael Pollan

Offline

#146 2013-04-19 15:44:47

springworks
Member
Registered: 2005-01-06
Posts: 172
Website

Re: stm_article_order: Arbitrary sort order for your articles

FCS_Websites wrote:

Hi guys,

Great work on resurrecting this plugin, clients love it :)

I’m a bit confused about versions here – are there two development forks going on? (0.24 and 0.3)

I’m trying to get stm_link_to_prev and next working with little success, tried both forks and updated to TXP 4.5.4 too.

Cheers, Nick

Hi Nick

I’m not sure there are two branches being developed!

I added the section choice bits to the latest version of the plugin that Uli had released (0.2.4) and I upped the version number to 0.3. So 0.3 is 0.2.4 with the ability to choose which sections are included in the drag and drop interface to order articles.

If anyone else wants to continue development from where it stands now, that’s fine by me.

I’m afraid I don’t use stm_link_to_prev or stm_link_to_next and haven’t looked into how they work so can’t help you out with that at the moment.

Offline

#147 2013-04-23 17:44:53

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

Re: stm_article_order: Arbitrary sort order for your articles

Hi everyone,

I’ve withdrawn a little from this plugin and topic, for several reasons. Now I’ve installed the 0.3 version for the first time and want to clear some of my “backlogs”.

Steve, thanks for pushing this plugin quite a bit further. I’ve always treated sections to hide via CSS but knew it wasn’t an adequate way even for site admins. Good to have a clean special panel for this now. Thanks!

Like you, I don’t see two different branches and would add my changes to the latest, most recent version of the plugin.

Nick, the prev/next tags had been announced by trenc but haven’t been tested enough, I believe. Hope they’ll be published soon, quite useful to have.

Jens has made one several improvements to the image handling of the code. Thanks, Jens!
Final code see below.

{Edited link.}

Last edited by uli (2013-05-10 22:07:38)


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

Offline

#148 2013-05-08 18:10:06

jens31
Plugin Author
From: munich / dtschermani
Registered: 2008-08-25
Posts: 183
Website

Re: stm_article_order: Arbitrary sort order for your articles

yo

was a bit unhappy with the above solution since it expects jpgs. but what about gif & png?
so i digged into redbot’s fine plugins and stole some parts out of it to get the image and its extension. thanks redbot ;)

so please feel free to replace: Please ignore, even better fix below.

				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>";
				}else{
				$tmp .= '<span class="article_title status_'.$article['Status'].'">'.$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:

				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>";
				} else if (is_string($article['Image'])) {
					$img = explode(",", $article['Image']);
					$rs = safe_rows('ext,id', 'txp_image', 'id in ('.$img[0].')');
					extract($rs);
					$tmp .= '<span class="article_title status_'.$article['Status'].'"><a href="index.php?event=image&step=image_edit&id=' . $img[0] . '" title="Edit image" class="image-edit"><img class="article-img" src="'.hu.$img_dir.'/' . $rs[0]['id'] . 't' . $rs[0]['ext'] . '" /></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>";
				} else {
					$tmp .= '<span class="article_title status_'.$article['Status'].'">'.$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>";
				}

(i didnt touch the first arguement thought, just my part..)

Last edited by uli (2013-05-10 22:01:37)

Offline

#149 2013-05-08 20:34:16

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

Re: stm_article_order: Arbitrary sort order for your articles

Thanks, Jens, another milestone that’s been needed!
Some more progress: I tried a portion of your code for the is_numeric part of the switch and it worked :)

So the replacing goes: Search for Please ignore, even better fix below.

				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>";

				}else{

				$tmp .= '<span class="article_title status_'.$article['Status'].'">'.$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>";

				}

Replace with:

				if(is_numeric($article['Image'])){
					$img = explode(",", $article['Image']);
					$rs = safe_rows('ext,id', 'txp_image', 'id in ('.$img[0].')');
					extract($rs);
					$tmp .= '<span class="article_title status_'.$article['Status'].'"><a href="index.php?event=image&step=image_edit&id=' . $img[0] . '" title="Edit image" class="image-edit"><img class="article-img" src="'.hu.$img_dir.'/' . $rs[0]['id'] . 't' . $rs[0]['ext'] . '" /></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>";
				} else if (is_string($article['Image'])) {
					$img = explode(",", $article['Image']);
					$rs = safe_rows('ext,id', 'txp_image', 'id in ('.$img[0].')');
					extract($rs);
					$tmp .= '<span class="article_title status_'.$article['Status'].'"><a href="index.php?event=image&step=image_edit&id=' . $img[0] . '" title="Edit image" class="image-edit"><img class="article-img" src="'.hu.$img_dir.'/' . $rs[0]['id'] . 't' . $rs[0]['ext'] . '" /></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>";
				} else {
					$tmp .= '<span class="article_title status_'.$article['Status'].'">'.$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>";
				}

Thanks again, Jens.

Last edited by uli (2013-05-10 22:01:12)


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

Offline

#150 2013-05-10 20:02:04

jens31
Plugin Author
From: munich / dtschermani
Registered: 2008-08-25
Posts: 183
Website

Re: stm_article_order: Arbitrary sort order for your articles

moin

found a bug in the above solution: if article image === empty { do stuff like its a string }. dont x me why. that causes the mysql query to suck, cause $img[0] would be emtpy then. may i introduce the fix? yes, please:

search:

				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>";

				}else{

				$tmp .= '<span class="article_title status_'.$article['Status'].'">'.$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>";

				}

replace:

				if(is_numeric($article['Image'])){
					$rs = safe_rows('ext,id', 'txp_image', 'id in ('.$article['Image'].')');
					extract($rs);
					$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.'/' . $rs[0]['id'] . 't' . $rs[0]['ext'] . '" /></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>";
				} else if (is_string($article['Image'])) {
					$img = explode(",", $article['Image']);
					if ($img[0]) {
						$rs = safe_rows('ext,id', 'txp_image', 'id in ('.$img[0].')');
						extract($rs);
						$tmp .= '<span class="article_title status_'.$article['Status'].'"><a href="index.php?event=image&step=image_edit&id=' . $img[0] . '" title="Edit image" class="image-edit"><img class="article-img" src="'.hu.$img_dir.'/' . $rs[0]['id'] . 't' . $rs[0]['ext'] . '" /></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>";
					} else {
						$tmp .= '<span class="article_title status_'.$article['Status'].'">'.$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 jens31 (2013-05-10 20:07:47)

Offline

#151 2013-05-10 21:59:10

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

Re: stm_article_order: Arbitrary sort order for your articles

Thanks for paying attention, Jens. I’ll go sprinkling some links across the above posts now ;)


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

Offline

#152 2014-08-05 16:09:52

RedFox
Member
From: Netherlands
Registered: 2005-03-25
Posts: 809
Website

Re: stm_article_order: Arbitrary sort order for your articles

Wouldn’t it be nice if this plugin could do its trick within article categories too .. :))

Offline

#153 2014-08-06 15:14:36

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

Re: stm_article_order: Arbitrary sort order for your articles

Joop, hablablow asked that or similar already (see my reply there) and spoke about a planned attempt to swap categories for sections. You could ask him whether his plans made it into code.


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

Offline

#154 2014-08-06 22:12:09

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

Re: stm_article_order: Arbitrary sort order for your articles

Joop and Uli, isn’t that what esq_sectionsort does?

Offline

#155 2014-08-09 13:18:48

RedFox
Member
From: Netherlands
Registered: 2005-03-25
Posts: 809
Website

Re: stm_article_order: Arbitrary sort order for your articles

Els wrote #282681:

Joop and Uli, isn’t that what esq_sectionsort does?

I don’t think so, Els. I just wondered if it would be possible to rearrange (drag and drop) articles in a specific categorie … and I mean articles from more than one (1) section. Now I have to use the default method by giving each article a specific, new date. It’s a hassle for some clients. Well, for me too … ;-)

Offline

#156 2014-08-09 19:30:04

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

Re: stm_article_order: Arbitrary sort order for your articles

Joop, if you don’t need to assign categories to articles by drag’n‘dropping them, and rather need to have visual dividers, you could use some extra (hidden & expired) articles to create elements, i.e. category placeholders, in the article order page. I’ve done so already for one of my clients and left the necessary CSS in place. You can see two of these dividers in the first screenshot here.
In case that’s sufficient I can advise you how to proceed.

Last edited by uli (2014-08-09 19:31:41)


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

Offline

Board footer

Powered by FluxBB