The Daily Text page

Posted on January 15th, 2007 in Coding by abdallah

Yesterday, a friend in the US sent me a file containing the TMS schedule as well as the es2007 (English) in Excel format. As I was still patching this site together I thought why not use the file in Wordpress, and that was it.
Currently, the page only shows today’s scripture + comments. And I added the weekly reading schedule at the bottom. If you feel something else could be added feel free to contact me.

[ php Code ]
  1.  
  2. $dq = ‘"’;
  3. $p_verse = ‘/^(.+?)\?(\w+?\.\s\d+:\d+\.)\s\s/’;
  4. $r_verse = ‘<div class="contenttitle"><strong>$1</strong> &mdash; <em>$2</em>
  5. </div>’;
  6. $p_ref = ‘/(w\s\d.+?)$/’;
  7. $r_ref = ‘<p aligh="right"><em>$1</em></p>’;
  8. $p_tms = ‘/^TMS: (.*?)\s(\d+)-(.*)/’;
  9. $r_tms = ‘<strong>Bible reading (TMS):</strong> $1: $2-$3′;
  10.  
  11. $today = date(‘Y-m-d’);
  12. $this_week = date("Y-m-d", mktime(0, 0, 0, date("m")  , date("d")-(date("w") - 1), date("Y")));
  13. $sql = "SELECT subject, description FROM `ad_dtext_tms` WHERE (";
  14. $sql .= ‘ (`start_date` =  ‘.$dq .$today.$dq. ‘  AND `subject` = "Daily Text" ) ‘;
  15. $sql .= ‘ OR ( `start_date` = ‘.$dq . $this_week .$dq. ‘ AND `subject` = ‘.$dq.‘TMS Reading’.$dq.‘ ) )’;
  16. $rs = mysql_query($sql);
  17. while ($row = mysql_fetch_assoc($rs)) { 
  18.     if ($row[’subject’] == ‘Daily Text’) { $daily_text = $row[‘description’]; }
  19.     if ($row[’subject’] == ‘TMS Reading’) { $tms_reading = $row[‘description’]; }   
  20. }
  21. $daily_text = preg_replace($p_verse, $r_verse, $daily_text);
  22. $daily_text = preg_replace($p_ref, $r_ref, $daily_text);
  23. $daily_text = str_replace(‘?’, ‘? ‘, $daily_text);
  24. $tms_reading = preg_replace($p_tms, $r_tms, $tms_reading);
  25. echo $daily_text .
  26. ;
  27. echo $tms_reading .
  28. ;

Post a comment

You must be logged in to post a comment.