Skip to content
Snippets Groups Projects
Commit 87c434ce authored by Andreas Gohr's avatar Andreas Gohr
Browse files

useheading fixes #460 #465

darcs-hash:20050716111225-7ad00-913c36c65ac1a985fea60eed57fc7391328bfacd.gz
parent 42cccceb
No related branches found
No related tags found
No related merge requests found
......@@ -321,7 +321,7 @@ function p_get_first_heading($id){
$instructions = p_cached_instructions($file,true);
foreach ( $instructions as $instruction ) {
if ($instruction[0] == 'header') {
return $instruction[1][0];
return trim($instruction[1][0]);
}
}
}
......
......@@ -676,5 +676,27 @@ function tpl_mediauploadform(){
ptln('</form>',2);
}
/**
* Prints the name of the given page (current one if none given).
*
* If useheading is enabled this will use the first headline else
* the given ID is printed.
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
function tpl_pagetitle($id=null){
global $conf;
if(is_null($id)){
global $ID;
$id = $ID;
}
$name = $id;
if ($conf['useheading']) {
$title = p_get_first_heading($id);
if ($title) $name = $title;
}
print hsc($name);
}
//Setup VIM: ex: et ts=2 enc=utf-8 :
......@@ -17,7 +17,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $conf['lang']?>"
lang="<?php echo $conf['lang']?>" dir="<?php echo $lang['direction']?>">
<head>
<title><?php echo $ID?> [<?php echo hsc($conf['title'])?>]</title>
<title><?php tpl_pagetitle()?> [<?php echo hsc($conf['title'])?>]</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php tpl_metaheaders()?>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment