Alistair Posted June 16, 2010 Share Posted June 16, 2010 I need your help! I have managed to integrate every aspect of my template except one part. I have a simple "The date today is..." sentence of text on my header.tpl The code, as in the index.html file, reads as: <li>The date today is <script language="JavaScript"> <!-- function getCorrectedYear(year) { year = year - 0; if (year < 70) return (2000 + year); if (year < 1900) return (1900 + year); return year; } var lmod = new Date(); var monthname; var lmonth = lmod.getMonth(); if (lmonth == 0) monthname = "January"; if (lmonth == 1) monthname = "February"; if (lmonth == 2) monthname = "March"; if (lmonth == 3) monthname = "April"; if (lmonth == 4) monthname = "May"; if (lmonth == 5) monthname = "June"; if (lmonth == 6) monthname = "July"; if (lmonth == 7) monthname = "August"; if (lmonth == monthname = "September"; if (lmonth == 9) monthname = "October"; if (lmonth == 10) monthname = "November"; if (lmonth == 11) monthname = "December"; var yearstr = getCorrectedYear(lmod.getYear()); var outstr = lmod.getDate() + " " + monthname + " " + yearstr; document.write(outstr); // --> </script></li> However, whenever I add the above code to my header.tpl and upload it, any page of my WHMCS just doesn't load and remains as a white page. When I remove this code, however, the site loads correctly. Can someone help me and tell me how I can get the date code to work on WHMCS?! Thanks! 0 Quote Link to comment Share on other sites More sharing options...
Alistair Posted June 16, 2010 Author Share Posted June 16, 2010 By the way, I also tried putting this into my header.tpl : The date today is <script type=text/javascript src="js/date.js"></script></li> and I put the code from the above post into the file date.js . This did not work either - I just don't know what I am doing... 0 Quote Link to comment Share on other sites More sharing options...
Alistair Posted June 17, 2010 Author Share Posted June 17, 2010 Can anyone help? 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted June 18, 2010 Share Posted June 18, 2010 In any of your tpl files you can simply use {$todaysdate} to get the current date 0 Quote Link to comment Share on other sites More sharing options...
Alistair Posted June 18, 2010 Author Share Posted June 18, 2010 In any of your tpl files you can simply use {$todaysdate} to get the current date Thank you! However, do you know how I can use this on my index page etc? I want the date to display in the same format - currently the WHMCS pages display it differently to the other pages. How can I use this code on my non-WHMCS pages? I put it into my terms page and renamed it terms.php but it does not display how it does on WHMCS pages. It just says {$todaysdate} instead of the date! Any ideas how I can get the same format of date on the other pages, such as my index, terms, privacy pages etc? 0 Quote Link to comment Share on other sites More sharing options...
Dano Posted June 26, 2010 Share Posted June 26, 2010 Follow up here: http://forum.whmcs.com/showthread.php?t=12933 0 Quote Link to comment Share on other sites More sharing options...
cyberneticos Posted August 21, 2010 Share Posted August 21, 2010 In any of your tpl files you can simply use {$todaysdate} to get the current date Hi Sparky, how can I get that {$todaysdate} output to be in Spanish ? Thanks ! 0 Quote Link to comment Share on other sites More sharing options...
laszlof Posted August 21, 2010 Share Posted August 21, 2010 Wrap your javascript code in {literal} and {/literal} tags.. That will fix the problem. 0 Quote Link to comment Share on other sites More sharing options...
cyberneticos Posted August 21, 2010 Share Posted August 21, 2010 That is not the solution. 0 Quote Link to comment Share on other sites More sharing options...
laszlof Posted August 21, 2010 Share Posted August 21, 2010 That is not the solution. I was talking to the OP about his issue. 0 Quote Link to comment Share on other sites More sharing options...
cyberneticos Posted August 21, 2010 Share Posted August 21, 2010 That's what they invented quotes for 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted August 21, 2010 Share Posted August 21, 2010 The smarty tag is generated from the php comand date('l, jS F Y'); In the php manual for date To format dates in other languages, you should use the setlocale() and strftime() functions instead of date(). Hope that helps 0 Quote Link to comment Share on other sites More sharing options...
cyberneticos Posted August 21, 2010 Share Posted August 21, 2010 sure did thanks ! 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.