Layout/Theme selection when embedding G2

cschlatt

Joined: 2005-05-24
Posts: 17
Posted: Fri, 2005-06-03 15:29

It would be very nice if there would be a possibility to choose the layout/theme (default or per album) when embedding G2. Maybe the init call of the GalleryEmbed class could be used for that.

Does someone know a way to choose dynamically the layout and/or theme of an album?

Thanks

 
ozgreg
ozgreg's picture

Joined: 2003-10-18
Posts: 1378
Posted: Fri, 2005-06-03 23:42
 
cschlatt

Joined: 2005-05-24
Posts: 17
Posted: Sat, 2005-06-04 13:43

I've found a temporary solution:

In the layout.inc file of my own layout called clean, I use

	if (GalleryUtilities::isEmbedded()) {
		/* Add our header and styles */
		$template->head('layouts/clean/templates/head.tpl');
		$template->style('templates/layout.css');
		$template->style('layouts/clean/layout.css');
		return array(GalleryStatus::success(), 'layouts/clean/templates/albumBody.tpl');
	} else {
		/* we use matrix layout for standalone */
		$template->head('layouts/matrix/templates/head.tpl');
		$template->style('templates/layout.css');
		$template->style('layouts/matrix/layout.css');
		return array(GalleryStatus::success(), 'layouts/matrix/templates/albumBody.tpl');
	}

so that for the standalone instance of G2 the matrix layout is used and the clean layout otherwise. This is not a very nice solution but it works for now.

Doing the same trick with default theme selection unfortunately doesn't work, but one can choose its own css file while embedding anyways.