Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: smd_featured: Quickly pull articles to your home / landing pages
Ack, sorry for the double version bump in one day. v0.34 adds <txp:else />
support to the <txp:smd_featured />
and <txp:smd_unfeatured />
tags so you can take action if they don’t return anything.
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
Re: smd_featured: Quickly pull articles to your home / landing pages
Hello Stef,
Maybe you can help with this item. I’m trying to get a “view older articles” attribute to work with smd_featured. So far, no luck. This is what I have so far. Do you see the problem (I don’t.).
Thanks for your time!
-Richard
<txp:smd_featured label=“feature” wraptag=“div” html_id=“main_feature”>
<h2><txp:permlink><txp:title /></txp:permlink></h2>
<p><txp:posted format=”%m-%d-%Y” /></p>
<p class=“leadin”><txp:excerpt /></p>
<p><a href=”<txp:permlink />” title=”<txp:title />”> Read More </a></p>
<br />
<txp:if_last_article><ul class=“directory”>
<txp:older><span class=“txtSmall”>View Older Articles</span></txp:older></txp:if_last_article>
</txp:smd_featured>
Living the Location-Independent Life: www.NuNomad.com
Offline
#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
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
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 nowfeat_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
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
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
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 :)
Offline
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
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
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.
- Feature some articles and give them a label.
- Use that label in your
<txp:smd_featured />
tag. - Behind the scenes, go and feature some more articles but give them a different label. Nothing will happen (yet).
- 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) - 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
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