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: 3121
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Has thanked: 54 times
Been thanked: 77 times
Contact:

Sorry, I do not understand your question. Can you please give an example.
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets
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: 3121
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Has thanked: 54 times
Been thanked: 77 times
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 ?>
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets
jbuchberger
Jr. Bludit
Posts: 5
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: 3121
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Has thanked: 54 times
Been thanked: 77 times
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:
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets
Post Reply