Textpattern Forum

You are not logged in. Register | Login | Help

#1 2010-06-17 23:04:30

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 5,902
Website

smd_featured: Quickly pull articles to your home / landing pages

Ever wanted to just ‘feature’ an article or 4 on your home page but still leave it in the article flow for later? Messing around with the Sticky status means complications with extra article tags. Wasting a custom field to mark articles as ‘featured’ seems heavy handed and means you have to train your users to a) put them in, b) find them and remove them when you need to rotate the home page articles.

Lucikly, you can download smd_featured — your one-stop shop for all things featury.

Visit the Content->Featured articles tab and you’ll see a grid of all your articles. Click one. Job done. It’s now tagged as ‘featured’ and you can use the <txp:smd_featured /> tag to display it wherever you like in your Page template.

Click some more articles. Go nuts. They’ll all be displayed by the tag. If you want to unfeature an article, click its name again and confirm. That’s it.

Except it isn’t of course, because this is an smd plugin :-)

When you feature an article you can click the [Edit] button next to it and optionally assign a label, along with some titla and description text (Textiled if you prefer). This info is displayable alongside other article tags when you lay your featured blocks out. So you could use the description as lead-in text to entice the reader to click the link and reserve your excerpt/body/custom fields for regular purposes. The label is a great way to group your articles into, say, ‘featured’ or ‘teaser’ groups and pull them out separately. And when you display your articles, the plugin keeps track of which ones you’ve shown so it doesn’t duplicate them later.

On the admin side, with large numbers of articles it can become difficult to find stuff so there’s a search facility and a dropdown so you can filter the list by label. You can find out more in the help of course. (smd_prefalizer can help you make any hidden prefs you may like to employ).

Works best on TXP 4.3.0 but will work(ish) on 4.20. I hope this proves useful. Share and Enjoy™.

Revision history
————————

All available versions and changes are listed here. Each entry indexes the relevant post(s) in the thread to learn about the features.

  • 18 Jun 2010 | 0.10 | Initial release
  • 07 Sep 2010 | 0.20 | Renamed id column to feat_id ; fixed label attribute bug (both thanks pieman) ; label searches are now exact matches ; added prefs and pagination support for admin side ; added <txp:smd_if_featured> ; added label selection from dropdown during editing (thanks tye)
  • 13 Sep 2010 | 0.21 | Added ‘title’ and Textile options (both thanks bg)
  • 13 Sep 2010 | 0.22 | Fixed missing doSlash() on untextiled html content (thanks bg)
  • 05 Oct 2010 | 0.30 | Use article_custom() not article() to sidestep individual article context (thanks johnstephens) ; pass time and limit to article_custom() ; limit has default of 10
  • 11 Oct 2010 | 0.31 | Better theme integration (thanks thebombsite)
  • 01 Nov 2010 | 0.32 | Added older/newer pagination support to <txp:smd_unfeatured /> and permitted section, status and time filtering ; fixed some styling issues
  • 17 Jan 2011 | 0.33 | Added history attribute (thanks maniqui) ; fixed smd_unfeatured to work correctly in individual article context after the v0.32 regression (thanks johnstephens) ; fixed smd_unfeatured bug to stop txp:article’s default output if unfeatured list empty
  • 17 Jan 2011 | 0.34 | Added txp:else support to featured / unfeatured tags
  • 12 May 2011 | 0.40 | Added positional sorting, allowed label/title/desc to be optional, removed ‘Are You Sure’ message if label/title/desc not used, and added full Write tab edit links (all thanks pieman) ; added hidden prefs to interface ; made textile prefs global (previous settings will be lost on upgrade) ; global prefs only editable by publisher ; <txp:smd_featured /> default sort order now feat_position asc, Posted desc
  • 02 Dec 2011 | 0.41 | Allowed section_list in the admin page’s URL to limit the list of featured articles to the given section(s) (thanks mickmelon) ; fixed trim on label attribute (thanks maniqui)

Last edited by Bloke (2011-12-02 13:40:35)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern.

Txp Builders – finely-crafted code, design and Txp

Offline

#2 2010-06-17 23:47:31

renobird
Member
From: Gainesville, Florida
Registered: 2005-03-02
Posts: 786
Website

Re: smd_featured: Quickly pull articles to your home / landing pages

Proof that you are truly a machine. Gonna check this now…

Offline

#3 2010-06-18 00:50:56

JanDW
Plugin Author
From: Providence, RI, USA
Registered: 2008-07-18
Posts: 327
Website

