Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#25 2010-09-07 17:27:59

kemie
Plugin Author
From: mexico<-->sweden
Registered: 2004-05-20
Posts: 495
Website

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

Yea, I also had to procrastinate loaaads while waiting for this plugin :D

thanks Stef, much appreciated!


~~~~~~~~~~~~~| monolinea.com | pixilate.com | istockphoto.com/kemie |~~~~~~~~~~~~~

Offline

#26 2010-09-07 23:52:21

tye
Member
From: Pottsville, NSW
Registered: 2005-07-06
Posts: 859
Website

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

Stef – do you wear a cape in normal life?

It’s less than 24hours since I made that suggestion :)

Thanks again :)

Offline

#27 2010-09-13 02:42:47

bg
Member
From: Pekin Illinois USA
Registered: 2005-02-20
Posts: 22
Website

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

Hey Sir Bloke! I love this plugin, but I’ve managed to get lost trying to use it.

Okay, maybe I’m just not seeing it after going cross-eyed over this for almost a week, so here’s my….

Question:
Is there a bullet-proof way to disable Textile for the Description field without having to begin the Description with “notextile. “? I’m trying to build a display form that will use the entire Description field (it’s only 18-20 words) as link text. Here’s my display code…

<txp:permlink><txp:smd_featured_info item="description" /></txp:permlink>

… and of course, when Textile is active, this breaks the HTML by placing the link code outside the paragraph markers.

Some of the time — not always … not even often! — I remember to begin with “notextile. “ in the Description field. But I know that when I tell the non-coders who contribute to the site how to use this Featured feature, they will botch it almost always.

Any thoughts?

And now a request:

Is it possible to add a third field to the plugin data? Maybe “Label_2” or some such? I’d like to use that field as an alternate title when I display the Feature Box. I’ve developed a work-around by using a custom field for this, but for various reasons that’s going to become unsatisfactory in the near future.

This is probably not something that I could hack into the plugin because I’m nowhere near a mySQL geek and just barely manage to get by with minimal PHP knowledge.

TIA for all replies!

Peace,

Last edited by bg (2010-09-13 02:43:06)


— Bob

Offline

#28 2010-09-13 12:09:55

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,250
Website GitHub

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

bg wrote:

Is there a bullet-proof way to disable Textile for the Description field

After donning my cape this morning for an hour or so, there is now. Two new features:

  1. Added a pref option to allow you to turn Textile on or off
  2. Added a ‘Title’ entity (which is also Textilable if you wish) to save having to use up a custom field. A second field always comes in handy, right?

Thanks for the ideas.

Let me know how y’all get on with this. Upgrades should be smooth and just add the relevant fields automatically (unless you’re using the plugin cache directory, in which case you’ll be prompted to upgrade). But, as always, please backup first just in case the Pope’s UK visit disrupts the space-time continuum at the moment you click install.

Have fun.

Last edited by Bloke (2010-09-13 12:12:33)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#29 2010-09-13 12:24:27

bg
Member
From: Pekin Illinois USA
Registered: 2005-02-20
Posts: 22
Website

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

Stef, this is absolutely mahhh-velous! I’m going to install the upgrade momentarily.

It’s hard to believe your zippy response. Perhaps we do need an smd_bloke_sleeps plugin, since the smd_bloke_plugin_request works so well.

Thanks again for the quick reply. I’ll let you know if there’s any problem with the upgrade (though I doubt there could be).

Peace,


— Bob

Offline

#30 2010-09-13 14:22:25

bg
Member
From: Pekin Illinois USA
Registered: 2005-02-20
Posts: 22
Website

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

Here’s a follow-up report on the update, Bloke. Seems to be a bit quirky and I haven’t been able to isolate a specific sequence of actions that produces the quirks. But here they are…

BTW, I’m using Textpattern v4.2.0 and the server is running Apache 2.2.16 with PHP 5.2.14 and mySQL 5.0.91. My platform is Mac OSX 10.4.11. Browsers are Camino and Safari (haven’t tried with Firefox).

