Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3616096
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T22:27:26+00:00 2026-05-18T22:27:26+00:00

Basically I have a slightly non-standard implementation of FancyBox. By default you have to

  • 0

Basically I have a slightly non-standard implementation of FancyBox. By default you have to include a link to the large version of the image so that the Lightbox can display it. However, in my implementation, the image link URLs point to a script rather than directly to the image file. So for example, instead of:

<a href="mysite/images/myimage.jpg" rel="gallery">

I have:

<a href="mysite/photos/view/abc123" rel="gallery"> 

The above URL points to a function:

public function actionPhotos($view)
{
    $photo=Photo::model()->find('name=:name', array(':name'=>$view));

    if(!empty($photo))
    {           
        $this->renderPartial('_photo', array('photo'=>$photo, true));
    }
}

The “$this->renderPartial()” bit simply calls a layout file which includes a standard HTML tag to output.

Now when the user clicks on a thumbnail, the above function is called and the large image is displayed in the Lightbox.

Now if the user right clicks on the thumbnail and selects “open in new tab/window” then the image is displayed in the browser as per normal, i.e. just the image. I want to change this so that it displays the image within a layout.

In the above code I can include the following and put it in an IF statement:

$this->render('photos', array('photo'=>$photo));

This will call the layout file “photos” which contains the layout to display the image in.

I have a specific limitation for this – the image URL must remain the same, i.e. no additional GET variables in the URL. However if we can pass in a GET variable in the background then that is OK.

I will most likely need to change my function above so that it calls a different file for this functionality.

EDIT: To demonstrate exactly what I am trying to do, check out the following:

http://www.starnow.co.uk/KimberleyMarren

Go to the photos tab and hover over a thumbnail – note the URL. Click the thumbnail and it will open up in the Lightbox. Next right click on that same thumbnail and select “open in new tab/new window”. You will notice that the image is now displayed in a layout. So that same URL is used for displaying the image in the Lightbox and on its own page.

The way StarNow have done this is using some crazy long JavaScript functionality, which I’m not too keen on replicating.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T22:27:27+00:00Added an answer on May 18, 2026 at 10:27 pm

    The html link should point to the layout showing the image on a new page by default, e.g.:

    <a href="mysite/images/show/123" rel="gallery">
    

    Before the lightbox opens, append a query string to the url in order to distinguish it from the normal link and load the layout for the lightbox. As soon as the image is loaded in the lightbox, change the link back to its original state.

    $("a[rel=gallery]").fancybox({
    'onStart': function (selectedArray, selectedIndex, selectedOpts) {
        var el = $(selectedArray[selectedIndex]);
        el.attr('href', el.attr('href') + '?mode=lightbox');
    },
    'onComplete': function (currentArray, currentIndex, currentOpts) {
        var el = $(currentArray[currentIndex]);
        el.attr('href', el.attr('href').split("?")[0]);
    }
    });
    

    You will then have to process the following link in order to return the lightbox layout:

    <a href="mysite/images/show/123?mode=lightbox" rel="gallery">
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So basically I have many functions that are very similar but just with slightly
I basically have a program that filters records from one excel file to another
I basically have 7 select statements that I need to have the results output
I have a client requesting an animated/panned image be added to their website. Basically,
Ok, basically I have a view with a series of slightly overlapping subviews. When
I have a standard content editable div: <div id="profileBody" class="customInputDiv" contentEditable='true' autocomplete="off"></div> Basically I
I may of got the Title slightly wrong but basically, I have two cells.
I have created a content div that holds list items, the div is slightly
I have to interface with a slightly archaic system that doesn't use webservices. In
I basically have three tables, posts, images and postimages (this simply contains the ids

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.