Jump to content

Soma

Moderators
  • Posts

    6,798
  • Joined

  • Last visited

  • Days Won

    158

Everything posted by Soma

  1. Why not just have a text input and enter '5.38" x 2.75" x 0.31"' ?
  2. If account_status is of single page select it won't have a add() method like PageArrays have. Multiple page select $new_page->$field->name->add(1023); // like $new_page->account_status->add(1023); // and also this (which seems to append db entry) guess makes sense? $new_page->account_status = 1023; Single page select $new_page->$field->name = 1023; // like $new_page->account_status = 1023; // but not $new_page->account_status->add(ID); // wrong So the page field can have different types based on the dereference settings multiple or single and behave slightly different. Single: it will only be a value of type page and page have no method add, multiple: will be a PageArray. PageArrays have the method add() to add pages, but also the field recognizes just ID's set to it, and it will save the entry and the others already saved or doublicates remain untouched. So to clear a multiple page field you have to call field->removeAll() first. You get this error because the value is most likely not an object (yet). If it dereferences as "single page or false if none selected (!)" .. so if the field is empty it will throw an error: Error: Call to a member function add() on a non-object If you would have already saved a value you would get this error instead, same code but different message because the field now has a page object set: Error: Exception: Method Page::add does not exist or is not callable in this context Hope this shares some light.
  3. I think this would translate to something like this only setting what would be non-default: $treeMenu = $modules->get("MarkupSimpleNavigation"); // load the module $options = array( 'has_children_class' => 'dropdown', 'max_levels' => 2, 'outer_tpl' => '<ul id="pcss3mm" class="pcss3mm">||</ul>', 'inner_tpl' => '<div class="grid-container3"><ul>||</ul></div>', 'item_tpl' => '<a href="{url}" title="{title}">{title}</a>', 'item_current_tpl' => '<a href="{url}" title="{title}" >{title}</a>' ); echo $treeMenu->render($options);
  4. $this->submodule = wire("modules")->get("submodule"); ..Call in init(). Use in template. $m $modules->get("mainmodule"); $m->submodule->subfunction(); --- or creating a template var $this->fuel->set("submodule", wire("modules")->get("submodule")); ..call in init(). Use in template: $submodule->subfunction();
  5. I dont understand what you dont get. You can sort the item with drag and drop on a page. See the picture above in this thread. See the icon on each item on the left?
  6. You can already sort the repeater items manually with drag and drop.
  7. RT @jessicahische: In my opinion, a generation line should be drawn based on “have you ever waited hours to record a song from the radio on…

  8. Soma

    Anybody here playing Go?

    11-12k is quite good if you just played occasionally. Let me tell you that playing computer isn't that good to get stronger. A human opponent will always play very different. Playing computer the whole time can screw your game, especially when you're weaker player. There's a lot a computer can't really calculate, the variation are just too vast and the strategies/judging involved requires different thinking, and you kinda adapt to the playing style of a computer which kinda handicap you from getting "mastering" the game on all levels. There's currently a new area of computer programs that play go in a different way which involves playing random stones etc. but they're still way behind beating some of the stronger players Go has brought up. Also doing tsumegos is way better than playing computer. It's solving local problems of life and death at different strengths. This will help you getting stronger at local fights a lot. And they're fun.
  9. Soma

    Anybody here playing Go?

    Hey nik, thanks for dropping by. Rank doesn't matter, I'm playing for fun and it's one of the great things of this game to be able to give handicap to balance the strength. I'm currently entering holidays and will have some spare time to play, just drop me message so we can arrange something.
  10. Dear Mr.MetaData It's not that simple? Well I guess you already know that the type of calculation you try to do is "impossible". After all I don't really care. I'm sure there's some formula which would consider different aspects, but none of them will be speaking something different than what already is seen. Those calculations are complicated and lead to results you'd have to put some bias/weight into it and it will never be "correct" considering you can't put all factors into account. To make it short, not worth the effort. What I would recommend is doing different list, you can sort by count of likes, post, ratio.. and everybody can read what he likes out of it.
  11. Yeah and post frequency over time.
  12. Soma

    Anybody here playing Go?

    Hey Matthew, great to know you also play Go! I haven't played for some time but would be great to have a few games. I'm on IGS http://pandanet-igs.com/communities/pandanet as iSoma (6-7k). Yeah it's hard to find players but chances are that there's a Go club near, at least here in Europe. But there's also the chance to play online and it has an active community around.
  13. Add a title "Archive" and output all articles minus the newest.
  14. r = $likes / $posts and call it a day or make some sudoku () Or very much better play some Go ! (can't believe nobody here plays)
  15. class FieldtypeFieldsetOpen extends Fieldtype { /** * Appended to the name of a 'Close' version of a FieldsetOpen * */ const fieldsetCloseIdentifier = '_END'; It's just a constant string to suffix the fieldsetclose name so the admin knows what fieldset to close.
  16. Aah, so you want to use them for templates in the admin? How about: $opener = new Field(); $opener->type = new FieldtypeFieldsetOpen(); $opener->name = "myfieldset"; $opener->label = "Open fieldset"; $opener->save(); $closer = new Field(); $closer->type = new FieldtypeFieldsetClose(); $closer->name = "myfieldset" . FieldtypeFieldsetOpen::fieldsetCloseIdentifier; $closer->label = "Close an open fieldset"; $closer->save(); $tpl = $templates->get("custom"); $tpl->fieldgroup->add($opener); $tpl->fieldgroup->add($fields->get("body")); $tpl->fieldgroup->add($fields->get("counter")); $tpl->fieldgroup->add($closer); $tpl->fieldgroup->save();
  17. There's nothing special about it you just use InputfieldFieldset and append the inputfields you want in there. Then create a new fieldset and add the fields you want there. Then add the two fieldsets to the inputfieldwrapper.
  18. ModulesManager doesn't have tabs. Well I guess you already know you use getModuleConfigInputfields(array $data){ ... } to add configuration inputfields (not fields!) And you need to add the ConfigurableModule to the implements list (implements Module, ConfigurableModule). Now you can create a new InputfieldWrapper and add Inputfields to it. static public function getModuleConfigInputfields(array $data) { // if you have a static $defaults array for defaults you can merge them with saved ones in $data $data = array_merge(self::$defaults, $data); $fields = new InputfieldWrapper(); ... return $fields; } From there it's pretty easy. You can use all inputfield modules for inputs. It's much like creating a front-end form using API. Know my famous thread? Those inputfields are not bound to the fieldtype, like when used in the admin on pages. So the InputfieldSelect is a simple select module you can fill in options as you like. They're also used in FormBuilder. Ryan has even adapted some a little to support pure interactive inputs better. When used on a page (fields) they're actually a mix of the fieldtype and the inputfield and they depend on each other. Fieldtypes are more used to sanitize and save to db, wakup or sleep values etc, while inputfields kinda serve as an plain interface seen by the user, thus having a render() method. Some special Inputfields are more bound to functionality of other modules like "process" modules, but only remember InputfieldPageListSelect. From there it's just generaly PW API coding. So this would look like this to add a multiple ASM select static public function getModuleConfigInputfields(array $data) { $data = array_merge(self::$defaults, $data); $fieldwrapper = new InputfieldWrapper(); $modules = wire("modules"); $field = $modules->get('InputfieldAsmSelect'); $field->attr('name', 'mymodules'); $field->attr('value', $data['mymodules']); $field->label = 'Select modules.'; foreach($modules as $m) { // loop all installed modules if(strpos("$m->name","Process") === 0) $field->addOption("$m", "$m->className"); } $fieldwrapper->append($field); return $fieldwrapper; }
  19. It would be a BIG security issue if you could. Nothing strange here, as in all programming languages... But then I also dont see the benfit of doing this. You could with eval() though but not recommended. You could just echo the url there into the string in the first place and pass that after to template.
  20. Ah took me half hour to see whats up. Yeah you cant put php in a string like that and give it to a template to render and think the php gets parsed.
  21. Try adding curley bracket to the code in question. <?={....}?> If it's more than just a var.
  22. The more simpler and direct way for a custom select would be: $sel = $modules->get("InputfieldSelect"); $sel->attr("name", "cms"); $sel->addOptions(array( 'pw' => 'ProcessWire', 'joomla' => 'Joomla!', 'wp' => 'Wordpress' )); // setting the value will select the option, here with coming either from post or the default $sel->attr("value", $input->post->cms ? $input->post->cms : 'pw'); echo $sel->render();
  23. My bet would be that you changed the page field settings from multiple to single and vis versa... however this can give unexpected results as it doesn't remove values already saved values when switched from a multiple to a single. So be careful. As for when using a page field single select, you already have the page object and not a page array. So the selected page would be simply the field itself. echo $page->channel->title // title of selected page A method to check for select page seems redundant and not necessary, as with multiple (page array) you already have has(). I don't see any benefit to add isSelected().
  24. Split the words and search separate with %.
×
×
  • Create New...