Jump to content

peterfoeng

Members
  • Posts

    95
  • Joined

  • Last visited

Posts posted by peterfoeng

  1. Hi Rodwyn,

    Welcome to PW forum :) Hopefully the example below help you out:

    Deleting
    $page->of(false);
    $itemToRemove = $page->Body_Repeater->eq(0);
    $page->Body_Repeater->remove($itemToRemove);
    $page->save();
    Editing
    $itemToEdit = $page->Body_Repeater->eq(0);
    $itemToEdit->of(false);
    $itemToEdit->body = "My new content";
    $itemToEdit->save();

    Things you need to remember with Repeater is that Repeater Item is an actual page in processwire but being hidden in the tree and obviously Repeater field is an array of pages (wirearray). For documentation please refer to this page: https://processwire.com/api/arrays/

    Hope this helps :)

    • Like 4
  2. Hi Soma,

    I am using the latest modulemanager (2.1.2) and the latest processwire build, but for some weird reasons the module only list 10 modules available. I have increased the limit to 100 but no go. Any ideas?

  3. I am playing around with this module but correct me if I am wrong, it seems that new images are always being generated everytime I see the page?
     
    I download the latest module from Github but I think something is not right when it is being used with something like:
     
    thumbnail,250,0
    medium,550,0
     
    the execution takes forever and everytime the page is being loaded, every images is being cropped all over again which I believe it should not.

    ---------
     

    UPDATE: I am submitting a pull-request for the issue I am having :) Please kindly review this PR here: https://github.com/apeisa/Thumbnails/pull/22/files

  4. Hi,

     

    First I will like to say my thanks for the module as I am using it in my solution. I needed to crop images based on their width only in some cases, I read the thread and there was a discussion of implementing it, not sure what was the conclusion but looking at code shows me that it is not implemented.

     

    As I understand that ImageSizer's resize function can work without providing a height (or providing 0) and in this case it only considers width. Isn't it logical we remove the height condition from condition as follow,

     

    ($this->w < 1) {

    throw new WireException(sprintf($this->_("Width not found for thumb: %s"), $thumb));
    return;
    }
    and if height is 0, then $sizer->resize($this->w, $this->h) will just work fine based on width.
     
    I have tested and it works fine but before I deploy it on production I need an opinion?

    Thanks

    Haven't tested it yet but will a great addition! Thanks much

  5. Hi GuruMeditation,

    Regarding the profile scenario above, I am pretty sure profields will make it easier and save you time. I recently move across my billing & shilpping information from invidual fields to profields textarea which I believe should have saved me time and will be easier to maintain over the long run. Cheers 

    • Like 1
  6. Hi everyone,

    I try to test this module and it seems it does not work when I try the examples in the service-pages page that comes with this module. I have made sure that the template field is included in the config but it comes up with this error: Error: Template 'basic-page' is not allowed in queries

    Not quiet sure what settings I did miss here. Here is the screenshot:

    zBbexhl.png

    Appreciate any help to solve this issue :) Cheers

  7. Hi,

    I am wondering if we can also we move the fields on the template (global field) to the settings tab. I am having a bit of issue understanding of what needs to be done.

    
    	/**
    	 * Initialize the module
    	 *
    	 * ProcessWire calls this when the module is loaded. For 'autoload' modules, this will be called
    	 * when ProcessWire's API is ready. As a result, this is a good place to attach hooks. 
    	 *
    	 */
    	public function init() {
    		// add a 'hello' method to every page that returns "Hello World"
    		$this->addHookAfter('ProcessPageEdit::buildFormSettings', $this, 'example');
    	}
    
      public function example($event) {
    
        $page = $event->object->getPage();
        $form = $event->arguments("form");
    
        echo $page->template;
        print_r($form);
        $wrapper = $event->return;
        $templateField = $wrapper->get('template');
    
        $myField = wire('modules')->get('InputfieldText');
        $myField->attr('name', 'hello');
        $myField->label = "Hello there";
        //$wrapper->insertAfter($page->get('title'), $templateField);
        $event->return = $wrapper;
      }
    

    Can this be done? I wonder :( Thanks

×
×
  • Create New...