Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2010-03-08 10:41:22

woof
Member
Registered: 2004-08-01
Posts: 128

...include articles with status "Draft" in output?

Hello all,

Is there a way to have txp:article_custom include articles with draft status in its output? According to the Tag Reference there are just 2 values for the status attribute: “live” and “sticky”.

I know its odd to want to include a draft, but I have my reasons :-)

thanks, John

Offline

#2 2010-03-08 11:02:57

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,868
Website GitHub

Re: ...include articles with status "Draft" in output?

As far as I can tell, there is not (though I’ll gladly be proven wrong). The code in publish.php tests for status = sticky and otherwise sets “live” as default. I too had a need for this and hacked my installation in a few key places to get this to work. The other way is to use smd_query which might serve your purposes too. Email me if you want to know more.


TXP Builders – finely-crafted code, design and txp

Offline

#3 2010-03-08 11:04:11

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: ...include articles with status "Draft" in output?

woof wrote:

Is there a way to have txp:article_custom include articles with draft status in its output?

No. You can try out smd_query to create your own queries, or something similiar. Article_custom can not retrieve those articles — atleast not without hacking the core.

Edit. the faster is jakob :-)

Last edited by Gocom (2010-03-08 11:05:33)

Offline

#4 2010-03-08 11:59:46

woof
Member
Registered: 2004-08-01
Posts: 128

Re: ...include articles with status "Draft" in output?

Thank you both.

[Edit] I did a bit of digging and discovered that the venerable chh_article_custom can filter articles by all statuses (stati?).

Probably using a sledgehammer to crack a nut and I guess an smd_query solution would be leaner but — its a solution and it works a treat.

Offline

#5 2010-03-08 12:35:33

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,868
Website GitHub

Re: ...include articles with status "Draft" in output?

the venerable chh_article_custom can filter articles by all statuses

if you can get it to work with more recent versions of txp. Most of the time it throws errors. If you’re lucky they vanish once you set txp to live but it still works.


TXP Builders – finely-crafted code, design and txp

Offline

#6 2010-03-08 12:39:18

woof
Member
Registered: 2004-08-01
Posts: 128

Re: ...include articles with status "Draft" in output?

@jakob Thanks – I knew it was too good to be true, I tried it out on a production status= live site so didn’t see the errors. Oh well.

Offline

Board footer

Powered by FluxBB