• Till <Version 5.8 i use a script template from the tutorial to generate a table drom Date input(s)….Holyday planning from….See https://www.maler-jost.de/urlaub
    With Version >5.8x there are strange line breaks.

    I hope somebody can help me….

    Function from tutorials in functions.php

    function insert_table_in_mail($html, $field, $data, $cf7_key){
      if( $cf7_key == 'urlaubsantragv2' || $cf7_key == 'urlaubsantrag' )
      		{ //always validate the form being submitted.
    	 
      
        /*return $html;*/
       /* } */
      $build = true;
      switch($field){ //if either of fields present in the table...
        case 'beginn':
          $label = 'Urlaub vom';
          $html ='<ul style="list-style-type:none;border-right:1px solid black;display:inline-block;float:left;padding:5px">';
          break;
    	case 'beginn-delete':
          $label = 'Urlaub vom';
          $html ='<ul style="list-style-type:none;border-right:1px solid black;display:inline-block;float:left;padding:5px">';
          break;
        case 'ende':
          $label = 'Urlaub bis';
          /*styling for last column*/
          $html ='<ul style="list-style-type:none;display:inline-block;clear:right;padding:5px">';
          break;
    	case 'ende-delete':
          $label = 'Urlaub bis';
          /*styling for last column*/
          $html ='<ul style="list-style-type:none;display:inline-block;clear:right;padding:5px">';
          break;
        default: //else this isn't a field we want in the table.
          $build=false;
          break;
      }
      if($build){
    	  
        $html .='<li style="background-color:lightgray;margin:0;padding:3px 5px">'.$label.'</li>';
       	  foreach($data as $key=>$value){
    	
    		 if (!empty($value)) 
    		 {
      			$timestamp = strtotime($value);
     				if ($timestamp === FALSE) 
    				{
       					 $timestamp = strtotime(str_replace('/', '-', $date));
    			  	}
     		$value = date('d.m.Y', $timestamp);
    		}
    		  else
    		  {
    			$value = "---";
    		  }
    		$html .='<li style="margin:0px;padding:3px 5px">'.$value.'</li>';
    		}
    		$html .='</ul>';
    	}
      }
      return $html;
    }
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘insert_table_in_mail problems since 5.8’ is closed to new replies.