Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2009-12-29 22:22:50
- richtestani
- Plugin Author
- Registered: 2009-11-08
- Posts: 128
View articles by day
Is there a way to view a single days articles?
I have a situation where the client wants a calendar, but only to view the day’s events (there will apparently be many events).
Any help in this area would be great.
Thanks
Rich
Offline
Re: View articles by day
<txp:article_custom form="your_form" month="2009-12-29" />
or
<txp:article_custom form="your_form" month='<txp:variable name="month" />'
and build the variable from Year – Month – Day so it has the same format.
I think Stef has written a calendar/events plugin – one of the few of “Blokes” plugins that I don’t use … yet.
It might be worth checking out … as it probably sings and dances too.
Geoff
There are 10 types of people in the world: those who understand binary, and those who don’t.
Offline
#3 2009-12-30 16:18:27
- richtestani
- Plugin Author
- Registered: 2009-11-08
- Posts: 128
Re: View articles by day
This is helpful, and I’ve attempted to set the variable, but I cannot tell if its being set.
Would this be the correct approach?
<txp:php>
if(isset($_GET['day'])) {
$today = $_GET['day'];
} else {
$today = date('Y-m-d');
}
echo ‘<txp:variable name=“month” value=”$today” />’;
</txp:php>
<txp:article_custom listform="section" section="calendar" sort="posted" status="live" month='<txp:variable name="month" />' />
This code displays all events, so it seems the month variable isnt setting. Is there a way to test the variable output?
I’ve place the variable tag down and nothing is output, but im not sure if its supposed to write to screen.
Thanks
Rich
Offline
#4 2009-12-31 00:36:18
- rsilletti
- Moderator
- From: Spokane WA
- Registered: 2004-04-28
- Posts: 707
Re: View articles by day
You might give this a spin and see if it suits. ras_if_dates_v4.2.0.txt
Offline
Re: View articles by day
richtestani wrote:
Would this be the correct approach?
- In PHP code between single (
'
) quotes is not parsed by PHP’s parser. Instead everything is returned as a string. - TXP’s parser can not parse what it can not see.
How it would work:
<txp:variable name="month" value='<txp:php> echo (gps("day")) ? gps("day") : date("Y-m-d"); </txp:php>' />
richtestani wrote:
Is there a way to test the variable output?
Outputs value:
<txp:variable name="month" />
Tests if variable is set:
<txp:if_variable name="month">
Is set.
</txp:if_variable>
Tests if value matches:
<txp:if_variable name="month" value="">
Is empty.
</txp:if_variable>
Offline
Pages: 1