Jump to content

Function contents not being output


Tyssen
 Share

Recommended Posts

I have this in my template:

function sponsor_row($group) {

	$output = 'test';

	foreach($page->sponsors as $sponsor) :

		// if ($sponsor->sponsor_group->title == $group) :

		$output .= '<li>
			<a href="#">
				<img src="'. $sponsor->sponsor_logo->url .'" alt="">
				'. $sponsor->sponsor_title .'
			</a>
		</li>';

		// endif;

	endforeach;

	return $output;
}

$outMain = sponsor_row();

What's getting printed out is 'test' and not the contents of the $output variable further down. I've verified the the foreach loop does output data (and in fact if I just type a string out for $output in the loop it still produces the same result), so why is only the first instance of $output being output?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...