Are you confused with php code and conversion into single line string?
Its not difficult to convert php code as string and putting it into string.
You need to mix php and string values properly in the form of string.
This example will show how to convert html + php into string.
<?php
$str .= ‘
<div class=”nd_booking_section ‘.$nd_booking_class.’ “>
<!–START FORM–>
<form action=”‘.$nd_booking_action.'” method=”get”>
<div class=”nd_booking_width_75_percentage nd_booking_width_100_percentage_all_iphone nd_booking_float_left nd_booking_padding_30 nd_booking_box_sizing_border_box nd_booking_bg_white”>
<!– Check Location –>
<!–check in/out–>
<div class=”nd_booking_width_33_percentage nd_booking_width_100_percentage_all_iphone nd_booking_border_right_2_solid_grey nd_booking_border_0_all_iphone nd_booking_float_left nd_booking_box_sizing_border_box”> <div class=”nd_booking_section nd_booking_box_sizing_border_box nd_booking_text_align_center nd_booking_cursor_pointer”>
<div class=”nd_booking_section nd_booking_box_sizing_border_box nd_booking_text_align_center”>
<h6 class=”nd_options_color_grey nd_options_second_font nd_booking_letter_spacing_2 nd_booking_font_size_12″>’.__(‘LOCATION’,’nd-location’).'</h6>
<div class=”nd_booking_section nd_booking_height_15″></div>
<select class=”nd_booking_width_100_percentage nd_booking_bg_greydark_2_important nd_booking_border_width_0_important nd_options_color_white nd_options_first_font nd_booking_font_size_20 nd_booking_text_align_center” onchange=”nd_booking_sorting(1)” name=”nd_booking_archive_form_branches” id=”nd_booking_archive_form_branches”>
<option value=”0″>’.__(‘Destination’,’nd-booking’).'</option>’;
foreach ($nd_booking_branches as $nd_booking_meta_box_branche) :
$str .= ‘<option ‘;
if ( $nd_booking_archive_form_branches == $nd_booking_meta_box_branche->ID ) {
$str .= ‘selected=”selected” ‘;
}
$str .= ‘value=”‘.$nd_booking_meta_box_branche->ID.'”>’.$nd_booking_meta_box_branche->post_title.'</option>’;
endforeach;
$str .= ‘
</select>
</div>
</div>
<input type=”hidden” id=”nd_booking_date_month_from” class=”nd_booking_section nd_booking_margin_top_20″>
<input type=”hidden” id=”nd_booking_date_number_from” class=”nd_booking_section nd_booking_margin_top_20″>
<input placeholder=”Check In” class=”nd_booking_section nd_booking_border_width_0_important nd_booking_padding_0_important nd_booking_height_0_important” type=”text” name=”nd_booking_archive_form_date_range_from” id=”nd_booking_archive_form_date_range_from” value=”” />
</div>
<!– Check location ends –>
<!–check in/out–>
<div class=”nd_booking_width_33_percentage nd_booking_width_100_percentage_all_iphone nd_booking_border_right_2_solid_grey nd_booking_border_0_all_iphone nd_booking_float_left nd_booking_box_sizing_border_box”>
<div id=”nd_booking_open_calendar_from” class=”nd_booking_section nd_booking_box_sizing_border_box nd_booking_text_align_center nd_booking_cursor_pointer”>
<div class=”nd_booking_section nd_booking_box_sizing_border_box nd_booking_text_align_center”>
<h6 class=”nd_options_color_grey nd_options_second_font nd_booking_letter_spacing_2 nd_booking_font_size_12″>’.__(‘CHECK-IN’,’nd-booking’).'</h6>
<div class=”nd_booking_section nd_booking_height_15″></div>
<div class=”nd_booking_display_inline_flex “>
<div class=”nd_booking_float_left nd_booking_text_align_right”>
<h1 id=”nd_booking_date_number_from_front” class=”nd_booking_font_size_50 nd_options_color_greydark nd_booking_font_weight_bold”>’.$nd_booking_date_number_from_front.'</h1>
</div>
<div class=”nd_booking_float_right nd_booking_text_align_center nd_booking_margin_left_10″>
<h6 id=”nd_booking_date_month_from_front” class=”nd_options_color_greydark nd_booking_margin_top_7 nd_booking_font_size_12″>’.$nd_booking_date_month_from_front.'</h6>
<div class=”nd_booking_section nd_booking_height_5″></div>
<img alt=”” width=”12″ src=”‘.plugins_url().’/nd-booking/assets/img/icons/icon-down-arrow-grey.svg”>
</div>
</div>
</div>
</div>
<input type=”hidden” id=”nd_booking_date_month_from” class=”nd_booking_section nd_booking_margin_top_20″>
<input type=”hidden” id=”nd_booking_date_number_from” class=”nd_booking_section nd_booking_margin_top_20″>
<input placeholder=”Check In” class=”nd_booking_section nd_booking_border_width_0_important nd_booking_padding_0_important nd_booking_height_0_important” type=”text” name=”nd_booking_archive_form_date_range_from” id=”nd_booking_archive_form_date_range_from” value=”” />
</div>
<div class=”nd_booking_width_33_percentage nd_booking_width_100_percentage_all_iphone nd_booking_border_right_2_solid_grey nd_booking_border_0_all_iphone nd_booking_float_left nd_booking_box_sizing_border_box”>
<div id=”nd_booking_open_calendar_to” class=”nd_booking_section nd_booking_box_sizing_border_box nd_booking_text_align_center nd_booking_cursor_pointer”>
<div class=”nd_booking_section nd_booking_box_sizing_border_box nd_booking_text_align_center”>
<h6 class=”nd_options_color_grey nd_options_second_font nd_booking_letter_spacing_2 nd_booking_font_size_12 nd_booking_margin_top_20_all_iphone”>’.__(‘CHECK-OUT’,’nd-booking’).'</h6>
<div class=”nd_booking_section nd_booking_height_15″></div>
<div class=”nd_booking_display_inline_flex “>
<div class=”nd_booking_float_left nd_booking_text_align_right”>
<h1 id=”nd_booking_date_number_to_front” class=”nd_booking_font_size_50 nd_options_color_greydark nd_booking_font_weight_bold”>’.$nd_booking_date_number_to_front.'</h1>
</div>
<div class=”nd_booking_float_right nd_booking_text_align_center nd_booking_margin_left_10″>
<h6 id=”nd_booking_date_month_to_front” class=”nd_options_color_greydark nd_booking_margin_top_7 nd_booking_font_size_12″>’.$nd_booking_date_month_to_front.'</h6>
<div class=”nd_booking_section nd_booking_height_5″></div>
<img alt=”” width=”12″ src=”‘.plugins_url().’/nd-booking/assets/img/icons/icon-down-arrow-grey.svg”>
</div>
</div>
</div>
</div>
<input type=”hidden” id=”nd_booking_date_month_to” class=”nd_booking_section nd_booking_margin_top_20″>
<input type=”hidden” id=”nd_booking_date_number_to” class=”nd_booking_section nd_booking_margin_top_20″>
<input placeholder=”Check Out” class=”nd_booking_section nd_booking_border_width_0_important nd_booking_padding_0_important nd_booking_height_0_important” type=”text” name=”nd_booking_archive_form_date_range_to” id=”nd_booking_archive_form_date_range_to” value=”” />
</div>‘;
?>