-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathexample_fb.php
65 lines (48 loc) · 1.82 KB
/
example_fb.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?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 echo $page_title; ?></title>
<!-- Force UTF-8 -->
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<!-- Insert meta description for SEO -->
<meta name="description" content="<?php echo $meta_short_desc; ?>" />
<!-- Example for OpenGraph Protocol (if og_image field present, show it) -->
<?php if (isset($og_image)) { ?><meta property="og:image" content="<?php echo $og_image; ?>" /><?php } ?>
<!-- After, we can append any field as shown before -->
<!-- Also, put there styles/js, etc. -->
</head>
<body>
<?php
// Use Integration Wizard for this block
$template = 'default';
include 'show_news.php';
?>
</body>
</html>