Jump to content

Soma

Moderators
  • Posts

    6,798
  • Joined

  • Last visited

  • Days Won

    158

Everything posted by Soma

  1. Spaces in passwords take up empty space. That consumes more energy on yor minotor. FREE poasswords now.
  2. I'm not sure. With your code making it an Inputfield I get a different result: <?php class InputfieldMine extends Inputfield { public static function getModuleInfo(){ return array( "title" => "Inputfield Mine", ); } public function __construct() { parent::__construct(); $this->set('minLength', 6); wire('log')->save('trace', "__construct $this->minLength"); } public function init() { // other stuff $ml = $this->minLength; wire('log')->save('trace', "init $ml"); } public function ___render() { $ml = $this->minLength; wire('log')->save('trace', "___render $ml"); } } and // get a my field wire('log')->save('trace', 'B4 LOAD'); $field = wire('modules')->get("InputfieldMine"); wire('log')->save('trace', "AFTER LOAD $field->minLength"); // ellided setting of attributes and properties $field->minLength = 6; wire('log')->save('trace', "AFTER SET $field->minLength"); $form->add($field); My log is: B4 LOAD __construct 6 init 6 AFTER LOAD 6 AFTER SET 6 ___render 6
  3. Chances are high that if you find a more real bug, that broke something, it's often on Ryan's prio list and usually a matter of hours or 1 day to fix it. If it's something more complicated it can take longer but then it may was even in master undiscovered since some time. Also as other have mentioned dev is pretty darn stable, just make sure to report a bug if found. It's fun It's going on so fast, now 2.5.3 feels like an old hat. Go with the flow. http://processwire.com/blog/
  4. One more you can also get a field and get its parent InputfieldWrapper: $lastname = $modules->InputfieldText; $lastname->attr("name","lastname"); $lastname->label = "Lastname"; $firstnamefield = $form->get("firstname"); $fieldset = $firstnamefield->parent; $fieldset->insertAfter($lastname, $firstnamefield);
  5. My experience is that once you get advanced, it can happen that you discover all the new bugs a dev brings. So not always recommended to run latest dev with a project you go live very soon. But sometimes you have to, to get a bugfix from a earlier dev version. Just my experience. Edit: To be fair. There can be bugs in both versions. But if you using dev I recommend you follow the commits, and see if an update is of benefit or not. I also sometimes wait 1-2weeks before updating, when there used to be bugs that were introduced in a previous commit.
  6. I don't see through your code and don't understand the why and what and how the form is built. Does your fieldset have a "name" attribute? It needs one, as the InputfieldWrapper::get() search for "name" key.... Just to mention you can also use find() to search by id: $fieldset = $form->find("id=myfieldset2")->first(); here the same with nested fieldsets, still works fine: $form = $modules->InputfieldForm; $form->action = "./"; $form->method = "post"; $fs = $modules->InputfieldFieldset; $fs->attr("id+name", "myfieldset"); $fs->label = "My Fieldset"; $fs2 = $modules->InputfieldFieldset; $fs2->attr("id+name", "myfieldset2"); $fs2->label = "My Fieldset2"; $field = $modules->InputfieldEmail; $field->attr("name","email"); $field->label = "Email"; $fs2->add($field); $field = $modules->InputfieldText; $field->attr("name","firstname"); $field->label = "Firstname"; $fs2->add($field); $fs->add($fs2); $form->add($fs); $lastname = $modules->InputfieldText; $lastname->attr("name","lastname"); $lastname->label = "Lastname"; $fieldset = $form->get("myfieldset2"); $firstnamefield = $fieldset->get("firstname"); $fieldset->insertBefore($lastname, $firstnamefield); $content .= $form->render(); First works cause it's correct, second isn't. You field $someotherfield isn't child of InputfieldWrapper $form. But it is a child of InputfieldWrapper $fieldset1.
  7. This works fine for me. $form = $modules->InputfieldForm; $form->action = "./"; $form->method = "post"; $fs = $modules->InputfieldFieldset; $fs->attr("id+name", "myfieldset"); $fs->label = "My Fieldset"; $field = $modules->InputfieldEmail; $field->attr("name","email"); $field->label = "Email"; $fs->add($field); $field = $modules->InputfieldText; $field->attr("name","firstname"); $field->label = "Firstname"; $fs->add($field); $form->add($fs); // insert later $lastname = $modules->InputfieldText; $lastname->attr("name","lastname"); $lastname->label = "Lastname"; $fieldset = $form->get("myfieldset"); $firstnamefield = $fieldset->get("firstname"); $fieldset->insertBefore($lastname, $firstnamefield); $content .= $form->render();
  8. Not sure since I can't see your code. If there's no navigation generated it returns an empty string. Or you can do a find/children manually to see if there would be any pages.
  9. This helper render method on PageArray's is usually meant for a convenient tool when developing like scaffolding (although you can't CRUD). Although it is there to use if you want, I also always use the renderPager() method. If you want to output a summary but haven't got a summary field $page->summary. Since you can't modify the module, one could add the property to page object via property hook. Which means to add a property on runtime. You can see an example in the HelloWorld.module. Something like this will give you a $page->summary $pa = $pages->find("template=basic-page, limit=4"); wire()->addHookProperty("Page::summary", null, function($event){ $page = $event->object; $event->return = $page->headline; // return something for "summary" }); $content .= $pa->render(array('itemMarkup'=>"\n\t<li><a href='{url}'>{title}<br><small>{summary}</small></a></li>")); But what's wrong with creating your own foreach? $pa = $pages->find("template=basic-page, limit=4"); if($pa->count) { $list = ""; foreach($pa as $p){ $summary = limitWords($page->body); // your function to limit words maybe $list .= "<li><a href='{$page->url}'>{$page->title}<br><small>{$summary}</small></a></li>"; } $content .= "<ul>$list</ul>"; $content .= $pa->renderPager(); } else { $content .= "Nothing found"; }
  10. I USED the saveXML() in ImagesManager parser.
  11. Should work like this $field->addOption(value, label, attributes); $field->addOption(123, "Produkt1", array("disabled" => "disabled"));
  12. YOu might consider using the new formatValue(page, field, value) method in textformatters? https://github.com/ryancramerdesign/ProcessWire/blob/dev/wire/core/Textformatter.php#L62 I had some strange things with DOMDocument in the past with encoding and I hate it cause a saveHtml() does return the a modified html structure with adding a <html> etc.
  13. Soma

    Regexp Help!

    A friend showed me this https://regex101.com
  14. Maybe have a good read on the module itself? https://github.com/ryancramerdesign/ProcessWire/blob/master/wire/modules/Markup/MarkupPageArray.module
  15. Just add .xml to the name ans disable trailing slashes.
  16. In new PW dev the croppable image has broken layout when uploading image. After saving the layout seems ok. The new image edit function isn't there as there seems to be some rewrite of markup. Could this be possible to have it working together?
  17. You add a "permission" to the getModuleInfo array with the permission the user/role needs to have to see the admin page.
  18. Last that I did at that time/day was install procache. Then I had troubles with Revive (AD tool) that we include in front-end banner scripts. It is setting UTC timezone due to a bug. So after that I did add script to set correct timezone after those scripts and it was working again. It's nothing that would be in backend only front-end scripts. But due to that procache wasn't porperly working and deleting cache all the time. At that time I think the issue popped up. There were no major changes other than procache. The update to latest PW was before that day and I did a update today. So far I can't reproduce it anymore. I change it back to as it was and it's working. When the error appeared I did refresh, delete all caches (db, files) but no luck until I changed the module and removed the "requires". Never experienced something like it. APC php cache is active on that server.
  19. I have no idea why but when I comments out 'requires' => 'ProcessLoginHistory' in ProcessLoginHistoryHooks.module it suddenly works again. And the module is again listed in admin too. I add this line and it disappears ProcessLoginHistory.module isn't autoload module, that's the only clue I can guess.
  20. After looking a little closer, the table name isn't set, so finally it looks like the module ProcessLoginHistoryHooks isn't installed/loaded although it's there, just not listed in the modules. Module refresh does not help. Strange, according to the entries in the table the last login was friday evening, when it suddenly stopped recording. I have no idea what's going on but heard others had problems with modules suddenly disapearing. :/
  21. I have this installed on a project and was working fine until I wanted to open it up today and bamm TemplateFile: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ORDER BY username DESC' at line 4 SELECT DISTINCT username FROM ORDER BY username DESC<pre>#0 [internal function]: Database->query('SELECT DISTINCT...') #1 /home/www-data/*/wire/core/DatabaseMysqli.php(35): call_user_func_array(Array, Array) #2 /home/www-data/*/site/modules/ProcessLoginHistory/ProcessLoginHistory.module(492): DatabaseMysqli->__call('query', Array) #3 /home/www-data/*/site/modules/ProcessLoginHistory/ProcessLoginHistory.module(492): DatabaseMysqli->query('SELECT DISTINCT...') #4 /home/www-data/*/site/modules/ProcessLoginHistory/ProcessLoginHistory.module(159): ProcessLoginHistory->renderFilters() #5 [internal function]: ProcessLoginHistory->___execute() #6 /home/www-data/*/wire/core/Wire.php(365): call_user_func_array(Array, Array) #7 /home/www-data/*/wire/core/Wire.php(320): Wire->runHooks('execute', Array) #8 /home/www-data/*/wire/core/ProcessController.php(213): Wire->__call('execute', Array) #9 /home/www-data/*/wire/core/ProcessController.php(213): ProcessLoginHistory->execute() #10 [internal function]: ProcessController->___execute() #11 ... This is on latest PW dev. There were no relevant changes as far as I can tell.
  22. The first question would be why you need Id as the name and not how to do it blindly. Most of th time theres a specific reason for such questions and without knowing more one can't help competently. It might be a complete wrong approach to something cause of lack of experience
  23. The thing here is to get the previous status the page had before saving.
  24. Just set $page->name manually when creating a page.
×
×
  • Create New...