Re: smd_featured: Quickly pull articles to your home / landing pages

I was just cursing this today… curious to try it out. Thanks!


TXPDream – A Textpattern Tag Library for Adobe Dreamweaver. (updated for 4.2.0) | jdw_if_ajax – Only serve certain parts of a page when requested with AJAX

Offline

#4 2010-06-18 01:47:18

aslsw66
Member
From: Canberra, Australia
Registered: 2004-08-04
Posts: 313

Re: smd_featured: Quickly pull articles to your home / landing pages

I think someone had better write a <txp:smd_sleep /> plugin for Stef!

Offline

#5 2010-06-18 15:37:55

Els
Admin
From: The Netherlands
Registered: 2004-06-06
Posts: 7,388
Website

Re: smd_featured: Quickly pull articles to your home / landing pages

aslsw66 wrote:

I think someone had better write a <txp:smd_sleep /> plugin for Stef!

:D But don’t forget the <txp:smd_wakeup /> for when we need him ;)


<txp:Els /> ;)
Tag Reference | Unexpected behaviour? Check the tag trace | Still no clue? Check the names of your custom fields

Offline

#6 2010-06-18 15:44:15

maniqui
Moderator
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 2,989
Website

Re: smd_featured: Quickly pull articles to your home / landing pages

Let’s add also <txp:smd_feature_request />, for when we (and I’m certainly part of the “we”) need Stef to add that feature that he forgot (how could he, when his plugins have more features than a swiss army knife made of tiny swiss army knifes?) to add on any of its plugins.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#7 2010-06-18 18:56:00

progre55
Member
Registered: 2006-05-02
Posts: 642

Re: smd_featured: Quickly pull articles to your home / landing pages

Please don’t forget the <txp:smd_saved_my_as%$%_again/>, for all of those times you needed a plugin —- thought there was not one and then in a last ditch search discovered Stef had one or even better yet looked at one of Stef’s prolugins — needed it tweaked for your project — and the master delivered —-

Thanks Stef.

Offline

#8 2010-06-19 00:21:10

Els
Admin
From: The Netherlands
Registered: 2004-06-06
Posts: 7,388
Website

Re: smd_featured: Quickly pull articles to your home / landing pages

<txp:smd_we_love_stef />. And I’m serious :)


<txp:Els /> ;)
Tag Reference | Unexpected behaviour? Check the tag trace | Still no clue? Check the names of your custom fields

Offline

#9 2010-06-21 19:36:21

pieman
Member
From: Bristol, UK
Registered: 2005-09-22
Posts: 491
Website

Re: smd_featured: Quickly pull articles to your home / landing pages

Feckin ace. Something like this has been on my wishlist for a long time.

And <TXP:SMD_UNFEATURED /> is the icing on the cake.

Offline

#10 2010-06-21 20:34:29

pieman
Member
From: Bristol, UK
Registered: 2005-09-22
Posts: 491
Website

Re: smd_featured: Quickly pull articles to your home / landing pages

Stef, I’m kicking it around and among all the overall brilliance I found a few unexpected behaviours…

In Mac / Safari Version 4.0.4 (5531.21.10), selecting a label in the Article live search filter wonks the page out.

“Safari is no longer responding because of a script on the webpage ‘Txp › Stuart Charlton › Featured articles’ (http://local.stuartcharlton.com/textpattern/index.php). Do you want to stop running the script, or let it continue?”

Similar effects in Chrome (although if you choose to “wait” for the script it kicks in eventually). No such problems in Mac / Firefox 3.5.9

If no featured articles are labelled, and if the label attr is unset, both featured and not-featured articles are displayed. I suppose this is an unlikely use case, but if you didn’t need multiple types of featured articles it would be easier not to bother with labeling for categorisation (although you might want to use the label field simply for output with <TXP:SMD_FEATURED_INFO />).

I get an error when trying sort="id"

Tag error: <txp:smd_featured wraptag="dl" limit="10" sort="id"> -> Textpattern Warning: Column 'id' in order clause is ambiguous SELECT *, unix_timestamp(Posted) as uPosted, unix_timestamp(Expires) as uExpires, unix_timestamp(LastMod) as uLastMod FROM textpattern AS txp LEFT JOIN smd_featured AS smdfeat ON txp.ID=smdfeat.id WHERE 1=1 AND Posted <= now() AND Status in (4,5) ORDER BY id LIMIT 10 on line 85

There doesn’t seem to be a default value for limit – when unset I thought it would spew 10 like txp:article but I get the full whack

Offline

Board footer

Powered by FluxBB