mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
Home
* added variable titles and oneliners to frontpage * added cascading foreign keys to news_overlay -> news * renamed news -> featuredbox for consistency Misc * aowow_dbversion is now part of the basic sql * also the db-dump is a fresh one and i'm shocked how often i forgot to apply updated there :< * from now on shorttags will be used for 'echo' in template (e.g. <?=$var; ?>)
This commit is contained in:
@@ -6,11 +6,12 @@ if (!defined('AOWOW_REVISION'))
|
||||
|
||||
class HomePage extends GenericPage
|
||||
{
|
||||
protected $tpl = 'home';
|
||||
protected $js = ['home.js'];
|
||||
protected $css = [['path' => 'home.css']];
|
||||
protected $tpl = 'home';
|
||||
protected $js = ['home.js'];
|
||||
protected $css = [['path' => 'home.css']];
|
||||
|
||||
protected $news = [];
|
||||
protected $news = [];
|
||||
protected $oneliner = '';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@@ -21,8 +22,12 @@ class HomePage extends GenericPage
|
||||
{
|
||||
$this->addCSS(['string' => '.announcement { margin: auto; max-width: 1200px; padding: 0px 15px 15px 15px }']);
|
||||
|
||||
// load oneliner
|
||||
if ($_ = DB::Aowow()->selectRow('SELECT * FROM ?_home_oneliner WHERE active = 1 LIMIT 1'))
|
||||
$this->oneliner = Util::jsEscape(Util::localizedString($_, 'text'));
|
||||
|
||||
// load news
|
||||
$this->news = DB::Aowow()->selectRow('SELECT id as ARRAY_KEY, n.* FROM ?_news n WHERE active = 1 ORDER BY id DESC LIMIT 1');
|
||||
$this->news = DB::Aowow()->selectRow('SELECT id as ARRAY_KEY, n.* FROM ?_home_featuredbox n WHERE active = 1 ORDER BY id DESC LIMIT 1');
|
||||
if (!$this->news)
|
||||
return;
|
||||
|
||||
@@ -37,7 +42,7 @@ class HomePage extends GenericPage
|
||||
$this->news['bgImgUrl'] = strtr($this->news['bgImgUrl'], ['HOST_URL' => HOST_URL, 'STATIC_URL' => STATIC_URL]);
|
||||
|
||||
// load overlay links
|
||||
$this->news['overlays'] = DB::Aowow()->select('SELECT * FROM ?_news_overlay WHERE newsId = ?d', $this->news['id']);
|
||||
$this->news['overlays'] = DB::Aowow()->select('SELECT * FROM ?_home_featuredbox_overlay WHERE featureId = ?d', $this->news['id']);
|
||||
foreach ($this->news['overlays'] as &$o)
|
||||
{
|
||||
$o['title'] = Util::localizedString($o, 'title', true);
|
||||
@@ -45,7 +50,12 @@ class HomePage extends GenericPage
|
||||
}
|
||||
}
|
||||
|
||||
protected function generateTitle() {}
|
||||
protected function generateTitle()
|
||||
{
|
||||
if ($_ = DB::Aowow()->selectRow('SELECT * FROM ?_home_titles WHERE active = 1 AND title_loc?d <> "" ORDER BY RAND() LIMIT 1', User::$localeId))
|
||||
$this->title[0] .= Lang::main('colon').Util::localizedString($_, 'title');
|
||||
}
|
||||
|
||||
protected function generatePath() {}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user