Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2012-12-21 07:12:51
- kr37
- Member
- From: Colorado
- Registered: 2011-11-06
- Posts: 28
How to use article_custom in a plugin?
Hello, I’m getting an error when trying to call article_custom inside a plugin. I’m trying to take code that was in a Page (tabber_calupdate) and move it into a plugin, but I’m having trouble accessing the article_custom function from PHP inside the plugin.
The code that works in the Page is this:
<txp:article_custom status="live" section="3-at-the-center, 4-branches" time="any" sort="posted asc" limit="999" >
<txp:if_category name="no-calendar"><txp:else />
<txp:if_expired ><txp:else />
<OPTION VALUE="<txp:article_id />"><txp:if_expires ><txp:posted format="%b %d" />-<txp:expires format="%b %d"/></txp:if_expires>:: <txp:custom_field name="Calendar Text" /></OPTION>
</txp:if_expired>
</txp:if_category>
</txp:article_custom>
In the plugin, I thought I could start by getting the results of article_custom, as shown here:
$ac = article_custom(array(
'status' => "live",
'section' => "3-at-the-center, 4-branches",
'time' => "any",
'sort' => "posted asc",
'limit' => "999"
));
var_dump($ac);
But it returns Fatal error: Call to undefined function article_custom()
Thank you in advance for any help with this!
Offline
Re: How to use article_custom in a plugin?
article_custom()
is defined in textpattern/publish.php
, which is probably not included at this step (admin-side plugin?), probably for a good reason. You can still try to include_once(txpath.'publish.php')
, but the result is unpredictable.
Last edited by etc (2012-12-21 08:48:19)
Offline
#3 2012-12-21 14:02:05
- kr37
- Member
- From: Colorado
- Registered: 2011-11-06
- Posts: 28
Re: How to use article_custom in a plugin?
Thank you, that makes good sense.
Offline