Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#51 2011-03-22 22:16:15

pdgtextpattern
New Member
Registered: 2011-03-22
Posts: 1

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

Would this plugin be the simplest way to get one and only one “article” to show on the home (default) page?
It seems unbelievable to me that I can’t assign a new “article” to the section “default” so that I can place editable text and photos on the homepage.

(TP seems to be more a blog engine right out of the box than a lightweight CMS for corp. websites.) Am I missing something? I searched this whole thread, and 3 answers come up; this topic was the closest.

I’m eager to master this CMS, so thanks for the help!

Offline

#52 2011-03-22 22:34:05

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 9,721
Website

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

pdgtextpattern wrote:

Would this plugin be the simplest way to get one and only one “article” to show on the home (default) page?

Probably. But it depends :-)

You’re right that the default theme (if you want to call it that!) at the moment is a little more blog-oriented than corp site oriented. That will change, but for now we’ve just not altered it.

It seems unbelievable to me that I can’t assign a new “article” to the section “default”

The default section a.k.a. Home Page is just a place where TXP (by default) pulls in articles from all other Sections that have Show on Front page set to ‘Yes’. And, again by default, the content defaults to “most recent first” so you’ll see the most recent 10 articles from all such Sections.

So yes you can’t directly assign an article to the home page using the <txp:article /> tag but you can do it with <txp:article_custom /> by giving it the ID of the article you want to place there among your HTML markup. Then it’ll dutifully bring in that article and place it there all the time if you put that tag in your default Page template somewhere.

If you are always going to have the same article there, this is all you need to do: don’t worry about the plugin. But if you want to perhaps in future show another article here then you would need to instruct whoever is running the site to alter the article ID in that tag.

Under these circumstances it is sometimes nicer to show them the smd_featured interface and say “unclick the one you don’t want on the front page any more and click the one you do”. It just depends how savvy your client is.

If the content doesn’t alter that much and you don’t need the full power of this plugin, another approach is perhaps to set up a Form called “front_page” and do this <txp:variable name="frontpage">42</txp:variable>. Make sure you ‘include’ that form in your page flow (somewhere near the top) using <txp:output_form form="front_page" />, then in your default Page template put this article_custom tag:

<txp:article_custom id='<txp:variable name="frontpage" />' />

You tell your client to edit that ‘front_page’ Form and change the number to the ID of the article they want. If you want a more automated process for this, consider the adi_variables plugin which just puts a sexier interface onto the above process.

Lots of ways to approach it. Just depends which one you prefer.

Hope some of that is useful.


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

#53 2011-05-12 19:37:28

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 9,721
Website

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

New version available. v0.40 brings a wealth of goodness, mostly thanks to feedback from pieman. Features:

  • Added positional sorting. A new box in the lower left of each cell allows you to rapidly reorder the articles on a per-label basis
  • Allowed label/title/desc to be optional (only administrator accounts can alter the settings)
  • Removed ‘Are You Sure’ message if label+title+desc not used
  • Added full Write tab edit links to each cell (the arrow in the bottom-right corner) and to the Edit panel (click the article’s title)
  • Added some of the previously hidden prefs to the interface
  • Made textile prefs global (previous settings will be lost on upgrade, sorry)
  • Global prefs only editable by Publisher accounts
  • <txp:smd_featured /> default sort order now feat_position asc, Posted desc

Hopefully this version is another step up for your featured articles. As I say, most of the stuff is courtesy of pieman’s feedback so big props to him. Let me know how you get on with it.


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

#54 2011-07-15 20:05:15

laptophobo
Member
Registered: 2010-03-01
Posts: 216
Website

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

Hi Stef,

I noticed that when I select “hidden” within my article’s “status” options, the article does not hide. Could this have anything to do with my smd_featured plug-in?


Living the Location-Independent Life: www.NuNomad.com

Offline

#55 2011-07-15 23:34:01

laptophobo
Member
Registered: 2010-03-01
Posts: 216
Website

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

Nevermind about the above posting. It’s a browser cache thing that was viewing the article when it really was hidden.


Living the Location-Independent Life: www.NuNomad.com

Offline

#56 2011-12-02 03:12:31

maniqui
Moderator
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

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

I noticed something: that if there is any space in the value passed to the label attribute, then the plugin doesn’t work.

Works:

<txp:smd_featured label="featured_home">...</txp:smd_featured>

