-
Posts
6,808 -
Joined
-
Last visited
-
Days Won
159
Everything posted by Soma
-
RT @owzim: Woohoo, @processwire featured in big German computer magazine @ctmagazin http://t.co/gYVeEiXtbh #cms #webdev
-
mechanism to initialize Inputfield configuration at construction or init time?
Soma replied to bmacnaughton's topic in FAQs
I'm not sure I understand what the problem with first method is. Are you speaking about your Inputfield's default (in module) ? Look at InputfieldText how it set defaults public function __construct() { parent::__construct(); $this->setAttribute('type', 'text'); $this->setAttribute('size', 0); $this->setAttribute('maxlength', self::defaultMaxlength); $this->setAttribute('placeholder', ''); $this->setAttribute('pattern', ''); $this->set('initValue', ''); // optional initial value $this->set('stripTags', false); // strip tags from input? } -
You know what? It doesn't matter. We all been there and even seasoned programmers sometimes tap into it. Our mind is ignoring things, otherwise we would go crazy
- 8 replies
-
- 3
-
-
- module
- initialization
-
(and 1 more)
Tagged with:
-
Any way to make urls end in .html, .xml, etc?
Soma replied to creativejay's topic in General Support
I can't reproduce this. I have basic-page without trailing slash and a page field to select pages. The url of those don't have a trailing slash. -
It is possible to hook into hooks.
-
Got to Modules->Refresh.
-
How is your setup? Looks like there's maybe this issue with newline in the config textarea for domain If you change $this->subdomainsArray = explode("\r\n", strtolower($this->subdomains)); To $this->subdomainsArray = explode("\n", strtolower($this->subdomains)); Does it work? This is the code that should do a redirect when a real url containing the domain is found. https://github.com/somatonic/Multisite/blob/master/Multisite.module#L120 But even then even if the redirect isn't working the page should still show fine. Nothing there in the module that would do a 404. The 404 seems to be an issue that the domain isn't found. But that wouldn't come from updating PW after all.
-
Well the obvious would be that it's minlength and not minLength.
- 8 replies
-
- 1
-
-
- module
- initialization
-
(and 1 more)
Tagged with:
-
When I change it to extend InputfieldText it's the same result. B4 LOAD __construct init 6 AFTER LOAD 6 AFTER SET 6 ___render 6 Have you refreshed modules? What PW Version? It doesn't show up under fields since it's a Inputfield with no Fieldtype. Fields are Fieldtypes that can have one or multiple Inputfields for their "input".
- 8 replies
-
- module
- initialization
-
(and 1 more)
Tagged with:
-
Spaces in passwords take up empty space. That consumes more energy on yor minotor. FREE poasswords now.
-
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
- 8 replies
-
- module
- initialization
-
(and 1 more)
Tagged with:
-
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/
-
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);
-
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.
-
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.
-
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();
-
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.
-
how to styling of the output content of pagnation
Soma replied to adrianmak's topic in General Support
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"; } -
I USED the saveXML() in ImagesManager parser.
-
Should work like this $field->addOption(value, label, attributes); $field->addOption(123, "Produkt1", array("disabled" => "disabled"));
-
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.
-
A friend showed me this https://regex101.com
-
how to styling of the output content of pagnation
Soma replied to adrianmak's topic in General Support
Maybe have a good read on the module itself? https://github.com/ryancramerdesign/ProcessWire/blob/master/wire/modules/Markup/MarkupPageArray.module -
Any way to make urls end in .html, .xml, etc?
Soma replied to creativejay's topic in General Support
Just add .xml to the name ans disable trailing slashes.