Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/21/2021 in all areas

  1. Just read this quickly... ProcessWire variables such as $config, $session, $page, etc need to be accessed differently inside functions (check out PHP function scope). One way to access them is via wire, e.g. wire('config'), wire('session'), wire('page'), etc. ProcessWire variables are already global. I don't understand why you are using the PHP global keyword. Others will chime in, with better answers ?.
    3 points
  2. Change Default Language to be None-English | Walk Trough When you start a new (single) language site and the default language shouldn't be English, you can change it this way: Go to the modules core section: Select the Language ones by the filter function: We have four language related modules here, but for a single language site in none english, we only need the base module, named "Languages Support". So go on and install it. After that, you can leave it, ... ... and switch to the newly created Language section under SETUP: Select the default language Enter your new language name or its Shortcut and save the page. I will use DE for a single language site in german here as example: Now I go to the ProcessWire online modules directory, down to the subsection for language packs and select and download my desired (german) one: After downloading a lang pack as ZIP, I go back into my SETUP > LANGUAGES > default language page in admin, select the downloaded lang pack ZIP and install it: After the ZIP is uploaded, the files are extracted and installed, most of my screen is already in the new default language. To get all fully switched, we save and leave that page, ... ... and completely logout from the admin. Now, of course, we directly login back, ... ... and see, that now also the cached parts of the admin have switched to the new default language. ? That was it for a single language site in none english. If you want to have a multi language site, just add more languages to the SETUP > LANGUAGES section. When using a multi language site, I think you also want to use multi language input fields, and maybe different page names for your language page pendents. If so, you need to go into MODULES > CORE > filter LANGUAGE and install what you need or want to use of it, (if not already done). Thanks for reading and happy coding, ?
    1 point
  3. Hi there! I'm very new to ProcessWire, just found the system about a month ago and have been toying around with it a bit, and I'm loving everything I'm seeing! I'm coming over from the Concrete5 CMS, which I've been working with for 10 years, and one of the primary things that's so alluring to me about this CMS / Framework is that it doesn't try to get in your way. It seems like it's very much built with the mentality of providing the tools to build what you need, rather than forcing you to work around systems built for a specific purpose, and along with that, it seems like the community is incredibly helpful and friendly, which is always a big plus! One of the concepts that I'm used to from Concrete5 is the concept of Single Pages - one-off pages that are made for a specific purpose, and all of its code is self-contained, rather than part of a reusable templates. I am currently building a system that somewhat resembles an LMS - essentially needing Students, Student Records, quizzes / tests, and answers to them for each student record. The perfect example for my case is a user dashboard, to be able to view current tasks, know where to go next, etc. which won't be re-used anywhere else except on one page. From what I'm seeing with ProcessWire, it seems the base concept is that if you want a page to display on the front end of the site, it needs a .php template in the /site/templates/ directory, and even if the template is used in multiple pages, or only one, it makes no difference, and this is where it would / should go. Am I correct in this thinking? I want to make sure that as I learn ProcessWire, I get used to the standards and best practices that people have come up with, and I'm sure there's an answer to this somewhere already that I possibly overlooked, but I wasn't able to find it. Any insight on this would be much appreciated! Thanks!
    1 point
  4. Hi all ? I made this searchable UIkit 3.x documentation site to share with everyone. The official doc is great but you can't search across the whole doc. Anyway, here is the URL: https://uikitdocs.netlify.app/ What's missing is the live examples. Perhaps some of you can contribute? Github repo link is on the website as well. Cheers
    1 point
  5. Quick report: wire works splendidly: <?php function myFunction() { $session = wire('session'); echo $session->future; }; ?> Thanks again, @kongondo, for the pointer!
    1 point
  6. @benbyf I think there are other SendGrid modules you could try out. Caveat: I haven't used any of them.
    1 point
  7. Hi Hi, trying to use this module with Snedgrid but seem to be un able to know if the communication is happening... I've set up an account, verified the domain and email address, set up an API key and adding the code as follows but cant seem to get any emails or activity on sendgrid... anything missing or is this module no longer compatible? $mail = $modules->get('WireMailSendGrid'); $mail->to("******@gmail.com"); $mail->from("site@*********"); $mail->subject("test"); $mail->bodyHTML("hello"); $success = $mail->send();
    1 point
  8. There is no variable value in this module's API. The page id is at the variable info. So: <? php $pageReferencedByMarker = $pages->get((int) $dot->info); // do something with $pageReferencedByMarker
    1 point
  9. Accepting arbitrary pages sounds like a nightmare to support. There's really no upside to it that I can see. Linking existing pages via page reference fields sounds much more doable and logical. You'll avoid all those problems you already recognized.
    1 point
  10. Thanks @Robin S – that's an excellent explanation. I didn't previously know about the difference between PageFinder and in-memory selectors. It'd probably be good if allowable date formats were explained on the selectors documentation page. (I'm not sure what the best process for suggesting documentation updates is.)
    1 point
  11. https://processwire.com/blog/posts/processwire-3.0.107-core-updates/#trash-for-all
    1 point
  12. <?php /** * getFieldsetOf * * for ProcessWire * * gets fields inside a fieldset of pages or templates * choose to retrieve values * * @param Template|Page $context the page or template * @param String $fieldsetName name of the fieldset * @param bool|boolean $collectValues want to collect values of the pages fieldset? * @param string $fieldsetCloseIdentifier default: '_END' * @return FieldsArray|WireData returns FieldsArray or if data wanted, WireData */ function getFieldsetOf($context, String $fieldsetName, $collectValues = false, $fieldsetCloseIdentifier = '_END') { if ($collectValues === true && $context instanceof Page) { $collectedItems = new WireData(); } else if($context instanceof Template) { $collectValues = false; $collectedItems = new FieldsArray(); } else { throw new WireException("getPageFieldset: first argument must be of type Page or Template", 1); } if (!$context->fieldgroup->get($fieldsetName . $fieldsetCloseIdentifier)) return NULL; $collecting = false; foreach ($context->fieldgroup as $field) { if ($field->name == $fieldsetName) { $collecting = true; continue; } if ($field->name == $fieldsetName . $fieldsetCloseIdentifier) { break; } if ($collecting) { if ($collectValues) { $collectedItems->set($field->name, $context->get($field->name)); } else { $collectedItems->add($field); } } } return $collectedItems; } Some extension of the above code - works with templates and pages. If thrown at pages you may choose to retrieve the values inside the fieldset as a WireData object. edit: @dragan (below) thanks for the hint! Just removed it.
    1 point
  13. And here's some code for those that may need it: $myfieldset_start = false; foreach ($page->template->fields as $field) { // or something like $this->templates->get('templatename')->fields if ($field->name == 'myfield') { // opening element of a fieldset is just the field name you gave it $myfieldset_start = true; } elseif ($field->name == 'myfield_END') { // ending element is field name with _END on it - break out of the loop if we reach this break; } elseif ($myfieldset_start == 'true') { // otherwise we are iterating fields in the chosen fieldset so do what you like here echo $field . "<br>"; } }
    1 point
×
×
  • Create New...