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
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

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.