Jump to content

webdecker

Members
  • Posts

    9
  • Joined

  • Last visited

Contact Methods

  • Website URL
    https://www.webdecker.de

Profile Information

  • Gender
    Male
  • Location
    Berlin. Germany
  • Interests
    programming, cartoons, writing

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

webdecker's Achievements

Newbie

Newbie (2/6)

14

Reputation

  1. Well... pretty much... 😉 Some spontaneous remarks: 1. Did you try php method header()? 2. For readonly fields maybe create a disabled field ($field->attr('disabled'), but some browsers may not send data for it, so ensure an initial value). It should be possible to create and add a select field where you collect all templates and create an option for it. 3. Does the template you try to create a page with contain a file field or is your custom field a file field? Maybe the error message according to "localPath" refers to the page id's path in directory "assets/files" which does not exist unless you save a page (the first time). So maybe you should save your new page and then add / set other things which would rely on a path in "assets/files". 4. In modules I use... $this->error("Error message", \ProcessWire\Notice::log); $this->message("Message", \ProcessWire\Notice::log); 5. Do you mean how to create a multi language site where editors enter wysiwyig text or other fields in different languages? Well, that's a big topic for itself... Like / see https://processwire.com/docs/multi-language-support/multi-language-urls/ 6. Maybe you should post the code of your module so one can see how it all works together... e.g. when and how your hooks are really integrated. 6./7. In your method addOurHooks() you call $this->addHook() without telling when to apply the hook (before or after). The default is "after". Maybe the Inputfield::processInput would also provide an entry point to manipulate input (field).
  2. Similar to what @wbmnfktr and @poljpocket said before, I like PW so much because it is an API with a backend, the api is well documented (!), it is so easy to install, easy to update, easy to understand, easy to extend and customize, it can be installed anywhere, it is so direct, I can program simple php templates to output what I want the way I want. I could build simple websites and more complex web applications on my own without the need of experts of this and that technique or paradigm. That's cool! Please keep it simple, keep it that way and don't overload the core with too many features... ?
  3. What about the examples on https://processwire.com/api/ref/page/delete/? Due to processwire's database structure it seems almost impossible to delete records directly in the database... ? I would do such things in a template file. You asked "via the console" - yet I don't no such way, but I'm curious, how could such a way look like?
  4. If your "$terms = ..." code is really the first line in a .module file and not within a class method, then I would expect, that it won't work. It would be executed when the .module php file is loaded and I guess at this very early moment the whole machinery is not yet ready. Have you tried to write this line in a module's init() or ready() method or in ready.php?
  5. If I got it right, you are looking for pages having a (page)file (in field "file_field") named like something? Do you mean something like this...? $fieldname = 'file'; // or 'file_field' for your case...? $search = 'partofthename'; // V1 via api... $pgs = $pages->find("{$fieldname}%={$search}"); foreach ($pgs as $p) { echo "{$p->id} {$p->title}<br>\n"; } // V2 via database and api... $pgids = array_column( $this->database->query("select `pages_id` from `field_{$fieldname}` where `data` like '%" . addslashes($search) . "%'")->fetchAll(PDO::FETCH_OBJ), "pages_id" ); $pgs = $pages->find("id=" . ($pgids ? implode("|", $pgids) : "0")); foreach ($pgs as $p) { echo "{$p->id} {$p->title}<br>\n"; }
  6. @theo: I just installed it and made a quick test. Great!
  7. Sorry, too fast... My statement only works for labels and description, not for options, because InputfieldRadios for exmaple always sets $label = $this->entityEncode($label, Inputfield::textFormatBasic); - ignoring the field's textFormat setting ... ? So for options the above mentioned hook hack seems to be the way...
  8. Hi, I don't know FormBuilder yet, but if I prepare a form like this... $form = $modules->get("InputfieldForm"); //... $field = $modules->get("InputfieldText"); $field->label = 'Multi<br>line<br>label'; $field->description = 'Multi<br>line<br><span style="color:red;">description</span>'; $field->attr('id+name','testfield'); $form->append($field); //... ... to be able to pass HTML code to labels and descriptions of form fields I can set ... $field->entityEncodeLabel = Inputfield::textFormatMarkdown; $field->entityEncodeText = Inputfield::textFormatMarkdown; $field->textFormat = Inputfield::textFormatMarkdown; (ProcessWire 3.0.165, don't know whether it also applies for earlier versions...) This can probably be used in the hook mentioned before, too. Unfortunately a <p> tag is rendered around such a label, but I add to my CSS ... label p { display: inline-block; margin: 0; padding: 0; } ... and then it's ok.
×
×
  • Create New...