home page updates
This commit is contained in:
parent
f87b34400e
commit
3e1edae90d
@ -15,6 +15,16 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
class Home extends SimpleExtension {
|
class Home extends SimpleExtension {
|
||||||
|
public function onInitExt($event) {
|
||||||
|
global $config;
|
||||||
|
$config->set_default_string("home_links", '
|
||||||
|
[$base/post/list|Posts]
|
||||||
|
[$base/comment/list|Comments]
|
||||||
|
[$base/tags|Tags]
|
||||||
|
[$base/wiki|Wiki]
|
||||||
|
[$base/wiki/more|»]
|
||||||
|
');
|
||||||
|
}
|
||||||
public function onPageRequest($event) {
|
public function onPageRequest($event) {
|
||||||
global $config, $page;
|
global $config, $page;
|
||||||
if($event->page_matches("home")) {
|
if($event->page_matches("home")) {
|
||||||
@ -37,10 +47,9 @@ class Home extends SimpleExtension {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$sb = new SetupBlock("Home Page");
|
$sb = new SetupBlock("Home Page");
|
||||||
$sb->add_label("Page Links - Example: [$"."base/index|Posts]");
|
$sb->add_longtext_option("home_links", 'Page Links - Example: [/post/list|Posts]<br>');
|
||||||
$sb->add_longtext_option("home_links", "<br>");
|
$sb->add_longtext_option("home_text", "<br>Page Text:<br>");
|
||||||
$sb->add_choice_option("home_counter", $counters, "<br>Counter: ");
|
$sb->add_choice_option("home_counter", $counters, "<br>Counter: ");
|
||||||
$sb->add_label("<br>Note: page accessed via /home");
|
|
||||||
$event->panel->add_block($sb);
|
$event->panel->add_block($sb);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,7 +84,9 @@ class Home extends SimpleExtension {
|
|||||||
$main_links = str_replace('|', "'>", $main_links);
|
$main_links = str_replace('|', "'>", $main_links);
|
||||||
$main_links = str_replace(']', "</a>", $main_links);
|
$main_links = str_replace(']', "</a>", $main_links);
|
||||||
|
|
||||||
return $this->theme->build_body($sitename, $main_links, $contact_link, $num_comma, $counter_text);
|
$main_text = $config->get_string('home_text');
|
||||||
|
|
||||||
|
return $this->theme->build_body($sitename, $main_links, $main_text, $contact_link, $num_comma, $counter_text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -10,7 +10,7 @@ class HomeTheme extends Themelet {
|
|||||||
<link rel='stylesheet' href='$data_href/themes/$theme_name/style.css' type='text/css'>
|
<link rel='stylesheet' href='$data_href/themes/$theme_name/style.css' type='text/css'>
|
||||||
</head>
|
</head>
|
||||||
<style>
|
<style>
|
||||||
div#front-page h1 {font-size: 4em; margin-top: 2em; text-align: center; border: none; background: none;}
|
div#front-page h1 {font-size: 4em; margin-top: 2em; margin-bottom: 0px; text-align: center; border: none; background: none;}
|
||||||
div#front-page {text-align:center;}
|
div#front-page {text-align:center;}
|
||||||
.space {margin-bottom: 1em;}
|
.space {margin-bottom: 1em;}
|
||||||
div#front-page div#links a {margin: 0 0.5em;}
|
div#front-page div#links a {margin: 0 0.5em;}
|
||||||
@ -24,31 +24,31 @@ EOD
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function build_body($sitename, $main_links, $contact_link, $num_comma, $counter_text) {
|
public function build_body($sitename, $main_links, $main_text, $contact_link, $num_comma, $counter_text) {
|
||||||
return "
|
$main_links_html = empty($main_links) ? "" : "<div class='space' id='links'>$main_links</div>";
|
||||||
<div id='front-page'>
|
$message_html = empty($main_text) ? "" : "<div class='space' id='message'>$main_text</div>";
|
||||||
<h1>
|
$counter_html = empty($counter_text) ? "" : "<div class='space' id='counter'>$counter_text</div>";
|
||||||
<a style='text-decoration: none;' href='".make_link()."'><span>$sitename</span></a>
|
$search_html = "
|
||||||
</h1>
|
<div class='space' id='search'>
|
||||||
<div class='space' id='links'>
|
|
||||||
$main_links
|
|
||||||
</div>
|
|
||||||
<div class='space'>
|
|
||||||
<form action='".make_link("post/list")."' method='GET'>
|
<form action='".make_link("post/list")."' method='GET'>
|
||||||
<input id='search_input' name='search' size='55' type='text' value='' autocomplete='off' /><br/>
|
<input id='search_input' name='search' size='30' type='text' value='' autocomplete='off' />
|
||||||
<input type='hidden' name='q' value='/post/list'>
|
<input type='hidden' name='q' value='/post/list'>
|
||||||
<input type='submit' value='Search'/>
|
<input type='submit' value='Search'/>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div style='font-size: 80%; margin-bottom: 2em;'>
|
";
|
||||||
<a href='$contact_link'>contact</a> – Serving $num_comma posts
|
return "
|
||||||
</div>
|
<div id='front-page'>
|
||||||
|
<h1><a style='text-decoration: none;' href='".make_link()."'><span>$sitename</span></a></h1>
|
||||||
<div class='space'>
|
$main_links_html
|
||||||
Powered by <a href='http://trac.shishnet.org/shimmie2/'>Shimmie</a>
|
$search_html
|
||||||
</div>
|
$message_html
|
||||||
<div class='space'>
|
$counter_html
|
||||||
$counter_text
|
<div class='space' id='foot'>
|
||||||
|
<small><small>
|
||||||
|
<a href='$contact_link'>Contact</a> – Serving $num_comma posts –
|
||||||
|
Running <a href='http://code.shishnet.org/shimmie2/'>Shimmie</a>
|
||||||
|
</small></small>
|
||||||
</div>
|
</div>
|
||||||
</div>";
|
</div>";
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user