Search the Community
Showing results for tags 'pageinputfield'.
-
Good Day! I am a beginer of processwire project. Thanks developers for your great work. this CMS is very Good! I have a question: how get Pageimage object of PageArray from "Page" (PageArray) field type? I have too tamplates: affiliates and their teachers. The template of affiliates have a field "teachers_list" wich is "Page" (PageArray) type. When I vaffiliate teachers in a cycle, I can not access the teacher photo object and change its size. I get an error returning: " Fatal error: Call to a member function maxWidth() on null ". When i trying get URL attribute : $teacherItem->teacher_photo->url, i receive message: " Trying to get property of non-object ". But this code works: $teacherItem->teacher_photo["url"]. The print_r function outputs the following information: "ProcessWire \ Pageimage Object ([changes] => Array ([0] => formatted) [hooks] => Array ([Pageimage :: pim2Load] => PageImageManipulator02-> getPageImageManipulator02 () in PageImageManipulator02.module ) [Data] => Array ([basename] => p16.jpg [description] => .... - ..... [tags] => [formatted] => 1 [modified] => 1487079115 [created ] => 1487079115))". my PHP code: foreach ($page->teacher_list as $teacherItem): $out .= " <tr> <td class=\"alignTop\"> /* !!! my truble */ <img src=\"{$teacherItem->teacher_photo->maxWidth(250)->url}\" /> /* !!! my truble */ </td> <td class=\"alignTop\"> <div class=\"teach_style12\"> <strong>$teacherItem->fio</strong><br/> $teacherItem->degree<br/> $teacherItem->headline_detail </div> <div class=\"teach_style9\"> $teacherItem->body </div> </td> </tr>"; endforeach; Please, help me. Where is my error?