D
D
DevTeam2015-12-09 12:35:06
PHP
DevTeam, 2015-12-09 12:35:06

How to hide a button in a specific page?

How to hide a button in a certain page so that it is not shown on the main page but is shown on others?

Here is the code of the Button it needs to be hidden in the index.php page

<?php if($_SERVER['document_url']=='/index.php' && empty($_SERVER['QUERY_STRING'])){ }else{ echo '<button type="button" class="btn btn-link" onclick="history.back()"><i class="glyphicon glyphicon-arrow-left"></i><span>Назад</span></button>';}?>

Answer the question

In order to leave comments, you need to log in

4 answer(s)
A
Andrew, 2015-12-09
@DevelopersTeam

//echo '<pre>';print_r($_SERVER);echo '</pre>';
if((empty($_SERVER['DOCUMENT_URI']) || $_SERVER['DOCUMENT_URI']=='/index.php')&&
  empty($_SERVER['QUERY_STRING'])){
}else{
  echo '<button type="button" class="btn btn-link" onclick="history.back()">
  <i class="glyphicon	glyphicon-arrow-left"></i><span>Назад</span></button>';
}

X
xAockd, 2015-12-09
@xAockd

if(window.location.pathname == '/') {
   // hide button
 }

S
Serdji, 2015-12-09
@ssumatokhin

if( window.location.pathname == undefined ||  window.location.pathname == '/') {
   $( 'button' ).hide();
};

D
DevTeam, 2015-12-09
@DevelopersTeam

Here is the button code

<button type="button" class="btn btn-link" onclick="history.back()"><i class="glyphicon glyphicon-arrow-left"></i><span>Назад</span></button>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question