/    Sign up×
Community /Pin to ProfileBookmark

Force lightbox to open in parent page php JavaScript

Yet another newbie asking for help.

I have a Main_index.php page. Multiple divs are loaded into this page and each div has a “More” information button. Each div is a template style and is completed with mysql data.

[CODE]<div class=”more”><a href=”advert_details.php?advert_id=<?php print $advert_id?>”id=”more<?php print $advert_id?>”><?php echo MORE ?></a></div>[/CODE]

Each “More” button brings up a new page “advert_details.php”, inside a lightbox. This is again a template style and loads details from mysql. The lightbox code is in the Main_index.php.

[CODE]<script language=”JavaScript” type=”text/javascript”>
$(document).ready(function()
{
$(‘a’).filter(function() {
return this.id.match(/more[0-9]/);
}).fancybox({
‘overlayColor’ : ‘#000’,
‘overlayOpacity’ : 0.1,
‘width’ : 640,
‘height’ : 940,
‘type’ : ‘iframe’
});
});
</script>[/CODE]

If one of the “advert_details.php” pages is found by a search engine, when you click on the search result, the lightbox opens in a blank page.

Is there anything I can add, to force the “advert_details.php” page to open in the “main_index.php” page, making use of the lightbox JavaScript and showing the main site page?

I hope that I have explained this well, if not, please ask for more details.

Thanks

Peter

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@Abyss_RoverauthorJun 04.2012 — Part way there.

I have added the following to main_index.php
[CODE]$_SESSION['fromsite']='yes'[/CODE]

And this to advert_details.php

[CODE]if(isset($_SESSION['fromsite'])){
echo 'is set';
}else{
header('Location: http://www.finditfme.com/main_index.php') ;
}[/CODE]


When coming from the site I get "is set". When coming from google I am redirected to the main_index.php.

Can someone help me to call the advert_details page?
×

Success!

Help @Abyss_Rover spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...