Need help with Joomla 1.5.2

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nlal
    New Member
    • Jan 2010
    • 19

    Need help with Joomla 1.5.2

    Hi I am trying to learn Joomla - a tool for web development using php.My problem is I keep getting warnings such as

    Warning: strtotime() [function.strtot ime]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_ti mezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Pacific/Auckland' for '12.0/no DST' instead in C:\xampp\htdocs \joomla15\libra ries\joomla\uti lities\date.php on line 56

    I tried changing the code

    Code:
    function __construct($date = 'now', $tzOffset = 0)
     {		
       if ($date == 'now' || empty($date))	
        {
          $this->_date = strtotime(gmdate("M d Y H:i:s", time()));			
         return;
       } 
       :
       : //more code  
     }

    to

    Code:
    function __construct($date = 'now', $tzOffset = 0)
     {
      if ($date == 'now' || empty($date))
       {
        $this->_date = date_default_timezone_set('Pacific/Fiji');			
        return;
       }
       :
       :  //more code 
     }
    Before changing the code, I got the home page as I had designed, together with the warnings but now I get a blank page.I can't even view my home page.Can someone familiar with Joomla help me please...

    Thanks
  • Rizladonovich
    New Member
    • Sep 2010
    • 13

    #2
    date_default_ti mezone_set returns a boolean value (check man page). In other words; your statement set $this->date to TRUE if success or FALSE if failure.

    The "best way" (could of course depend on special cases in code) is to set it in php.ini.

    If not set it "early" in the code, so that you are sure it is set before any time function are used.

    So: do _not_ change line 5, but add definition of timezone _before_ that line is executed...

    I.e.:

    date_default_ti mezone_set('Pac ific/Fiji'); could be added in another file executed before the one you have your posted code or:

    Code:
    /* HERE */
    
    function __construct($date = 'now', $tzOffset = 0)
     {        
       /* or HERE */
       if ($date == 'now' || empty($date))    
        {
         /* or HERE */
          $this->_date = strtotime(gmdate("M d Y H:i:s", time()));            
         return;
       } 
       :
       : //more code  
     }
    Last edited by Rizladonovich; Sep 19 '10, 05:59 AM. Reason: added example code

    Comment

    • nlal
      New Member
      • Jan 2010
      • 19

      #3
      According to this posting

      The construct function actually has two underscore
      function __construct()
      and removing an underscore solves the problem.
      This is true.But the problem remains that I can no longer view the page I designed

      Comment

      • Rizladonovich
        New Member
        • Sep 2010
        • 13

        #4
        > ...
        > The construct function actually has two underscore
        > function __construct()
        > and removing an underscore solves the problem.
        > This is true.But the problem remains that I can no longer view the page I designed
        > ...

        That sounds very strange.

        Construct should have two underscores if it is supposed to be a class construct.

        ref: http://www.php.net/manual/en/language.oop5.decon.php
        Last edited by Rizladonovich; Sep 19 '10, 07:17 AM. Reason: added "quote"

        Comment

        Working...