On the website internaldialogue.org there are 365 daily lessons. I use date(z) on Google gadgets to show the lesson for the day. I'd like to set this up as a View Block without using Google gadgets. The lessons are their own content type with the lesson number a CCK integer field (field_lesson). Using Views to set up a block I can filter by content type (daily lesson) and Integer: Lesson (field_lesson). I can set up the field_lesson to be "equal to" some value like 188 and lesson 188 is displayed.
Is there a way to use PHP in the value field? I've tried:
date(z)
echo date(z)
<? php echo date(z); ?>

I'm guessing that maybe that field does not take PHP.
Can someone point me in the right direction here? I get the feeling that Views should be able to do this pretty easily but I am not experienced enough.
Thanks for any help you can give.

Comments

daniel sanchez’s picture

A year later I have not been able to do this in views.
I've been doing this now outside of drupal just doing something like this:

$today=date(z) + 1;
$query="SELECT * FROM daily_lessons WHERE id=$today";

I've been reading the Views Arguments section, but I can't seem to find a way to do this.
Thank you.

daniel sanchez’s picture

I was finally able to do this using Drupal 6. Using views add an argument. I added an argument for field_lesson. Each lesson I have is numbered by the day it belongs to. Under action to take, select Provide Default Argument. Then check PHP Code. The PHP code I used is

$today=date(z)+1; 
return ($today);

Thanks, Drupal.