diff --git a/inc/template.php b/inc/template.php
index 980fc744cacc1cba92cf29ab44a57a6c17b902f0..6e8c0d71811bef6d1f4f485fd272a52720a312d6 100644
--- a/inc/template.php
+++ b/inc/template.php
@@ -1334,5 +1334,22 @@ function tpl_license($img='badge',$imgonly=false,$return=false){
     echo $out;
 }
 
+
+/**
+ * Includes the rendered XHTML of a given page
+ *
+ * This function is useful to populate sidebars or similar features in a
+ * template
+ */
+function tpl_include_page($pageid,$print=true){
+    global $ID;
+    $oldid = $ID;
+    $html = p_wiki_xhtml($pageid,'',false);
+    $ID = $oldid;
+
+    if(!$print) return $html;
+    echo $html;
+}
+
 //Setup VIM: ex: et ts=4 enc=utf-8 :