mds Posted November 30, 2016 Share Posted November 30, 2016 Getting started with ProcessWire and not much off PHP experience … I've set up a field with authors, which shows a dropdown select of users on my blog entry page. So, in the admin everything works fine. Now I want to show the author on my blog entry page/ php-template. But in the output it only shows the page id, when I use <?php echo $page->author ?> How do I show a different field from that page, for instance the full name or how do I use the URL of the first image on that User page? I thought it would as simple as <?php echo $page->author->fullname ?> Link to comment Share on other sites More sharing options...
adrian Posted November 30, 2016 Share Posted November 30, 2016 Looks like your field is returning an array of author options, so try: <?php echo $page->author->first()->fullname ?> You can also use: last(), or eq(n) The other approach is to foreach through each author: foreach($page->author as $author) { echo '<p>'.$author->firstname.'</p>; } 1 Link to comment Share on other sites More sharing options...
mds Posted November 30, 2016 Author Share Posted November 30, 2016 That works. Thanks! 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now