We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3689
    • 264 Posts
    I’m trying to add this to my footer
    Copyright © <?php ini_set(‘date.timezone’, ‘America/New_York’); echo date(‘Y’); ?>


    But I cant place that in a chunk which is where my footer is.. how do i get this to work?
      • 26931
      • 2,314 Posts
      you need to make a snippet out of the php code first, then place it in your footer/chunk

      http://wiki.modxcms.com/index.php/Snippet_call_anatomy
      http://wiki.modxcms.com/index.php/Creating_Snippets
        • 3689
        • 264 Posts
        Quote from: sharkbait at Jan 25, 2010, 12:46 AM

        you need to make a snippet out of the php code first, then place it in your footer/chunk
        i tried that b4 posting.. i get this


        « MODx Parse Error »
        MODx encountered the following error while attempting to parse the requested resource:
        « PHP Parse Error »

        PHP error debug
        Error: Division by zero
        Error type/ Nr.: Warning - 2
        File: /home/site/public_html/manager/includes/document.parser.class.inc.php(770) : eval()’d code
        Line: 1

        Parser timing
        MySQL: 0.0039 s (1 Requests)
        PHP: 0.0336 s
        Total: 0.0375 s
          • 26931
          • 2,314 Posts
          if you want to change the timezone, i guess you eather need make the changes in your htaccess or make a plugin out of it
          http://www.electrictoolbox.com/php-change-timezone/

          just tested it:
          plugin "date":
          ini_set('date.timezone', 'America/Los_Angeles');

          System Event: "OnWebPageInit"

          snippet: "time"
          <?php
          return date("F j, Y, g:i a");
          ?>


          and call it [!time!]

          ...works
            • 26931
            • 2,314 Posts
            ini_set(‘date.timezone’, ‘America/New_York’); echo date(‘Y’);

            should be :
            ini_set('date.timezone', 'America/New_York'); echo date('Y');

            ‘ -> ’

            *edit: okay, you probably don’t need the plugin
              • 3689
              • 264 Posts
              Quote from: sharkbait at Jan 25, 2010, 01:10 AM

              ini_set(‘date.timezone’, ‘America/New_York’); echo date(‘Y’);

              should be :
              ini_set('date.timezone', 'America/New_York'); echo date('Y');

              ‘ -> ’

              *edit: okay, you probably don’t need the plugin

              thanks smiley got it workin!