Astatek Posted March 6, 2015 Share Posted March 6, 2015 (edited) Hello i am new with processwire,i cant have complete url of good images.now i can have only image file name.{$agent->title} are OKbut {$agent->images} src='image_name.jpg'and {$agent->description} are empty <?php if($page->id == 1) $agents = $pages->get("/agents/")->children("limit=4"); echo "<div class='row'>" ; foreach($agents as $agent) { echo "<div class='large-3 columns'>" . "<img class='img-circle' src='{$agent->images}' alt='{$agent->description}'>" . "<h4>{$agent->title}</h4>" . "<p>Bacon ipsum dolor sit amet nulla ham qui sint exercitation eiusmod commodo, chuck duis velit. Aute in reprehenderit, dolore aliqua non est magna in labore pig pork biltong. Eiusmod swine spare ribs reprehenderit culpa. Boudin aliqua adipisicing rump corned beef.</p>" . "</div>"; } ?> Edited March 6, 2015 by Astatek Link to comment Share on other sites More sharing options...
adrian Posted March 6, 2015 Share Posted March 6, 2015 HI Astatek and welcome to the forums. By default, image fields can contain more than one image, so they will return an array of images, even if only one is uploaded. The simplest option is: $agent->images->first()->url but if you choose to change the setting on the image field's Details tab - "Max Files Allowed" to 1, then you could remove the need for the "first()". You can also adjust what will be returned when formatting is on by adjusting the "Formatted Value" options. You should have a good read through http://processwire.com/api/fieldtypes/images/ to get a better understanding. Hope that helps. 1 Link to comment Share on other sites More sharing options...
Astatek Posted March 6, 2015 Author Share Posted March 6, 2015 thanks for your nice reponse now its work and i more understand . 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