Is there a way to insert the current data in Magento CMS as variable, widget, or any other method aside from including a .phtml file with php echo of date().?
Right now what I did is include a .phtml files with this contents:
<?php
echo "Today is " . date("Y/m/d") . "<br>";
?>
But is there any better or proper way? Like {{datetoday}} or something. Just like when I'm including a URL, I just type the variable {{store url}}
Best Answer
You can do this with a custom block. Create it once and you can reuse it everywhere.
Create a module with the following config.xml:
Install this block: in File
app/code/local/YourCompany/YourModule/Block/Datetoday.php
:How to use
Now in your CMS pages or in a static block all you have to do is use the following short tag: