Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
By Peter76 on
Hi,
I found this php code that shows diffrent page on diffrent day - http://www.dynamicdrive.com/forums/showthread.php?t=22499.
----------
$h = date('G');
if ($h<2) {$p=1;}
else if ($h<4) {$p=2;}
else if ($h<6) {$p=3;}
...
else if ($h<22) {$p=11;}
else {$p=12;}
include($p.'.html');
----------
But it doesnt work in Drupal. What I must change and where to put the code? Template or where...
Comments
Whether you include it on a
Whether you include it on a page or in the theme really depends on what exactly you are trying to do, but the simple answer is you can add php to drupal by setting the Input Format of a node to "PHP Code". If you're using D6, you have to enable the PHP input format module first.
include html in php code
You can do this, but this is not common in drupal
Drupal way is to create page in drupal and load that content instead of page. You can use node_load() to load a node object from the database.
Regards,
Suryanto Rachmat
http://rachmat.net
Where can I use node_load()
Where can I use node_load() ?
Sorry im now to drupal.
If I add static 11.html to
If I add static 11.html to my page this work, but if I add new page in drupal and rename it to 11.html doesnt. Why?
I'm not quite sure what
I'm not quite sure what you're doing-- there are no "html" pages in drupal. "pages" are stored in the database as nodes, so I'm not exactly sure what drupal page you are renaming. If you're having trouble with drupal basics like this it seems you have some reading to do: http://drupal.org/getting-started
I want that for example on
I want that for example on mondays page monday.html or node/monday shows up in left corner, on tuesdays tuesday.html .... and so on. Can anyone make this script work with drupal?
You can add the following
This is not the way I'd ideally do this, but if you want a quick hack...
You can add the following code as a new "block". Change the numbers after the $p= to the node IDs of the pages you want to load for the particular day.
edit: make sure the block input format is set to PHP code
London Drupal Developer
Thanks for help, especially
Thanks for help, especially to suryanto who made that this script work on my site.
could have been written like
could have been written like this: