Text on the home page

Post Reply
Avistar
Jr. Bludit
Posts: 4
Joined: Tue Sep 28, 2021 4:23 pm

How can I place text only on home page? So that it is not on second page or on categories page?
User avatar
Edi
Site Admin
Posts: 2556
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Contact:

Sorry, I do not understand your question. Can you please give an example.
Planet Bludit, Tipps, Snippets und nützliche Links.
Image
Avistar
Jr. Bludit
Posts: 4
Joined: Tue Sep 28, 2021 4:23 pm

theme\php\home.php
code:
<?php if (!Paginator::showPrev()): ?>
<p>TEXT</p>
<?php endif ?>

Shows the text on homepage and in categories. How to leave only on homepage
User avatar
Edi
Site Admin
Posts: 2556
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Contact:

You can use the following:

Code: Select all

<?php

$current_page = $_SERVER['REQUEST_URI'];

if (strpos($current_page, '/category') === false): ?>

<p>"TEXT"</p>

<?php endif ?>
Planet Bludit, Tipps, Snippets und nützliche Links.
Image
jbuchberger
Jr. Bludit
Posts: 3
Joined: Fri Oct 08, 2021 8:49 am

Or you can do it in this way...

Code: Select all

<?php if ($WHERE_AM_I == 'home'): echo "Some Text"; endif; ?>
User avatar
Edi
Site Admin
Posts: 2556
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Contact:

jbuchberger wrote: Sat Nov 20, 2021 6:41 pm

Code: Select all

<?php if ($WHERE_AM_I == 'home'): echo "Some Text"; endif; ?>
This is the better solution. I thought this condition would also be used for categories. :oops:
Planet Bludit, Tipps, Snippets und nützliche Links.
Image
Post Reply