Jump to content

Wanze

PW-Moderators
  • Posts

    1,116
  • Joined

  • Last visited

  • Days Won

    10

Everything posted by Wanze

  1. Yo Willy, Can you also write a book how to grow and style a beard like yours?
  2. Hi bytesource, 1) This won't work because the getThumb method is added dynamically with a hook. Most likely 'method_exists' will look for static methods in classes, that's because false is returned. 2) After taking a short look at the description of the module, this could work: if ($imageField->type == 'FieldtypeCropImage') { //... Thumbnails }
  3. Hi roelof, Don't delete the .htaccess, it's needed by Pw. First thing you could try is to mark those two lines as comments (add '#'): #Options -Indexes #Options +FollowSymLinks
  4. Hi roelof, Before you start you should also install ProcessWire and do some stuff with it, e.g. try things out: Create some templates / pages. Try to understand how selectors work. Then you can easily answer the questions yourself. Nevertheless, try to give you some guidance: 1) In home template: $articleBody = $pages->get(ID_FROM_ARTICLE)->body; 2) Not sure here, normaly one page = one article, so assign a body field to the template of that page? 3) Add an 'image Field' to the template. Images uploaded to a page can then also be inserted into richtext. 4) I'd export them from the old database and create a csv file. Then you can use this module from ryan to import them into Pw. Cheers
  5. Just build a select form with your section pages in it and send the page id over GET: <select name="section"> <?php foreach($pages->find('template=section') as $s) { echo "<option value='{$s->id}'>{$s->title}</option>"; } ?> </select> Then in the template where you display the events, check if the user has chosen a category if ($input->get->section) { $section = (int) $input->get->section; // Add this to your selector string $selector .= ", section={$section}"; // To make the pagination work, add the section get variable to the whitelist $input->whitelist('section', $section); }
  6. Well, the easiest solution would probably still be to assign an images field to your template(s) and import the image from the other system. Then and the images are stored in /site/assets/ - which is the Pw way If you can't do it this way, check out the ImageSizer class in /wire/core/.
  7. Allrighty, then I'd go with diogos solution, though maybe soma or another pro comes up with a better idea $itemsWithSpeaker = $pages->find("template=talk|video,limit=10,categories={$page->categories},speaker.count>0,sort=speaker,sort=title"); if (count($itemsWithSpeaker) < 10) { $limit = 10 - count($itemsWithSpeaker); $itemsWithoutSpeaker = $pages->find("template=talk|video,limit={$limit},categories={$page->categories},speaker.count=0,sort=title"); $itemsWithSpeaker->import($itemsWithoutSpeaker); }
  8. Hi pogidude, Have you tried to reverse the sorting of speaker? sort=-speaker
  9. I'm lost without CC... Edit: And why is the crying-smiley not working?
  10. Where do you want to add the page? If you want to add them under a parent with template 'company', you still need to check "add Children" in the templates Access options. Also make sure that you don't have any template family restrictions in the parents template.
  11. HI Bergwiesel, welcome to Pw. Funny nickname btw Make sure your /site/assets/ directory is writeable.
  12. I agree with you diogo. Depends on the situation I guess. However, you have lot of features 'out of the box' when using the built in users and permission system. For example: $session->login() $session->logout() $user->isLoggedIn() $user->hasRole() $user->hasPermission() ... The users page can be replaced with a ProcessModule, if I remember correctly Antii has done something which provides a better overview with some filters. There are security restrictions in listing users, but you can still use 'check_access=0' in your selector for finding the users.
  13. Hi valan, I see your point but I still think fields are the way to go. There are for certain some fields that are more often used, so you could group them together. Don't worry about the cars that do just hold a bunch of attributes, Pw scales well. You have more overhead with repeaters, because each repeater item is stored as page in ProcessWire. So with a car that has 50 attributes as repeater-items, you end up with 51 pages (1 car page + 50 repeater pages). You don't need to write 50+ lines of code, you can also loop through the fields of a page: foreach ($page->fields as $f) { // Maybe check for the value based on the type of field (select, page)... // if ($f->type == 'FieldtypeXY) ... $value = $page->get($f->name); if ($value) { echo $f->label . ' has value: ' . $value; } }
  14. Well, the error clearly states that you don't have an image in one of your pages. The additional if will fix the error. I don't think this has something to do with your harddisk, but maybe an image was not copied over or got corrupt? You could check the pages and make sure all the images are still ok.
  15. Hi valan, Why not making your attributes fields of the car template? Then the editor just fills out the ones needed for the actual car. model, length, number of seats, color etc. - they all hold a single value. For attributes that can hold multiple values, you can still use repeaters. This also solves the 'select' questions, if I didn't misunderstand your question. To make life easier for the editor, I'd probably group the fields with InputfFieldSetTabs.
  16. You can set this when creating the new db. It's most likely 'utf8_general_ci'... Also make sure that $config->userAuthSalt in /site/config.php has the same value as on your server. But you're probably downloading your Pw files from the ftp anyway, so this won't be a problem.
  17. I don't see any reason to built your own users... rather use Pw users and assign them a different role + don't give them page-edit rights. You can add as many custom fields to the user template as you want. For the profile, you could just use a 'profile' template and display a form with all your fields from the user template. For adding users in the backend, you could do a simple Process module if you don't want to give your client access to add/edit users.
  18. Awesome! How could I miss this in the Cheatsheet... again learned something new, thanks!
  19. @Soma nice. The problem may be if we want to match 10 IDs like this and let's say one of them is in the array, ->has would return true? Because '|' denotes an OR operator. So if you want to know exactly which ID is in there, the loop is necessary. Maybe I'm wrong
  20. Hi marcin, I think there's nothing wrong with looping through the array and check with $p->has('id=X'). No more elegant way popping in my mind right now
  21. What is the purpose of doing this? It should work, but depends where in the template you call this snippet.
  22. You have to make sure that there are images. If you get a page with no images, the error is throwed because ->first() does not return a Pageimage object. So: // Alternative way I prefer to check for not having a Nullpage if ($p->id) { if (count($p->images)) { //.. generate thumb } }
  23. Are your sure that the field is named 'images'? Also if you have set 'Maximum files allowed' to 1, then the code needs little modification: // With max files set to '1' $img = $pages->get('parent=1010, images.count>0, sort=random')->images; // Check if we have an image if ($img->id) { echo "<img src='{$img->url}' alt='{$img->description}'>"; } else { echo "No page with image found..."; }
  24. You're overwriting the $user variable here: $user = $sanitizer->username($input->post->username); Use a different name, e.g. $u Btw happens to me too sometimes with $page or $pages
  25. Hi michael, Something like this should work (assuming your image field is called 'images'): $img = $pages->get('parent=1010, images.count>0, sort=random')->images->getRandom(); echo "<img src='{$img->url}' alt='{$img->description}'>";
×
×
  • Create New...