Jump to content

Open file in parent page


Abyss_Rover

Recommended Posts

Hi,

 

I have multiple divs that are loaded into my "main_index.php" page. On

each div there is a "More information" link "<a

href="advert_details.php?advert_id=<?php print $advert_id?>" id="more<?

php print $advert_id?>">More</a>"

 

On the "main_index.php" page, I have the lightbox script

 

$('a').filter(function() {

        return this.id.match(/more[0-9]/);

        }).fancybox({

                'overlayColor' : '#000',

                'overlayOpacity' : 0.1,

                'width' : 640,

                'height' : 940,

                'type' : 'iframe'

        });

 

This opens the details in the fancybox.

 

When one of these pages "advert_details.php" are shown by a search

engine, when you follow the link, the page "advert_details.php" opens

with all of the information but I would like it to open the

"main_index.php" page first and then the advert_details.php.

 

Can anyone suggest a way to do this please.

 

Thanks

 

Peter

Link to comment
https://forums.phpfreaks.com/topic/262830-open-file-in-parent-page/
Share on other sites

  • 2 weeks later...

The following has been suggested. Could anybody suggest how I would implement this or something similar.

 

1. create a session cookie for visitors coming to "main_index.php"

2. within "advert_details.php" evaluate if the cookie exists :

- if so, it means that the request is coming from your site so you can

open it in fancybox

- if not, it means that the request is coming from elsewhere (a search

engine in this example) .... then you can use php header() to redirect

to main_index.php otherwise

Part way there.

 

I have added the following to main_index.php

 

$_SESSION['fromsite']='yes'

 

And this to advert_details.php

 

if(isset($_SESSION['fromsite'])){
echo 'is set';
}else{
header('

Location: http://www.finditfme.com/main_index.php') ;

}

 

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?

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.