Hi everyone!
I'm trying to put a little one-line date string on my site (eg.: 2007. April 16 (Monday)). The most quick and easiest way I thought was to create a new block (with admin/build/block) and put this code in it: <?php echo date("Y. F j. (l)"); ?>
Then add this block to my site.
But when loading the page I just get the code displayed and not executed. I have an Input format which allows PHP code and is available to nobody (so I can use it only with uid==1), and I've added the block content with this filter. Can't see what is the problem :\
Please comment, thank you!
ps.: If there is a feature already in drupal which does this, that would be even better :)
Daniel
Daniel / 2007/04/17 / 10:08 AM wrote:
But when loading the page I just get the code displayed and not executed.
I believe you need to change the format to PHP. I just tried, and it does work.
P.S. Hi everyone. I just joined this list, seeking for a lot of help :-) More later.
Hi. I tried our code and it function well here. My code: <p><?php echo date("Y. F j. (l)"); ?></p> And: Inndataformat http://www.drupal.no/admin/build/block/configure/block/5# Filtered HTML
* Tillatte HTML merker: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> * Automatisk linjeskift
PHP code
* Du kan legge inn PHP-kode.
Full HTML
* Automatisk linjeskift
And that was that. (Norwegian )
Daniel skrev:
Hi everyone!
I'm trying to put a little one-line date string on my site (eg.: 2007. April 16 (Monday)). The most quick and easiest way I thought was to create a new block (with admin/build/block) and put this code in it:
<?php echo date("Y. F j. (l)"); ?>
Then add this block to my site.
But when loading the page I just get the code displayed and not executed. I have an Input format which allows PHP code and is available to nobody (so I can use it only with uid==1), and I've added the block content with this filter. Can't see what is the problem :\
Please comment, thank you!
ps.: If there is a feature already in drupal which does this, that would be even better :)
Daniel
Sorry. I undertand it like you are not allowed to use php? If you are admin, go to http://www.yoursite.no/admin/settings/filters , and configure a "rolle" for php if nessesary I made a rolle for my self (with all rigths) even that I am an admin Don't ask me why? but it helps some time.
dupal1.no skrev:
Hi. I tried our code and it function well here. My code:
<p><?php echo date("Y. F j. (l)"); ?></p> And: Inndataformat <http://www.drupal.no/admin/build/block/configure/block/5#> Filtered HTML
* Tillatte HTML merker: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> * Automatisk linjeskiftPHP code
* Du kan legge inn PHP-kode.Full HTML
* Automatisk linjeskiftAnd that was that. (Norwegian )
Daniel skrev:
Hi everyone!
I'm trying to put a little one-line date string on my site (eg.: 2007. April 16 (Monday)). The most quick and easiest way I thought was to create a new block (with admin/build/block) and put this code in it:
<?php echo date("Y. F j. (l)"); ?>
Then add this block to my site.
But when loading the page I just get the code displayed and not executed. I have an Input format which allows PHP code and is available to nobody (so I can use it only with uid==1), and I've added the block content with this filter. Can't see what is the problem :\
Please comment, thank you!
ps.: If there is a feature already in drupal which does this, that would be even better :)
Daniel
2007. April 17. 16:08, Daniel:
Hi everyone!
I'm trying to put a little one-line date string on my site (eg.: 2007. April 16 (Monday)). The most quick and easiest way I thought was to create a new block (with admin/build/block) and put this code in it: <?php echo date("Y. F j. (l)"); ?>
Then add this block to my site.
But when loading the page I just get the code displayed and not executed. I have an Input format which allows PHP code and is available to nobody (so I can use it only with uid==1), and I've added the block content with this filter. Can't see what is the problem :\
Please comment, thank you!
ps.: If there is a feature already in drupal which does this, that would be even better :)
Thanks all for the answers! The problem was with the order of the filters; I had to put the PHP enabling filter on the top. Now just need to find out how to display the date in the current locale :\
Thanks!
Daniel