Jump to content

Recommended Posts

Posted

The output I get is an ID instead of a selected item. My page reference is located in my tree like this:

Momenten (page reference)
-Maandag
-Dinsdag
-Woensdag
etc.

This is my code. The field "dag" is the page reference but outputs ID's:

$items = $page->children("sort=datum");		 
	foreach ($items as $item) {
	echo '
		<div class="col-md-12">
		<audio controls preload="none">
		<source src="' . $item->mp3->url .'" type="audio/mpeg">
		<p>Audio is niet hoorbaar, HTML5 audio wordt door uw browser waarschijnlijk niet ondersteund.</p>
		</audio>
		</div>

		<div class="col-md-12">
		<p><b>'. $item->predikant .'</b> op <b/>'. $item->datum .'</b> ('. $item->dag .')</p>
		</div>';
		}

 

Posted

@tooth-paste Just a little tip: If you wrap your HTML and PHP in double quotes and use this syntax: {$item->mp3->url} you don't need to concatenate your string with 'foo ' . $var . ' bar' etc.

  • Like 1
Posted
5 hours ago, tooth-paste said:

The output I get is an ID instead of a selected item

Just to make things clear in case they aren't, you are getting the selected item - you're actually getting the full $page object for the item. The __toString() method is resulting in the ID of that being being output when you try to echo it as a string. You have to specify what field you want from the page, ->title, ->body, etc.

  • Like 1
  • Thanks 1

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
  • Recently Browsing   0 members

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