Page 1 of 1

Text on the home page

Posted: Wed Nov 17, 2021 12:23 pm
by Avistar
How can I place text only on home page? So that it is not on second page or on categories page?

Re: Text on the home page

Posted: Wed Nov 17, 2021 1:30 pm
by Edi
Sorry, I do not understand your question. Can you please give an example.

Re: Text on the home page

Posted: Wed Nov 17, 2021 2:33 pm
by Avistar
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

Re: Text on the home page

Posted: Sat Nov 20, 2021 4:26 pm
by Edi
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 ?>

Re: Text on the home page

Posted: Sat Nov 20, 2021 6:41 pm
by jbuchberger
Or you can do it in this way...

Code: Select all

<?php if ($WHERE_AM_I == 'home'): echo "Some Text"; endif; ?>

Re: Text on the home page

Posted: Sat Nov 20, 2021 7:24 pm
by Edi
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: