Comment ajouter le script date du jour?

Comment faire pour ajouter la date (aujourd'hui) dans l'article:
<?php
$relise = date("d.m.Y");
echo $relise;
?>

Réponses

  • StéphaneStéphane Member, Former PluXml Project Manager
    affiche la date dans le fichier article.php du thème, car là tu peux y mettre du code php.

    Consultant PluXml

    Ancien responsable et développeur de PluXml (2010 à 2018)

  • English version of the question:
    This script works only in a static page. I need the script to work in the articles.
    Required result: "the file.zip is copied 19.01.2011".
    Example: the file.zip is copied <?php $today = date("d.m.Y"); echo $today; ?>.

    Thanks!!!
  • English answer :
    Try to compute the php script inside the article.php template (see blog or wiki for details), where you can compute php scripts.
    If the use of template isn't enough, try a XMLHTTPREQUEST in an external php page... example : http://www.jibbering.com/2002/4/httprequest.html

    IMO, article is not the best way (and XHR less than this one) to make a repository.
    If you really want to do a file repository, have a look about : http://wiki.pluxml.org/index.php?page=Cr%C3%A9er+une+page+de+fichiers+%C3%A0+t%C3%A9l%C3%A9charger

    if i don't understand your question ... mea culpa..

    ps : vous voyez pourquoi il ne fallait pas me faire traduire pluxml en anglais xD
  • Did not understand me.
    This script works only in a static page. I need the script to work in the articles.

    Required result: bla...bla...bla... 21.01.2011 (today).
    Example: bla...bla...bla... <?php $today = date("d.m.Y"); echo $today; ?> (today).

    Help me!!!
  • StéphaneStéphane Member, Former PluXml Project Manager
    Why don't you add the code in themes/yourtheme/article.php

    Consultant PluXml

    Ancien responsable et développeur de PluXml (2010 à 2018)

  • Stéphane, how to include php-link (today.php) to the article?
    not working: <?php include(dirname(__FILE__).'/today.php'); # file today.php is located in the theme ?>
  • StéphaneStéphane Member, Former PluXml Project Manager
    edit file: themes/yourtheme/article.php

    and add where you want to display the current date
    <?php  echo date("d.m.Y");   ?>
    

    Consultant PluXml

    Ancien responsable et développeur de PluXml (2010 à 2018)

Connectez-vous ou Inscrivez-vous pour répondre.