View Full Version : Redirect to "header 'Location: URL' ...but include in the code this: rel="lightbox"

05-29-2011, 06:49 PM

I am designing a php code to open a Light Box if the statement calls true.

The else is here:

else {
header('Location: http://www.this_domain.co/light_box/image-1.jpg');

But i want to have this attribute included: rel="lightbox" or it won't open the iframe that the Light Box is meant to be in.

With out that bit of code the image just opens in a browser window, and without the iframe.

Does anyone know how to fix this?


05-29-2011, 07:11 PM
By not redirecting to an image.
Header Location is used to change to an alternate location. If you provide it an image, it will go to an image, not an html page. The only way to target using an iframe using a header is to make sure that the location is being triggered by the script within the frame, and not from within the window.
PHP is server side, it doesn't know anything about a frame, nor does it care. The extent of what PHP will care about is creating an iframe tag and giving it a target. It will serve this to the browser that decides what to do with it.

05-29-2011, 08:06 PM
ok, thanks very much for that,