fbg13

Members
  • Content count

    178
  • Joined

  • Last visited

Community Reputation

165 Excellent

About fbg13

Recent Profile Visitors

463 profile views
  1. Module

    Does it remember the widths on a refresh or on a new session?
  2. Had this written before Macrura's post so I'll leave it here. $x = 0; foreach($recipes as $recipe){ $class = "class"; $imageSrc = $recipe->image->first()->size(200,200)->url; if($x == 1){ $class = "otherClass"; $imageSrc = $recipe->image->first()->size(500,200)->url; } echo "<div class='{$class}'><img src='{$imageSrc}'></div>"; $x++; } You can also use css :nth-child pseudo class
  3. There are some threads regarding this subject, but i just can't find them anymore. Can someone help me out?
  4. Seems to be caused by the divider, hiding them fixes the problem.
  5. Thank you @kixe I managed to achieve what I need. Any idea what the key (pw300/pw200) is doing? For whoever is interested. In my module I added public function init() { wire()->addHookBefore("ProcessModule::execute", $this, "changeModuleService"); } public function changeModuleService(HookEvent $event) { if($_GET["update"] === "ModuleName") { wire("config")->moduleServiceURL = "http://domain.tld/"; wire("config")->moduleServiceKey = (__NAMESPACE__ ? "pw300" : "pw280"); } } And the module autoload property is set to "autoload" => "path=/admin/module/" Now whenever the "check for updates" link is clicked it searches for a new version on domain.tld/ModuleName, this has to return a json similar to the one posted above.
  6. @kixe Won't changing those options affect other modules from the directory?
  7. I mean going to the module page and clicking the check for updates link and having a download and update button if there's a new version. https://gfycat.com/DiligentRichAlaskanmalamute
  8. Is it possible to update a module without it being in the module directory? The same way that one in the module directory is.
  9. You can always change the password through the api <?php $u = $pages->get(...); $u->of(false); $u->pass = "..."; $u->save(); Also we are off topic here.
  10. @modifiedcontent Works the same as everywhere else, you have a form, form gets submitted, you process it (do what you need with the values submitted). I showed you how to save the values in a page, the same way you can create a user. <?php // $input->post->username same as $_POST["username"] if($input->post->submit) { $u = new User(); $u->name = $input->post->username; $u->email = $input->post->email; $u->pass = $input->post->password; $u->registrationDate = time(); $u->addRole("member"); $u->save(); }
  11. @ridgedale 1. check the URLs tab 2. you might be using delayed output, the template files are used to set some variables which are later echoed in another file included at the end of the template file Something like this <?php $header = "<header>...</header>"; $content = "<div class='content'><h1>{$page->title}</h1><div>{$page->content}</div></div>"; $footer = "<footer>...</footer>"; // echoing something here will display above the header include ("main.php"); The main.php file <?php // here we echo the variables set in the template file echo "<html><body>..."; echo $header; echo $content; echo $footer; echo "</body></html>"; 3. $stories = $page->children("limit=6, sort=-date"); the above takes the 6 latest child pages of the current page, so on pages using the news-index.php template it gets the 6 latest child pages . https://processwire.com/docs/tutorials/
  12. @modifiedcontent Say you have the following form <form method="post"> <input type="text" name="name"> <input type="textarea" name="message"> <input type="submit" name="submit"> </form> You can save it to a page like this <?php if($input->post->submit) { $p = new Page(); $p->template = "template_to_save_form"; $p->parent = $pages->get("/parent-page/"); $p->title = $input->post->name . " - " . date("Y-m-d"); $p->submitted_by = $input->post->name; $p->message = $input->post->message; $p->save(); } You'll have to create the template, its fields and the parent page first. Also before saving the page make sure to validate/sanitize the input. <?php $p->submitted_by = $sanitizer->text($input->post->name); // instead of just $p->submitted_by = $input->post->name; https://processwire.com/api/ref/sanitizer/
  13. <?php $x = 0; foreach($page->SlideImagesRepeater as $SlideImagesRepeat) : $class = ($x === 0) ? "active" : ""; ?> <div class="item <?= $class ?>"> rest of code </div> <?php $x++; endforeach; ?> http://php.net/manual/en/language.operators.comparison.php#language.operators.comparison.ternary
  14. @Reezal AQ try $SlideImagesRepeat->Sliders->first()->url
  15. How will this be better than the current Markup Regions?