Skip to content

Instantly share code, notes, and snippets.

@Danack

Danack/html.php Secret

Created July 22, 2020 10:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Danack/4bfe9810b3b8ff920aba9170c8917d41 to your computer and use it in GitHub Desktop.
Save Danack/4bfe9810b3b8ff920aba9170c8917d41 to your computer and use it in GitHub Desktop.
esprintf example
<?php
$params = [
':html_items_by_label' => track_changes::get_item_label_by_type($item),
':html_item_names' => $item['entity_name'],
':attr_entity_id' => $item['entities_id'],
':attr_item_id' => $item['items_id'],
':html_item_id' => $item['items_id'],
':attr_item_url' => url_for('items/info','path=' . $item_info['path']['full_path']),
':html_name' => $item_info['name'],
':html_comment' => strlen($comment) ? $comment . '':'',
':html_track_changes' => track_changes::get_created_by_label($item),
':html_date' => format_date_time($item['date_added'])
];
$html_src .= '
<tr>
<td>:html_items_by_label</td>
<td>:html_item_names</td>
<td><a href="#" onClick="set_filter_by_id(:attr_entity_id, :attr_item_id)">:html_item_id</a></td>
<td style="white-space: normal;"><a target="_new" href=":attr_item_url">:html_name</a></td>
<td style="white-space: normal;"> :html_comment '. $html_fields . '</td>
<td>:html_track_changes</td>
<td>:html_date</td>
</tr>
';
$html = esprintf($html_src, $params);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment