div display none if current url

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

New php-forum User
New php-forum User
Posts: 1
Joined: Fri Feb 07, 2014 12:03 pm

div display none if current url

Postby sandjanice » Fri Feb 07, 2014 1:09 pm

I am working on a dev site [http://athenswebstudio.com/devsites/ritchey-enterprises-dev/index.php] where I have several portfolios [hotels, restaurants, etc.]. Each portfolio has its own php code at the top to identify the unique url.

For example, on the Hotels - Peoria page, this is the code:
$page = 'portfolio';
$title = 'Ritchey Enterprises | Hotel Portfolio | Jameson Inn - Little Rock';
$url = 'hotels-jameson-inn-peoria.php';

Using the Peoria page as an example [http://athenswebstudio.com/devsites/ritchey-enterprises-dev/hotels-jameson-inn-peoria.php], I do not want the thumbnail displayed in the area for 'related work'.

So, I have created a restaurant related items template and have the following code for Peoria:
<!-- peoria -->
<div id="jamesoninnpeoria" <?php if($url == 'hotels-jameson-inn-peoria.php') { echo 'style="display:none !important;"'; } ?>>
<div class="portfolio-item border" >
<div class="portfolio-item-hover">
<a href="hotels-jameson-inn-peoria.php"></a>
<div class="portfolio-item-hover-info"><hr/>
<h3>Jameson Inn - Peoria</h3>
<img src="images/hotels/related work/RitcheyEnterprises-JamesonInn-Peoria.jpg" alt="Ritchey Enteprises Jameson Inn Peoria" />

The image is not being displayed; however, there is a space where the image should appear. It works fine on the other hotel pages, but for some reason not on this one.

Also having a similar issue on the restaurant pages. Works fine on some pages, but has a blank space on others.

I hope I have provided enough information to trouble shoot this issue.

Many thanks in advance!!!

User avatar
php-forum Active User
php-forum Active User
Posts: 277
Joined: Wed Aug 25, 2010 10:42 am

Re: div display none if current url

Postby macek » Mon Feb 17, 2014 11:44 pm

First you should do is to look to the result - to the html document source code. Then you will know if problem is in PHP or HTML/CSS ,..

php-forum Fan User
php-forum Fan User
Posts: 973
Joined: Mon Oct 01, 2012 12:32 pm

Re: div display none if current url

Postby seandisanti » Thu Feb 27, 2014 10:41 am

You can save yourself some manual work by using server variables instead of individual variables set on each page. See http://www.php.net/manual/en/reserved.v ... server.php

Return to “PHP coding => General”

Who is online

Users browsing this forum: Yahoo [Bot] and 10 guests