<?php /** * @desc This is example file for simple cutenews feed with extensions (CN API) */ // Include Cutenews API require_once 'cn_api.php'; // Get Entry by `id` parameter (externally) if ($entry = cn_api_get_entry()) { // Get page title for selected news $page_title = $entry['t']; // Meta description -- we truncate only 100 words $meta_short_desc = clever_truncate($entry['s'] . $entry['f'], 100); // There we remove all tags for meta-desc $meta_short_desc = strip_tags($meta_short_desc); // Optionally: Facebook Open Graph Protocol // BEFORE -- Go to CN dashboard, Additional fields, male field. e.g. "og_image" (type image/resource) // After, bind image for field "og_image" and save news // There appears field "mf", with subfield "og_image" $og_image = $entry['mf']['og_image']; } else { $page_title = "There's news feed for my site"; $meta_short_desc = "This page is my news feed... etc"; } ?> <!DOCTYPE HTML><!-- Simple Example for Cutenews --> <html> <head> <!-- Show title for page name --> <title><?php
function cn_modify_bb_truncate($e, $t, $o) { $num = intval(preg_replace('/[^0-9]/', '', $o)); return clever_truncate($t, $num); }
?> <tr <?php if (!$item[2]['id']) { echo ' class="unabled" '; } ?> > <td width="1" align="center"><nobr><?php echo date('Y-m-d H:i:s', $item[1]); ?> </nobr></td> <td><?php if (!$item[2]['id']) { echo ' ---comment deleted--- '; } else { echo '<a target="_blank" href="' . $item[3] . '">' . cn_htmlspecialchars(clever_truncate($item[2]['c'])) . '</a>'; } ?> </td> <td align="center"><?php echo cn_htmlspecialchars($item[2]['ip']); ?> </td> <td><?php echo cn_htmlspecialchars($item[2]['e']); ?> </td> <td><?php echo cn_htmlspecialchars($item[2]['u']); ?> </td>
<tr> <td><?php echo cn_htmlspecialchars($u); ?> </td> <td> <?php if (is_array($v)) { echo '<a href="' . cn_url_modify('path=' . $path . '/' . $u) . '">click to expand →</a>'; $edit = FALSE; } elseif (is_numeric($v)) { echo $v; $edit = TRUE; } elseif (strlen($v) > 128) { echo cn_htmlspecialchars(clever_truncate($v, 128)); $edit = TRUE; } else { echo cn_htmlspecialchars($v); $edit = TRUE; } if ($edit) { echo ' [<a href="#" onclick="' . cn_snippet_open_win(cn_url_modify('edit=' . $u), array('w' => 800, 'h' => 550, 'l' => 'auto')) . '" class="external">edit</a>]'; } ?> </td> </tr> <?php } ?> </table>