Page 2 of 3
Re: Static home page and blog via a menu item ?
Posted: Sat May 27, 2023 6:08 pm
by LucyDemoon
in the template index.php have i this code:
Code: Select all
<?php
if ($WHERE_AM_I == 'page') {
if ($page->isStatic()) {
if ($page->category('nav-games') && !$page->isParent()) {
include(THEME_DIR_PHP.'static-games.php');
} elseif($WHERE_AM_I == 'home' or $page->slug() === 'home') {
include(THEME_DIR_PHP.'home.php');
include(THEME_DIR_PHP.'footer.php');
} else {
include(THEME_DIR_PHP . 'static.php');
}
} else {
include(THEME_DIR_PHP.'page.php');
}
} else {
include(THEME_DIR_PHP . 'news.php');
}
?>
Re: Static home page and blog via a menu item ?
Posted: Sat May 27, 2023 11:05 pm
by Edi
What is the code of the template news.php?
Re: Static home page and blog via a menu item ?
Posted: Sun May 28, 2023 3:31 am
by LucyDemoon
Code: Select all
<section class="page-header">
<div class="container">
<div class="row justify-content-center">
<div class="col-lg-7 col-md-9">
<div class="cont text-center">
<h1 class="mb-10 color-font"><?php echo $page->title(); ?></h1>
<?php if ($page->description()): ?>
<p><?php echo $page->description(); ?></p>
<?php endif ?>
</div>
</div>
</div>
</div>
</section>
<section class="blog-pg single section-padding pt-0">
<div class="container">
<div class="row justify-content-center">
<div class="col-lg-11">
<div class="post">
<?php Theme::plugins('pageBegin'); ?>
<?php if ($page->coverImage()): ?>
<div class="img">
<img src="<?php echo $page->coverImage(); ?>" alt="">
</div>
<?php endif ?>
<div class="content pt-60">
<div class="row justify-content-center">
<div class="col-lg-10">
<div class="cont">
<?php echo $page->content(); ?>
</div>
<div class="author">
<div class="author-img">
<img src="<?php echo $page->user('profilePicture'); ?>" alt="">
</div>
<div class="info">
<h6><span>author :</span> <?php echo $page->user('firstName'); ?> (<?php echo $page->user('nickname'); ?>)</h6>
<p class="text-black-50">
<span><?php echo $L->p("Erstellt am: ")?></span>
<span><?php echo $page->date(); ?></span>
</p>
</div>
</div>
</div>
</div>
</div>
<?php Theme::plugins('pageEnd'); ?>
</div>
</div>
</div>
</div>
</section>
Re: Static home page and blog via a menu item ?
Posted: Mon May 29, 2023 1:28 pm
by Edi
Sorry, it's the wrong one. I should have the template with the loop for the slug "blog".
Re: Static home page and blog via a menu item ?
Posted: Mon May 29, 2023 6:16 pm
by LucyDemoon
the news.php is for the slug "blog"
Re: Static home page and blog via a menu item ?
Posted: Mon May 29, 2023 11:39 pm
by Edi
In the template news.php can the following be found (line 8):
Code: Select all
<?php if ($page->isStatic() and $page->coverImage()): ?>
<div class="img parlx img-head-nobg">
<img src="<?php echo $page->coverImage(); ?>" alt="">
</div>
<?php else: ?>
<h1 class="color-font"><?php echo $page->title(); ?></h1>
<?php endif ?>
The else condition shows the title of the first content.
Re: Static home page and blog via a menu item ?
Posted: Tue May 30, 2023 9:49 am
by LucyDemoon
okey and what is the title from static page?
Re: Static home page and blog via a menu item ?
Posted: Tue May 30, 2023 12:23 pm
by Edi
You can hard code it "News" or something like this.
Re: Static home page and blog via a menu item ?
Posted: Tue May 30, 2023 12:37 pm
by LucyDemoon
hm ok, so there is no way to read the title from a static page?
Re: Static home page and blog via a menu item ?
Posted: Tue May 30, 2023 12:49 pm
by Edi
On a static page the title can be displayed with the following:
But this does not work if the URL filter "/blog/" is set (this works like the page with the template
home.php).