Jump to content

Wanze

PW-Moderators
  • Posts

    1,116
  • Joined

  • Last visited

  • Days Won

    10

Everything posted by Wanze

  1. Check out the settings of your Page field under the "Input" tab: Custom selector to find selectable pages This means, you can also exclude things, e.g. template!=admin, id!=1897, parent!=id_of_parent_of_children_that_are_not_selectable
  2. They're both doing the same. There are also other methods available: prepend(Inputfield $item) : Adds your Inputfield on the first position insertBefore(Inputfield $item, Inputfield $existingItem) : Add your Inputfield before the Inputfield $existingItem insertAfter(Inputfield $item, Inputfield $existingItem) : Add your Inputfield after the Inputfield $existingItem
  3. Hmm I also have multilang support enabled using two languages for the summary field (TextareaLanguage field). Works too! I grabed the dev version today - in case you're using an older dev. Ryan does lots of commits lately
  4. Hi jdiderik, I just tested with the latest dev here, summary field and autojoin set. My values got saved! Are you sure that saving other fields does work without problems? Any errors in the logs?
  5. Do you mean pages (children) which exist under "Admin"? Pages don't have a role assigned, but your users have. Not sure what you want to do exactly, could you explain in more detail? Thanks
  6. How did you migrate, what features are disabled? ;-) Maybe you have some corrupt files, try to reupload them. Also try to clear /site/assets/cache/ directory
  7. Why would you need method chaing for two modules? Of course you could do it, but why not: // in Template $myModule = $modules->get('myModule'); $myModule2 = $modules->get('myModule2'); // Call a public method of your module class $myModule->renderSomethingNice(); // You can load your module anywhere, for example in another module $myModule = $this->modules->get('myModule'); $myModule->renderSomethingNice(); The trick with method chainings is that you return back the instance ($this) of your current object, for example: class Test { public function method1() { // do something return $this; } public function method2() { // do something else return $this; } } // Now when using your class... $test = new Test(); $test->method1()->method2();
  8. jtborger, You misunderstand something, but I'm not sure what exactly The following code: foreach($page->field_page_reference as $t) does not return you all possible options, but the ones that are selected on the current $page Let's say you have two pages with the same template, each assigned a Page field to it which can hold multiple pages references. Page A: You select 30 Pages in the Admin Page B: You select 2 Pages in the Admin Then when doing the loop, you will iterate over the selected pages only.
  9. This should work: $myArray = $session->myArray; $myArray['one']['two'] = 'foo'; $session->myArray = $myArray;
  10. Hi Hieu Do, What you're worried about is one of the biggest strenght of Pw. Having each field in a separate table does scale very well - mySQL is very fast when Joining optimized tables, like Pw generates them. Plus you have the advantage that each field can store as much metadata as needed with different table structures. Also in Pw you can label your fields different in each template context, this is supporting you to reuse existing fields. For example: In your 'member' template, just give your title field the label 'Forename + Lastname' My suggestion is: Give Pw a try, it's faster than every CMS/CMF I used before. Additionally there is the template cache, markup cache and a module from ryan called ProCache which completely bypasses MySQL + PHP serving you html pages That's the default behaviour. Pw only joins and loads fields you access, unless defined as autoload. Not quite sure what you mean here. You can specify in which fields you want to search your keywords
  11. Hi marcin, Where do you output, in the frontend? Can you post your code that's not working? What Pw version? Cheers
  12. You can construct a TemplateFile object without a filename, but there will be a problem with the render method if you haven't set a filename: public function ___render() { if(!$this->filename || !is_file($this->filename)) return ''; You could hook after TemplateFile::render() and check for the return value. If it's empty, return your $page->body content.
  13. What PHP version is installed on your local machine and server?
  14. 1) Are your sure that the value 'portugal' is sent over get? So your URL is xxx?mysearchlocation=portugal 2) Some corrections to the code: // Do we have a get variable? if ($input->get->mysearchlocation) { // Sanitize it $mySearchLocation = $sanitizer->selectorValue($input->get->mysearchlocation); // This is not valid => $input->whitelist($test, $country); // Add it to the whitelist... with the same name as the get var! $input->whitelist('mysearchlocation', $mySearchLocation); // Do your search and render the pager.. i name the variable $resorts instead of $country $resorts = $pages->find("template=hotel, hotel_country=$mySearchLocation, limit=3"); $pagination = $resorts->renderPager(); foreach ($resorts as $resort) { // ... } } See also $input->whitelist() in the docs: http://processwire.com/api/variables/input/
  15. Can you post your whole code? form and rendering with pagination. I know it works because I did it several times this way, so there must be somewhere a problem in your code
  16. Simplest solution: Use GET To make it automagically work with the pager, you need to add the variable to Pw's whitelist. Pw does append your get variables to the paging. if ($input->get->mysearchlocation) { $county = $sanitizer->selectorValue($input->get->mysearchlocation); $input->whitelist('country', $country); // Do your search and render the pager }
  17. Hi lucas - welcome! Yes. Users are in fact pages with a template "User" assigned. You can add custom fields there just as on other templates Users can belong to multiple roles I think you need to be more specific here. In Pw, relationships between pages (Users) are done with the Page field type. Take a look at: http://modules.processwire.com/modules/shopping-cart/, don't know if this module helps. Maybe as a starting point Everything is possible, maybe with some custom coding. But the good news is, that in Pw coding is fun! Cheers
  18. Despite the warning, does everything work? Try clearing /site/assets/cache/ folder
  19. Why? Pageimages are a collection of Pageimage objects. And Pageimages extends Pagefiles extends WireArray, so the import() should work. But I haven't tested anything to be honest Yep. But if you look at ryans code, there's another Pagearray created for the Paging - not the array containing the images. But of course: Using ImagesManager is better, and loading all images to display only 30 is not very efficient. Though there's no other solution IMO if they need to be sorted date-based from different pages
  20. I think Soma's right. Instead of $allImages = new PageArray(); try $allImages = new Pageimages();
  21. Aren't you going throgh the loop? Or is it just the array that is empty? Another possible way to get your galleries: foreach ($pages->get('/albums/')->children() as $gal) { //.. }
  22. Wanze

    Hit 1000+ likes

    Did you just post this to gather 10 more likes?
×
×
  • Create New...