Skip to main content
added 87 characters in body
Source Link
Jimajamma
  • 17.1k
  • 1
  • 28
  • 35

Sure. Just look at what's inside $views and grab the path/url of the image there and stuff that into $background_image and then do something like:

<div class="container-inner clearfix" style="background: url(<?php print $background_image; ?>)">

Sidenote: it might be better to this in a preprocess hook and pass in this as a variable instead of putting this logic in your page.tpl.php file, eg, something like:

function my_module_or_theme_preprocess_page(&$vars) {

  // $views=views_embed_view('photos', 'block');
  $views=views_get_view_result('photo', 'block'); // appears to work easier :)
  $background_image=// however you get the url/path to the image from $views;

  $vars['background_image']=$background_image;

}

which will create a $background_image variable that is now available inside page.tpl.php.

Sure. Just look at what's inside $views and grab the path/url of the image there and stuff that into $background_image and then do something like:

<div class="container-inner clearfix" style="background: url(<?php print $background_image; ?>)">

Sidenote: it might be better to this in a preprocess hook and pass in this as a variable instead of putting this logic in your page.tpl.php file, eg, something like:

function my_module_or_theme_preprocess_page(&$vars) {

  $views=views_embed_view('photos', 'block');
  $background_image=// however you get the url/path to the image from $views;

  $vars['background_image']=$background_image;

}

which will create a $background_image variable that is now available inside page.tpl.php.

Sure. Just look at what's inside $views and grab the path/url of the image there and stuff that into $background_image and then do something like:

<div class="container-inner clearfix" style="background: url(<?php print $background_image; ?>)">

Sidenote: it might be better to this in a preprocess hook and pass in this as a variable instead of putting this logic in your page.tpl.php file, eg, something like:

function my_module_or_theme_preprocess_page(&$vars) {

  // $views=views_embed_view('photos', 'block');
  $views=views_get_view_result('photo', 'block'); // appears to work easier :)
  $background_image=// however you get the url/path to the image from $views;

  $vars['background_image']=$background_image;

}

which will create a $background_image variable that is now available inside page.tpl.php.

added 367 characters in body
Source Link
Jimajamma
  • 17.1k
  • 1
  • 28
  • 35

Sure. Just look at what's inside $views and grab the path/url of the image there and stuff that into $background_image and then do something like:

<div class="container-inner clearfix" style="background: url(<?php print $background_image; ?>)">

Sidenote: it might be better to this in a preprocess hook and pass in this as a variable instead of putting this logic in your page.tpl.php file, eg, something like:

function my_module_or_theme_preprocess_page(&$vars) {

  $views=views_embed_view('photos', 'block');
  $background_image=// however you get the url/path to the image from $views;

  $vars['background_image']=$background_image;

}

which will create a $background_image variable that is now available inside page.tpl.php.

Sure. Just look at what's inside $views and grab the path/url of the image there and stuff that into $background_image and then do something like:

<div class="container-inner clearfix" style="background: url(<?php print $background_image; ?>)">

Sidenote: it might be better to this in a preprocess hook and pass in this as a variable instead of putting this logic in your page.tpl.php file.

Sure. Just look at what's inside $views and grab the path/url of the image there and stuff that into $background_image and then do something like:

<div class="container-inner clearfix" style="background: url(<?php print $background_image; ?>)">

Sidenote: it might be better to this in a preprocess hook and pass in this as a variable instead of putting this logic in your page.tpl.php file, eg, something like:

function my_module_or_theme_preprocess_page(&$vars) {

  $views=views_embed_view('photos', 'block');
  $background_image=// however you get the url/path to the image from $views;

  $vars['background_image']=$background_image;

}

which will create a $background_image variable that is now available inside page.tpl.php.

Source Link
Jimajamma
  • 17.1k
  • 1
  • 28
  • 35

Sure. Just look at what's inside $views and grab the path/url of the image there and stuff that into $background_image and then do something like:

<div class="container-inner clearfix" style="background: url(<?php print $background_image; ?>)">

Sidenote: it might be better to this in a preprocess hook and pass in this as a variable instead of putting this logic in your page.tpl.php file.