1 – Using the Control Panel to turn Textile off (or back on) doesn’t always seem to work. Sometimes it does. Sometimes it doesn’t. Even when the tick-boxes show no tick, Textile still seems to process the fields (when the quirk occurs). And occasionally, vice-versa. Clearing browser cache has no effect; nor does quitting and restarting the browser. Clicking the “Featured Articles” tab doesn’t always work consistently, either.

2. Saving changes in the Control Panel requires performing the actions twice. Open CP; click the box; hit “Save” produces no change the first time… box returns to its original state. Click the box and hit “Save” again and the box tick-mark will change, but only on this second attempt.

3. Editing an article’s attributes (Title, Description or Label) from the grid often produces an SQL error. Sometimes this happens when both the article edit box and the Control Panel are both open at the same time. Sometimes happens when only the article edit box is open. Or when only the CP is open!

4. And last but not least… Not all of the Featured articles are processed the same way on the web page! Sometimes (but only occasionally) one of the changes I’ve attempted to make will “stick” and the article will display as I want it to. But other articles (I’m using a rand() sort for testing, then displaying one article at a time) don’t render the same way.

Confusing, huh? Boy howdy you betcha! You can see what’s happening on the page at…

http://stjosephpekin.org/test/

The top image banner and text (immediately below the masthead) are rendered using smd_featured. Refresh the page to run through the random sequence. There are five articles in the series. At the present time these are set for Textile off for both the title and description fields. But as you’ll see, Textile sometimes adds it’s little paragraph markers anyway! The article with the squirrel photo renders the headline properly, but the others do not; Textile adds its little <p> tags! And the copy in the Description field seems always to get Textile’s <p> tags.

Duhhhh… yeah, I be snockered by this one because it’s not always consistent. Any thoughts?

BTW, here’s the text message the SQL error produces (this was generated with Textile still turned “on” for the Description field)…

Warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘s Tootsie time again and our Knights need volunteers to sell ‘em. Can you help? ‘ at line 1 update smd_featured set label=‘Featured’, feat_title=‘Please Help!’, feat_title_html=‘Please Help!’, description=‘notextile. It\‘s Tootsie time again and our Knights need volunteers to sell \‘em. Can you help? Please click…’, desc_html=‘notextile. It’s Tootsie time again and our Knights need volunteers to sell ‘em. Can you help? Please click…’ where feat_id=‘94’ in /home/stjoseph/public_html/textpattern/lib/txplib_db.php on line 85

And here’s the code from the form that renders the output…

<h1><txp:smd_featured_info item=“title” /></h1>

<p>
<txp:permlink><txp:smd_featured_info item=“description” /></txp:permlink>
</p>

Thanks for your help!

Peace,

Last edited by bg (2010-09-13 14:30:26)


— Bob

Offline

#31 2010-09-13 14:55:46

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,250
Website GitHub

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

bg wrote:

Seems to be a bit quirky

Ah, yeah, ahem. Forgot to ask you to re-read the note (now under a bold heading :-) from v0.2. That will probably account for 90% of the quirks. Most certainly points 1 and 2. I’ll make a note of this in the actual plugin help docs too: I forgot, ooops.

Point 3 sounds like I’m not escaping the apostrophes properly in the content, but I’m pretty sure I applied the proper functions… or at least I thought I did. I’ll see if I can replicate the problem with your text on my dev box and go from there.

I’m not quite sure I understand point 4. The <txp:smd_featured /> tag will process all featured articles in its container the same way. The chances are that the problem is also to do with the ‘stickiness’ of the prefs and things getting confusing. My advice is to do the following:

  1. Visit the Featured articles tab (make sure you click it to refresh the page)
  2. Open the control panel and set the properties how you’d like to see them (Textile off for Description, I assume)
  3. Save the prefs
  4. Click the Featured articles tab again to check the settings have been applied
  5. Minimize the control panel and forget about it!
  6. Click the [Edit] button next to each of your featured articles, alter anything you want and hit Save

(OR install the latest SVN and then perform the last step on your featured articles, since the prefs stay put when you apply them so it’s a bit easier!)

The act of hitting Save against each article will apply the current Textile settings to that featured article. It’s like if you alter the default ‘Use Textile’ settings in your TXP Admin prefs: it doesn’t go back and change any of your articles. They still have Textiled (or non-Textiled) content as they always did. The setting only affects the articles when things are saved from that point forward. Does that make sense?

