Abyss_Rover Posted May 20, 2012 Share Posted May 20, 2012 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 More sharing options...
Abyss_Rover Posted June 4, 2012 Author Share Posted June 4, 2012 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 https://forums.phpfreaks.com/topic/262830-open-file-in-parent-page/#findComment-1351071 Share on other sites More sharing options...
Abyss_Rover Posted June 4, 2012 Author Share Posted June 4, 2012 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 https://forums.phpfreaks.com/topic/262830-open-file-in-parent-page/#findComment-1351088 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.