السلام عليكم ورحمة الله وبركاته


الوصف :
  • جعل فترة التسجيل للاعضاء تظهر بالسنين والشهور والايام .. مثال فى المرفقات

الخطوات :


  • افتح الملف : admin\sources\base\core.php
  • نبحث عن :

كود PHP:
                  $nicedate IPSTime::GetDateDifference( date('m/d/Y', $member['joined'] ), date('m/d/Y', time() ) );
                 
$member['nicedate'] = $nicedate['NiceString']; 

ابحث عن :

كود PHP:
         static public function date_getgmdate( $gmt_stamp )
                
{
                        
$tmp gmdate( 'j,n,Y,G,i,s,w,z,l,F,W,M', $gmt_stamp );
        
                        
list( $day, $month, $year, $hour, $min, $seconds, $wday, $yday, $weekday, $fmon, $week, $smon ) = explode( ',', $tmp );
        
                        
return array(  0             => $gmt_stamp,
                                                   
"seconds" => $seconds, //    Numeric representation of seconds       0 to 59
                                                   
"minutes" => $min,    //     Numeric representation of minutes       0 to 59
                                                   
"hours"       => $hour,        //    Numeric representation of hours 0 to 23
                                                   
"mday"        => $day,        //     Numeric representation of the day of the month  1 to 31
                                                   
"wday"        => $wday,      //      Numeric representation of the day of the week   0 (for Sunday) through 6 (for Saturday)
                                                   
"mon"         => $month,   //        Numeric representation of a month       1 through 12
                                                   
"year"        => $year,      //      A full numeric representation of a year, 4 digits       Examples: 1999 or 2003
                                                   
"yday"        => $yday,      //      Numeric representation of the day of the year   0 through 365
                                                   
"weekday" => $weekday, //    A full textual representation of the day of the week    Sunday through Saturday
                                                   
"month"       => $fmon,      //      A full textual representation of a month, such as January or Mar
                                                   
"week"       => $week,       //      Week of the year
                                                   
"smonth"  => $smon,
                                                   
"smon"       => $smon
                                                
);
                


اضف اسفله :

كود PHP:
           static public function GetDateDifference($StartDateString=NULL, $EndDateString=NULL)
                
{
   
                        
$ReturnArray = array();
                   
                        
$SDSplit explode('/',$StartDateString);
                        
$StartDate mktime(0,0,0,$SDSplit[0],$SDSplit[1],$SDSplit[2]);
                   
                        
$EDSplit explode('/',$EndDateString);
                        
$EndDate mktime(0,0,0,$EDSplit[0],$EDSplit[1],$EDSplit[2]);
                   
                        
$DateDifference $EndDate-$StartDate;
                   
                        
$ReturnArray['YearsSince'] = $DateDifference/60/60/24/365;
                        
$ReturnArray['MonthsSince'] = $DateDifference/60/60/24/365*12;
                        
$ReturnArray['DaysSince'] = $DateDifference/60/60/24;
                        
$ReturnArray['HoursSince'] = $DateDifference/60/60;
                        
$ReturnArray['MinutesSince'] = $DateDifference/60;
                        
$ReturnArray['SecondsSince'] = $DateDifference;
   
                        
$y1 date("Y", $StartDate);
                        
$m1 date("m", $StartDate);
                        
$d1 date("d", $StartDate);
                        
$y2 date("Y", $EndDate);
                        
$m2 date("m", $EndDate);
                        
$d2 date("d", $EndDate);
                   
                        
$diff = '';
                        
$diff2 = '';
                   
                        
if &#40;($EndDate - $StartDate)<=0) {
                                // Start date is before or equal to end date!
                                
$diff = &#34;0 days";
                                
$diff2 = &#34;Days: 0";
                        
} else {
   
                                
$y $y2 $y1;
                                
$m $m2 $m1;
                                
$d $d2 $d1;
                                
$daysInMonth date&#40;"t",$StartDate);
                                
if &#40;$d<0) {$m--;$d=$daysInMonth+$d;}
                                
if &#40;$m<0) {$y--;$m=12+$m;}
                                
$daysInMonth date&#40;"t",$m2);
                           
                                // Nicestring ("1 year, 1 month, and 5 days")
                                
if &#40;$y>0) $diff .= $y==1 ? "1 Year" : "$y Years";
                                
if &#40;$y>0 && $m>0) $diff .= ", ";
                                
if &#40;$m>0) $diff .= $m==1? "1 Month" : "$m Months";
                                
if &#40;($m>0||$y>0) && $d>0) $diff .= " and ";
                                
if &#40;$d>0) $diff .= $d==1 ? "1 Day" : "$d Days";
                           
                                // Nicestring 2 ("Years: 1, Months: 1, Days: 1")
                                
if &#40;$y>0) $diff2 .= $y==1 ? "Years: 1" : "Years: $y";
                                
if &#40;$y>0 && $m>0) $diff2 .= ", ";
                                
if &#40;$m>0) $diff2 .= $m==1? "Months: 1" : "Months: $m";
                                
if &#40;($m>0||$y>0) && $d>0) $diff2 .= ", ";
                                
if &#40;$d>0) $diff2 .= $d==1 ? "Days: 1" : "Days: $d";
                        
}
                   
                        
$ReturnArray[&#39;NiceString']  = $diff;
                        
$ReturnArray[&#39;NiceString2'] = $diff2;
                        
return $ReturnArray;
                } 

افتح لوحة الادمن Admin CP > LOOK&FEEL > Skin > Global Templates -> userInfoPane
ابحث عن :

كود PHP:
                           <dt>{$this->lang->words[&#39;m_joined']}</dt>
                           
<dd>{parse date=&#34;$author['joined']" format="joined"}</dd> 

اضف اسفله :

كود PHP:
                         <dt>&nbsp;</dt>
                           <
dd>{$author[&#39;nicedate']}</dd> 


نقره لتكبير أو تصغير الصورة ونقرتين لعرض الصورة في صفحة مستقلة بحجمها الطبيعي


انتهى الدرس