ashrai Posted December 13, 2012 Share Posted December 13, 2012 hey there, sorry for dumb questions ... but I am a total boon concerning php and cms developement. Just had some minor contact with contao and wordpress. Now I decided to learn how to use a cms and got stuck with processwire. I love the general idea of it. =) So ... I followed the "getting started" tutorial and I was impressed how fast my first editable text areas emerged "out of nowhere". Now I tried to place an editable/changeable image. And I have no clue how to do this. If I search this forum all I find are advanced solutions for sorting images and so on. Help. Sorry again - I'm at the very beginning. Link to comment Share on other sites More sharing options...
diogo Posted December 14, 2012 Share Posted December 14, 2012 Hi ashrai! Welcome to the forums! There is a tutorial about adding images here http://processwire.c...k-start/images/ (it's admittedly a bit hidden because it's considered "in progress") Make sure you understand the difference between single images fields (Maximum files allowed = 1, in the field options), and multiple images fields. On the first one $page->field returns an object, and on the former it returns an array. On the single image you return the url simply like this: echo $page->image_field->url; And on the multiple, you return the several urls like this: foreach($page->images_field as $image){ echo $image->url . "<br>"; // this will print one url per line } Well, all this is explained in that tutorial I linked to. 2 Link to comment Share on other sites More sharing options...
ashrai Posted December 14, 2012 Author Share Posted December 14, 2012 Hi diogo, this explains why I haven't found it! Thank you! I'll try this at once. //edit: Yes, that worked! Many thanks! I understood the syntax, too, I think. My only problem ist: Why do I need the "Class=Photo" Attribute as shown in the tutorial code? What does it do? I create an Instance of $image and I thought that this already is the php class I need to display/resize/etc. ... my image. Did I get something wrong? Link to comment Share on other sites More sharing options...
diogo Posted December 15, 2012 Share Posted December 15, 2012 You don't need it. This is there only for the example, you can use any class or id that you want or you don't have to use anything at all. The HTML part is completely up to you. 1 Link to comment Share on other sites More sharing options...
ashrai Posted December 15, 2012 Author Share Posted December 15, 2012 Ah I see, this is the CSS class. Thanks! 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