renderPartial for lightbox

Controller action:

public function actionPhotos($view)


	$model=Photo::model()->find('name=:name', array(':name'=>$view));




	$this->render('photos', array(







<div class="photo">

<?php echo $this->renderPartial('_photo', array('user'=>$user, 'model'=>$model), true); ?>


In my gallery the URL for the images is:


When clicking on this link it brings up the image in the lightbox, but within a layout. I want to set it up so that when viewing images in the lightbox it only loads the partial view "_photo". But when directly accessing the URL it should load the image within the layout as normal.

use some kind of get parameter dinamically created using js when lightbox call the image, something like "?nolay=true"

and then use it to define if the image will or not use a layout

How can I do that? Does FancyBox have any options to pass a GET variable?


    	$(' img').each(function(){



    	$('').fancybox(options);///or whatever


this way it will work even if js is disable, exactly like you want

I see, but that will append the variable to my URL - will not look nice! Can we send the variable in the background, onclick?

you sure can, but that will require a little hack in the plugin’s function

anyway, it wont appear in the url because it will only be used if lightbox is active, this way loading it in a layer instead of realoding the page

if JS is disabled the image’s url will remain the same

I have no idea how to do this. The problem is that it is a lightbox gallery, so I can’t check for clicks on the anchor link either.

There must be another solution.

OK sorry my mistake, I was applying your code to A elements rather than IMG elements.

So now the image URLs have the GET parameter, but how do I check for this in my code? The image URL is just pointing to the actual file on the server, eg:

<div class="photo">

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

  <img src="/mysite/images/member/4698568/4086021_thumb.jpg?nolay=true" alt=""></a>


My bad also

It should be added to the link, a tag, itself, but it wont mess up your url’s

If JS is disabled it wont add any parameter, since the parameter is created via javascript

If JS is enabled, then lightbox will render its image therefore url’s wont be displayed to the user

It does append it to the URL:


not the browser’s url

only if some1 look at the source code , or if you put mouseover it will show in left bottom corner in firefox.

anyway, i cant think in any other solution for your problem …