sa_designer Posted October 20, 2011 Share Posted October 20, 2011 I've created my first field an image field called Main image which will live above the headline. I managed to create the field and add the field to the template. But nothing is showing? What have I done wrong? Link to comment Share on other sites More sharing options...
apeisa Posted October 20, 2011 Share Posted October 20, 2011 Hi sa_designer and welcome to the forums! I've created my first field an image field called Main image which will live above the headline. I managed to create the field and add the field to the template. But nothing is showing? Images (and files) are little bit different from text-based fields. Here is topic which helps you forward: http://processwire.com/talk/index.php/topic,16.0.html and even more information from here: http://processwire.com/api/fieldtypes/images/ Also one way to show images are when using TinyMCE field - just click image field and choose the image. But best use is usually in templates. Link to comment Share on other sites More sharing options...
sa_designer Posted October 20, 2011 Author Share Posted October 20, 2011 Thanks, this doesn't really help me. Link to comment Share on other sites More sharing options...
Pete Posted October 20, 2011 Share Posted October 20, 2011 Welcome to the forums Can you show us the code you're using in your front-end template file? Then we might be able to see what the issue is and point you in the right direction. Link to comment Share on other sites More sharing options...
slkwrm Posted October 20, 2011 Share Posted October 20, 2011 Welcome to forums, SA_DESIGNER You should write a couple of lines of code in your template to output your image. Your code should go something like this: if (count($page->images)){ foreach ($page->images as $image) { echo "<img src='{$image->url}' alt='{$image->description}'</img>"; } } Replace images with the name of your image field. See site/templates/basic-page.php and head.inc for an example with thumbs. Cheers. 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