Thus if you change the Textile setting and want to apply it to all your existing featured articles you have to visit each article and resave it. Normally this isn’t a major hassle ‘cos you switch it on or off once and don’t touch it again. Even if you have already featured some articles there’s normally only a handful so I figured it wasn’t worth factoring an ‘apply to all’ button in the interface. The SQL error may well be getting in the way here, btw, because if you save the featured article and it doesn’t make the changes in the database then it’ll still be in the ‘old’ state which could confuse matters somewhat.

I kinda did the docs in a hurry so perhaps I’ll revisit them and make that clearer too. At the same time I’ll see if I can repeat the SQL error and fix that. Dunno how I managed to let that one slip through the net. Shod-tastic, sorry.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#32 2010-09-13 15:11:32

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,250
Website GitHub

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

D’oh! Missed a function if you try and save a non-textiled description with apostrophes in it. Fixed in v0.22. Also updated the docs a bit. Thanks bg.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#33 2010-09-13 16:29:44

bg
Member
From: Pekin Illinois USA
Registered: 2005-02-20
Posts: 22
Website

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

Thanks, Sir Bloke!

That did the trick. I had read the (now boldly marked) IMPORTANT note you mention in your first paragraph but somehow it did not fully register. Instead of going back to the Plugins tab, I clicked the Featured Articles tab to refresh the prefs. Duhhhhh…. (Or maybe Dunce is more appropriate).

All is working beautifully now, so it’s time to take it live! You are a Prince among princes for your wonderful assistance.

Peace,


— Bob

Offline

#34 2010-10-05 01:53:43

johnstephens
Plugin Author
From: Woodbridge, VA
Registered: 2008-06-01
Posts: 999
Website

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

Howdy, Stef!

I’m doing this in a sidebar that is used through most of one site I work on:

<div id="recent-features">
<txp:smd_featured
	break="li"
	unlabel="Recent Features"
	labeltag="h2"
	sort="posted desc"
	wraptag="ul"><txp:permlink><txp:title /></txp:permlink></txp:smd_featured>
</div> <!-- EO #recent-features -->

<div id="recent-articles">
<txp:smd_unfeatured
	break="li"
	label="Recent Articles"
	labeltag="h2"
	sort="posted desc"
	wraptag="ul"><txp:permlink><txp:title no_widow="0"/></txp:permlink></txp:smd_unfeatured>
</div> <!-- EO #recent-articles -->

It works great and awesome, except in individual article context, where it lists the current article— seven times in the first div, using the given wraptag and breaks, and once in the second div, with no wraptag or break. The behavior is identical regardless of whether the current article is featured or not. Is this expected behavior? Is there any way to make a smd_featured article list appear on an individual article page?

Time to revert to the article_custom mashup I had before. Let me know if you need a tagtrace.

Thanks, and warmest regards!

Offline

#35 2010-10-05 04:09:34

visualpeople
Member
From: Corvallis, Oregon - USA
Registered: 2005-11-16
Posts: 73
Website

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

I was just about to post the same thing, John. For now my workaround is just to not have any featured articles show up on individual article pages. I can post code and such, too, but I suspect it’s the exact same problem.

Offline

#36 2010-10-05 12:47:41

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,250
Website GitHub

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

v0.30 is released which attempts to tackle my foolhardy use of the article tag inside the guts of the plugin which, of course, anybody but me could have foreseen would wreak havoc on individual article pages. Thanks to johnstephens for bringing this to my attention.

This raised some other interesting issues with the plugin. Chiefly, since I’m using article_custom() and that has some default attributes set, your lists will be governed by the defaults in that tag. To counter this and make it more obvious what’s going on I’ve set the limit to a default of 10 (the same as article custom). I’ve allowed the time attribute to fall through to the article custom as well.

I spotted this by mistake when I specified time="any" during one of my tests: the plugin was pulling out all the correct articles but only displaying the past ones due to article_custom’s default setting. This should now be fixed and I hope this version is slightly more deterministic!

Since there’s a chance the changes will alter your existing output slightly I’ve bumped the major version number. Have fun.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

Board footer

Powered by FluxBB