diff options
Diffstat (limited to 'src/frontend_blog/blog_lib.php')
-rw-r--r-- | src/frontend_blog/blog_lib.php | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/frontend_blog/blog_lib.php b/src/frontend_blog/blog_lib.php new file mode 100644 index 00000000..4238e993 --- /dev/null +++ b/src/frontend_blog/blog_lib.php @@ -0,0 +1,26 @@ +<?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; +} + +?> |