This repository has been archived on 2024-09-05. You can view files and clone it, but cannot push or open issues or pull requests.
shimmie2/ext/home/theme.php

63 lines
2 KiB
PHP
Raw Normal View History

2021-12-14 18:32:47 +00:00
<?php
declare(strict_types=1);
namespace Shimmie2;
class HomeTheme extends Themelet
{
public function display_page(Page $page, string $sitename, string $base_href, string $theme_name, string $body): void
{
2019-06-19 01:58:28 +00:00
$page->set_mode(PageMode::DATA);
$page->add_auto_html_headers();
$hh = $page->get_all_html_headers();
$page->set_data(
<<<EOD
2016-09-03 17:48:20 +00:00
<!doctype html>
2020-03-13 09:23:54 +00:00
<html lang="en">
<head>
<title>$sitename</title>
2011-12-23 14:22:32 +00:00
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
2015-01-08 23:31:24 +00:00
<meta name="viewport" content="width=device-width, initial-scale=1">
$hh
</head>
<body>
$body
</body>
</html>
EOD
2019-11-02 19:57:34 +00:00
);
}
public function build_body(string $sitename, string $main_links, string $main_text, string $contact_link, $num_comma, string $counter_text): string
{
$main_links_html = empty($main_links) ? "" : "<div class='space' id='links'>$main_links</div>";
2021-12-14 18:32:47 +00:00
$message_html = empty($main_text) ? "" : "<div class='space' id='message'>$main_text</div>";
$counter_html = empty($counter_text) ? "" : "<div class='space' id='counter'>$counter_text</div>";
$contact_link = empty($contact_link) ? "" : "<br><a href='$contact_link'>Contact</a> &ndash;";
$search_html = "
2009-08-24 01:15:08 +00:00
<div class='space' id='search'>
<form action='".search_link()."' method='GET'>
<input name='search' size='30' type='search' value='' class='autocomplete_tags' autofocus='autofocus' />
<input type='hidden' name='q' value='/post/list'>
<input type='submit' value='Search'/>
</form>
</div>
2009-08-24 01:15:08 +00:00
";
return "
2009-08-24 01:15:08 +00:00
<div id='front-page'>
<h1><a style='text-decoration: none;' href='".make_link()."'><span>$sitename</span></a></h1>
$main_links_html
$search_html
$message_html
$counter_html
<div class='space' id='foot'>
<small><small>
2023-06-26 03:36:30 +00:00
$contact_link" . (empty($num_comma) ? "" : " Serving $num_comma posts &ndash;") . "
2020-03-25 11:47:00 +00:00
Running <a href='https://code.shishnet.org/shimmie2/'>Shimmie2</a>
2009-08-24 01:15:08 +00:00
</small></small>
</div>
</div>";
}
}