Time for this newbie to take the plunge, and touch... oh, sweet mother of mercy... touch PHP!
A Drupal.org forum visitor asked about displaying the date and time on a site. I know there are countless ways to do this using web technologies, including any number of "widgets" available out there. For all I know, there may be a Drupal module that tosses up a block or something, too.
But I know this is the sort of task one can also do easily using PHP, the real guts of Drupal (well, part of the guts, anyway... maybe the pancreas). And it should be easy, too. So as a farewell to my... ahem... chastity with regards to PHP, let me take this oh-so-newbie challenge upon myself.
Google turns up all kinds of stuff. Like this couldn't-be-more-basic, one-size solution: http://www.totallyphp.co.uk/code/display_date_and_time_with_php.htm
Besides some code comments, there's just one line of key code there:
<?php echo date("l, F d, Y h:i" ,time()); ?>Let's try! I make a new block... turn off rich-text input (TinyMCE)... select PHP as my input format... and paste in the code. I save the block and make it display... and there it is, to the left! Stupendous!
Now, that's the barest of starts; I'll add more to this page as I play with more formatting and other options. (Like time zones: that's pretty important!) But wow, I'm now PHP-experienced and it didn't hurt at all. Before long I'll be up for CSS/HTML/PHP themeing three-ways til the break of dawn. Mmm, break out the mango love butter.
I have heard and read stories such as this one before, and their common denominator is Drupal...
excellent tip - can highly recommend the module - installed and working perfectly in drupal 7
This book seems very interesting as I am currently starting a project to build a community site...
Thank you very much !
Thank you very much !