Jump to content

Recommended Posts

I want to display different html tags on the php page they are visiting, for example on the homepage and the computer shop basildon page I want the html tag 

<section class="testimonal-two pt-0">

and on all other pages I want the code

<section class="testimonal-two">

Below is the code I have so far and it works for the computer shop basildon page but I'm unsure how to add the homepage into that code, the homepage is called index.php

<?php
    if ($_SERVER["SCRIPT_NAME"] == '/computer-shop-basildon.php') {
        echo '<section class="testimonal-two pt-0">';
    } else {
        echo '<section class="testimonal-two">';
    }
    ?>

 

Just got it working with the following code

<?php $currentpage = $_SERVER['REQUEST_URI'];
                if($currentpage=="/" || $currentpage=="/index.php" || $currentpage=="/index" || $currentpage=="" || $currentpage=="/computer-shop-basildon.php" || $currentpage=="/computer-shop-basildon" ) {
                    echo '<section class="testimonal-two pt-0">';
                } else {
                    echo '<section class="testimonal-two">';
                }
?>

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.