Doesn’t work:

<txp:smd_featured label="featured_home ">...</txp:smd_featured>

This becomes a real issue when trying to do some tags-in-tags trick, like:

<txp:smd_featured label='<txp:yield />'>...</txp:smd_featured>
// or 
<txp:smd_featured label='<txp:variable name="some_var" />'>...</txp:smd_featured>

I’m not sure if it’s something affecting just this plugin (my bet) or TXP in general (don’t recall noticing it before, and certainly it doesn’t happens on every situation).

For the time being, the workaround will be to trim the value using smd_wrap :)


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#57 2011-12-02 13:35:44

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 9,721
Website

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

maniqui wrote:

I noticed something: that if there is any space in the value passed to the label attribute, then the plugin doesn’t work.

Thanks for spotting that. Fixed in v0.41.

Also added a feature that was requested ages ago and I forgot to release: the ability to add section_list to the admin tab’s url and have it filter your articles by section. This assumes that the administrator hasn’t restricted the section list already: if they have, the URL param is ignored. This feature is quite handy if you’re directing people to the featured tab from another admin-side tab (e.g. from smd_tabber) and you want to limit the huge list of articles on offer. Thanks to mickmelon for the idea.


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

#58 2012-01-11 22:08:33

rossharvey
Member
From: Earth. Sometimes.
Registered: 2005-03-16
Posts: 233
Website

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

Hi Stef. Great plugin (the fact you added extra fields is perfect), but one problem (TXP 4.4.1):

The descriptions that I add (and save) to featured articles disappear upon being un-featured, then re-featured. I have to re-type them, which is a bit of a pain.

I only have the description enabled (not labels or titles), and textile is disabled in all cases. Since I only feature one article, positions are not being used either.

Any ideas?

Last edited by rossharvey (2012-01-11 22:10:57)

Offline

#59 2012-01-11 22:21:40

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 9,721
Website

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

rossharvey wrote:

The descriptions that I add (and save) to featured articles disappear upon being un-featured

That’s a, ummm, feature :-) Well, sort of. Before I delve into the whys and wherefores, can I ask how you are using the plugin? It might be that your definition of how to feature an article differs to how I envisaged it or how the plugin is designed to work.

If you’re unfeaturing and re-featuring an article then yes, the act of unfeaturing deletes the entry entirely from the database so your text will disappear too. The worflow I envisaged was:

“I need to put a bunch of articles front and centre on my site: this one, that one, and that one. There, done.”

Two weeks later you want to pimp something else so — since your original articles have served their purpose on your front / landing page — you unfeature them and feature some other articles, adding descriptions for those instead. When you save, they’re instantly promoted to the front page. Re-featuring stuff wasn’t part of the plan.

However, to effect your workflow, you could cheat somewhat.

  1. Feature some articles and give them a label.
  2. Use that label in your <txp:smd_featured /> tag.
  3. Behind the scenes, go and feature some more articles but give them a different label. Nothing will happen (yet).
  4. When you’re ready to switch over, just change the label in your <txp:smd_featured/> tag and blammo, the new articles will appear on your site (your old ones will still be available on the Featured Articles tab)
  5. If you ever want to re-feature them, either use the original label in the front-side tag, or (if you want to feature a different set that includes some of the original featured articles), make a new label with the new articles assigned to it, then re-assign one or two of the old articles to the new label.

Does that help at all?

EDIT: if you want to make it simpler for a client to use, you could use adi_variables to create a variable to hold the name of the label to use in your tag and use <txp:smd_featured label='<txp:variable name="frontpage_label" />' /> to read it.

Last edited by Bloke (2012-01-11 22:25:17)


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

#60 2012-01-11 22:32:19

rossharvey
Member
From: Earth. Sometimes.
Registered: 2005-03-16
Posts: 233
Website

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

Thanks for the quick reply. The reason being, if there is a bit of ‘quiet time’, it would be nice to re-feature an old, popular, post. As this won’t happen too often, it won’t hurt to re-type. I wasn’t sure if there was a problem you see :¬)

If I need to store them permanently, the easiest thing to do would be to keep a text file with article ID and custom description. Copying and pasting that back in would be quite simple to do.

Thanks again for the plugin, it’s extremely useful.

Last edited by rossharvey (2012-01-11 22:32:54)

Offline

Board footer

Powered by FluxBB