summaryrefslogtreecommitdiff
path: root/src/frontend_blog/blog_lib.php
blob: 39415d9d1c54f887f16db98937e8a1364dce8ccc (plain)
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
<?php

/**
 * Take a (article's) filename and return its
 * teaser. It has the articles folder hardcoded
 */
function get_teaser($name){
  $content = file_get_contents("articles/$name.html");
  $doc = new DOMDocument();
  $doc->loadHTML($content);
  $teaser = $doc->getElementById("teaser");
  return $teaser;
}

/**
 * Take a (article's) filename and return its
 * DOM. It has the articles folder hardcoded
 */
function get_article($name){
  $content = file_get_contents("articles/$name.html");
  $doc = new DOMDocument();
  $doc->loadHTML($content);
  return $doc;
}

/**
 * Fetch the page $page and return its
 * DOM.
 */
function get_page($page){
  $content = file_get_contents($page);
  $doc = new DOMDocument();
  $doc->loadHTML($content);
  return $doc;
}

?>