Jump to content

joeck

Members
  • Posts

    41
  • Joined

  • Last visited

Recent Profile Visitors

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

joeck's Achievements

Jr. Member

Jr. Member (3/6)

6

Reputation

  1. This is exactly what I have been looking for. Amazing! Thanks a lot!
  2. Interesting, I didn't know about this. But to my understanding I can use this field to create a new field in the admin page which is awesome but not exactly what I'm looking for. Is it possible to replace existing (default) option dropdowns (like choosing a file in CKEditor) with such a TextTags field?
  3. I'm not sure if this is the correct place, but I'm looking for a way to make a select dropdown to choose a file have a similar behavior like selectize.js. In particular, when adding/editing a link in a CKEditor Textarea to link a document (in the opening Modal) I would like to be able to start typing and not have to go through a huge list to select from the dropdown with all the files: Is there a way to have existing select-fields in the PW Admin with a selectize.js feature so you can start typing to filter the list? Can this module (or some in the family) help with this?
  4. Turns out the pdf file was actually broken and the code was working just fine... For anyone else who might end up here, this is the code I used (in Tracy Debugger console): // $page->files targets the field on the page with name "file". Change name with your own $directory = $directory = $config->paths->assets . "files/$page->id/"; //path to asset folder of current page $page->of(false); foreach (scandir($directory) as $file) { // loop through all files in directory if ($file !== '.' && $file !== '..') { if ($page->files->has($file)) { continue;} //skip if file is already in field $page->files->append($file); //append file to field $files->rename($directory . $file, $directory . $page->files->last()->name); //rename original file to name in field after sanitizer } } $page->save(); $page->of(true); thanks @MarkE for your assistance
  5. Yes absolutely! I am using Tracy Debuggers console to try the script but I wasn't sure if it is at all possible what I'm trying to achieve and if my assumption was correct. But I'll try some more debugging.
  6. yes the echo is showing the file name (handout.pdf). one issue I see is that the file name in the PW "file" field is all lowercase however the name of the file is not. I tried renaming the file to the newly added entry in the array of the "file" field but that didn't work either. echo rename($directory . '/' . $file,$directory . '/' . $page->file->last()->name); I then saw the entry in the "file" field in PW and it always showed 1kB as the size. When clicking on the name to open the document in a new tab the path would be correct and a loading animation appears but the file is not shown. Not sure why.
  7. Hi, I'm facing the issue where a customer has only 1GB of RAM on its server available (and doesn't want to upgrade). They have a few large files (videos) that they want on the website but when uploading via the processwire backend the progress bar gets stock after some time (assuming because it ran out of RAM). I see that files are saved to site/assets/files/1048 and 1048 being the page id. I tried uploading the files via ftp (to avoid the shortage of RAM) to the same folder but the images don't appear in the files field. I'm assuming the files field is just an array with the file names that are then searched in site/assets/files/1048 . Is there a way where I can have the field look for other files in that folder and have it automatically added to the array so it appears in the files field of the page? My attempt didn't work and I didn't quite understand why: $directory = "../../files/1048"; // files uploaded here via ftp $page->of(false); foreach (scandir($directory) as $file) { //go through all files if ($file !== '.' && $file !== '..') { echo $file; $page->file->add($file); } } $page->save(); $page->of(true);
  8. Hi, I'm facing the issue where i have a repeater field with a multi language textarea (german & english, german beeing default). In german more blocks should be displayed as in english. The textarea field is configured as inherit default language if blank (I don't want to change this since it is the wanted behaviour for all other pages...). Now I want to access the unformatted value of the textarea field in the repeater and only show it if it is not empty. Something like this: $body = ""; $page->of(false); foreach($page->blocks as $block){ //blocks is repeater field, each block has title and textarea if ($block->textarea->getLanguageValue($user->language)){ $body .= <<<EOD <div> <div class='uk-card uk-card-default uk-card-body'> <h3 class='uk-card-title'>$block->title</h3> $block->textarea </div> </div> EOD; } } $page->of(true); print $body; However this doesn't work: Call to a member function getLanguageValue() on string. I also tried the other syntax for getLanguageValue: $page->getLanguageValue($language, $field) But I didn't manage to get a unique name of the textarea field in the repeater. I looked into the API of FieltypeRepeater but couldn't find anyhting that fixed my issue. Any ideas?
  9. I am struggling with an issue where my language switcher with flags sometimes doesn't show the flag. It works in the default language (german): but when the site is in english the german flag is not shown (path to image is not found): I don't really understand why it works if the site is shown in german but not in english.. Code for language switcher: // remember what language is set to $savedLanguage = $user->language; $languageImage = $savedLanguage->image->url; echo "<li><a href='#' class='dropdown-toggle' data-toggle='dropdown'><img src='$languageImage' alt='$savedLanguage->title'> <span uk-icon='icon: chevron-down'></span></a>"; echo "<div class='uk-navbar-dropdown'>"; echo " <ul class='uk-nav uk-navbar-dropdown-nav'>"; foreach($languages as $language) { //go through all languages // if user is already viewing the page in this language, skip it if($language->id == $savedLanguage->id) continue; // if this page isn't viewable (active) for the language, display root page $viewable = true; if(!$page->viewable($language)) $viewable = false; // set the user's language, so that the $page->url and any other // fields we access from it will be reflective of the $language $user->language = $language; // output a link to this page in the other language $path = $language->image->url; $pagePath = $page->url; if(!$viewable) $pagePath = $pages->get(1)->url; echo "<li><a class='uk-text-medium' href='$pagePath' alt='$language->title'><img src='$path' alt='$language->title flag'> $language->title</a></li>"; } echo " </ul>"; echo "</div>"; echo "</li>"; // restore the original language setting $user->language = $savedLanguage; Language template: image field is configured as automatic (array if multiple) in language page (both german and english) only one image is saved html output of language switcher dropwon (image couldn't be loaded): html output when image can be displayed:
  10. I'm having the same issue. Is the solution from @DaveP still the recommended way? Edit: it is working for me like Tom (OP) posted, I was missing a comma in the selector.
  11. update: If I remove the pageSelect field from the registration form the error no longer shows but the registration process is still not working (not sure why) The problem seems to be on the registration form only. Profile edit works just fine with the pageSelect field.
  12. I removed the hook but error message still shows. I don't have any setup with nginx or other framework (apart from jQuery but I assume that is not considered weird, nor a framework) Tracy is on version 4.19.13 and apparently up-to-date. No recent tracy logs I haven't found any serialize() in my code and I'm pretty sure I didn't use it since this is the first time I hear about this function, let alone knowing what it does.
  13. yes I have a hook in ready.php that should only apply on a different PageSelect field called team_owner: $wire->addHookAfter('InputfieldPage::getSelectablePages', function($event) { if($event->object->hasField == 'team_owner' && !$this->wire('user')->isSuperUser()) { $permissions = $this->wire('user')->getPermissions(); $authorized_pages = new PageArray(); foreach($permissions as $permission){ if (!$permission->team_owner) { continue; } //skip permissions without team foreach($event->pages->find("template=team") as $page){ if ($page === $permission->team_owner){ $authorized_pages->add($page); } } } $event->return = $authorized_pages; } }); I think this is working as desired, since I see all the options in the dropdown of the registration form field (called team_reference) and if the hook would execute I shouldn't see all the fields in the dropdown. these modules are installled: AdminOnSteroids FieldtypeColorPicker InputfieldCKEditor LoginRegister PageEditFieldPermission TracyDebugger fullcalender.io (not a processwire module)
  14. oh boy, turns out that my css library materialize.css sets all the select inputs to display: none ? The select has all the desired data simply not visible due to css... But now i get another error when trying to register with a new account: Fatal error: Uncaught Exception: Serialization of 'Closure' is not allowed in [no active file]:0 Stack trace: #0 {main} thrown in [no active file] on line 0 Again no logs in Processwire admin or browser console. The registration email actually gets sent out but when you click the link you receive the error message: Unable to complete confirmation, please re-register and try again.
×
×
  • Create New...