-
Posts
807 -
Joined
-
Last visited
-
Days Won
10
Everything posted by kixe
-
There are Trillions of ways to access your values in Processwire. To get what you expected create a simple template file like this one: <?php /** * return all populated string values in the order of fields as defined in template settings * * **/ $ul = ''; foreach ($page->fields as $field) { if (!$page->$field) continue; $ul .= '<li>'.$page->$field.'</li>'; } $ul = "<ul>$ul</ul>"; echo $ul; ?> Learn a bit PHP. Read some PW Tutorials. Stay with PW and get happy
-
If you want to run the module with PW 307 and up you have to upgrade to Version 111
- 100 replies
-
- template
- autogenerate
-
(and 2 more)
Tagged with:
-
@LostKobrakai I am looking for a modification of Fieldtype Concat module, which allows to pull values from parent page fields too (via dot syntax). Is this implemented in the modified module? Would you share your module?
-
@Juergen Thanks for reporting this. If I find a little time I will have a deeper look. Multilanguage support isn't tested very well until now. There are still some other situations where the module doesn't work: If you want to generate name from a file field (selector like 'myimagefield.description') you will get an error. Name generation from a ProfieldsTable column is also not possible. I agree multilanguage name generation should be supported.
- 100 replies
-
- template
- autogenerate
-
(and 2 more)
Tagged with:
-
How to modify/add the templates setting
kixe replied to kreativmonkey's topic in Module/Plugin Development
Hi kreativmonkey, did you read the tutorials about creating modules? https://processwire.com/api/modules/ or how to use hooks? https://processwire.com/api/hooks/ If so, create a module which hooks in the hookable method, which you want to modify for your needs. Have a look inside: /wire/modules/Process/ProcessTemplate/ProcessTemplate.module If you need more specific help post it here. -
Understanding wakeupValue, sleepValue, sanitizeValue
kixe replied to Robin S's topic in Module/Plugin Development
@Cerulan you could use http://modules.processwire.com/modules/fieldtype-select-ext-option/ which offers exactly what you want. No need to create a new module for this. -
Hi Bernhard, thanks for the effort you have made testing my module. I think my regex is ok. Maybe I have to modify the detection of multiple fields, which happens before. For now it is a single space character. Since spaces are not allowed in page names you don't need to use spaces in the date function this will be anyway translated later (space -> dash). Does it make sense to provide a timestamp from a page property or datetime field, since you could handle this in another way? Its a bit painful to use the date() function, contrary to the correct PHP syntax. Meaning I didn't define any timestamp constants like 'val' or 'created' in the module. To prevent confusion I want to stay using correct date() syntax. For your second example you can easily use: "created forename surname" and you will get the same result. I don't understand date('dmY',val). If val is a pagefield, which returns a timestamp please use: 'val forename username' after configuring the output of field 'val' to 'dmY' in the field settings. If you then need other output formats in the templates you can do: echo date('Y-m-d h:i',$page->getUnformatted('val'));
- 100 replies
-
- template
- autogenerate
-
(and 2 more)
Tagged with:
-
@Jon Thanks for reporting. I fixed this. Please update to 1.0.9
- 100 replies
-
- 1
-
-
- template
- autogenerate
-
(and 2 more)
Tagged with:
-
Quick shot. not tested function renderList($items, $wrap = true) { if($items instanceof Page) $items = array($items); $out = ''; foreach($items as $item) { $out .= "<li><a href='$item->url'>$item->title</a></li>"; if ($item->hasChildren()) { $out .= renderList($item->children, false); } } if ($wrap) $out = "<ul>$out</ul>\n"; return $out; }
-
Could you implement a translation option for the javascript? (buttons ' New' and ' View'). I am really looking forward for the Ajax Solution to provide the new created page immediately.
-
Normally the datepicker will be displayed in the current user language. You will find all translation files for the datetimefield in the folder: /wire/modules/Jquery/JQueryUI/i18n/ But not everything is translated (Example: button 'done'). I made a translation for german. You could replace the file (jquery.ui.datepicker-de.js) with this one: /* German initialisation for the jQuery UI date picker plugin. */ /* Written by Milian Wolff (mail@milianw.de). */ jQuery(function($){ $.datepicker.regional['de'] = { closeText: 'schließen', prevText: '<zurück', nextText: 'Vor>', currentText: 'heute', monthNames: ['Januar','Februar','März','April','Mai','Juni', 'Juli','August','September','Oktober','November','Dezember'], monthNamesShort: ['Jan','Feb','Mär','Apr','Mai','Jun', 'Jul','Aug','Sep','Okt','Nov','Dez'], dayNames: ['Sonntag','Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag'], dayNamesShort: ['So','Mo','Di','Mi','Do','Fr','Sa'], dayNamesMin: ['So','Mo','Di','Mi','Do','Fr','Sa'], weekHeader: 'KW', dateFormat: 'dd.mm.yy', firstDay: 1, isRTL: false, showMonthAfterYear: false, yearSuffix: '' }; $.datepicker.setDefaults($.datepicker.regional['de']); /* Added by kixe. */ $.timepicker.regional['de'] = { timeOnlyTitle: 'wählen Sie eine Zeit', timeText: 'Uhrzeit', hourText: 'Stunde', minuteText: 'Мinute', secondText: 'Sekunde', millisecText: 'Millisekunde', timezoneText: 'Zeitzone', currentText: 'jetzt', closeText: 'schließen', timeFormat: 'HH:mm', isRTL: false }; $.timepicker.setDefaults($.timepicker.regional['de']); });
- 13 replies
-
- 1
-
-
- timepicker
- addon
-
(and 2 more)
Tagged with:
-
@BernhardB Thanks. I didn't know about that. Obviously it is doing the same job.
-
Page Field vs. PageTable Field differences
kixe replied to Jonathan Lahijani's topic in General Support
Workaround: https://processwire.com/talk/topic/11757-page-add-comfort-option/?p=109306 -
added a screencast.
-
Happy New Year from my side too and many thanks to everybody in the Forum especially to Ryan, always one step ahead!
-
Done. Renamed the module to ProcessSetupPageName and added it to the modules directory. http://modules.processwire.com/modules/process-setup-page-name/
- 100 replies
-
- 3
-
-
- template
- autogenerate
-
(and 2 more)
Tagged with:
-
From now you can use multiple values separated by space. Example: "parent.title date(Y) myfield". Page name will remain 'untitled' until last required field is populated. You will get informed about this by a warning. Merry Christmas.
- 100 replies
-
- 3
-
-
- template
- autogenerate
-
(and 2 more)
Tagged with:
-
I was looking for a more comfortable solution to add pages from a PageField Select. I ended up in this small module. Which is quite simple, but very useful. I created a PageField and another field of Type AddPage (requires FieldtypePageTable) with same settings for template and parent. Now I can easily add the page in the Modal. If you need it, take it as a Christmas Present from my side. (no christmas smiley available ... ) Dear Ryan, dear community, I wish you all the best for christmas and the upcoming year. <?php /** * Excellent side dish to Fieldtype Page. Doesn't store any data. Provides comfortable page creation. * * made by kixe (Christoph Thelen) 22.12.15 * Licensed under GNU/GPL v3 * * ProcessWire 2.x * Copyright (C) 2015 by Ryan Cramer * Licensed under GNU/GPL v2, see LICENSE.TXT * * http://processwire.com * * */ class FieldtypeAddPage extends FieldtypePageTable implements Module { public static function getModuleInfo() { return array( 'title' => 'Fieldtype Add Page', 'version' => 100, 'summary' => 'Excellent side dish to Fieldtype Page. Doesn\'t store any data. Provides comfortable page creation.', 'author' => 'kixe', 'requires' => 'FieldtypePageTable' ); } public function init() { // prevent data storage $this->addHookAfter('FieldtypePageTable::sleepValue', function($event) { $event->return = array(); }); // unneeded configuration fields can be removed $this->addHookAfter('FieldtypePageTable::getConfigInputfields', function($event) { $inputfields = $event->return; $page_behavior = $inputfields->children()->get(2); $removes = array('sortfields','trashOnDelete','unpubOnTrash','unpubOnUnpub',$page_behavior); foreach ($removes as $remove) $inputfields->remove($remove); $event->return = $inputfields; }); } } Screencast
-
I was struggling a bit getting all subfields of a field if type is unknown. I made a small function for use in templates which returns an array() of all properties of (maybe any?) pagefieldvalue. If there is something similar in core (which I couldn't find) please let me know. Tested it with Fiedtype Options, Page, ProfieldsTable. Feel free to use it. /** * ProcessWire UsefulSnippets * * How to get all properties, subfields of any field if you don't know the type only if value is set * @return array */ function getProperties($fieldvalue) { // multiple value field if ($fieldvalue instanceof WireArray) { $result = array(); foreach ($fieldvalue as $subfieldvalue) { $result[] = getProperties($subfieldvalue); } return $result; // single value field with subfields } else if ($fieldvalue instanceof WireData) return get_object_vars($fieldvalue->getIterator()); // single value field else return $fieldvalue; } // Example var_dump(getProperties($page->myfield));
-
Export fields/templates/configuration from one site to another
kixe replied to antpre's topic in Wishlist & Roadmap
Here comes a small Christmas Present Go to setup > templates or setup > fields and find 2 important (or exportant) buttons below the list in the right corner to go here: -
Fieldtype "Select Options" and "FormTemplateProcessor"
kixe replied to DV-JF's topic in General Support
You are using the wrong Api for Fieldtype Select Options. Read the docs: How to handle Fieldtype Select Options. Read the docs: https://processwire.com/api/modules/select-options-fieldtype/#outputting-selected-options-on-a-page or https://processwire.com/talk/topic/11615-select-options-classes-based-on-selections $optionsfield // return id (string) $optionsfield->id; // return id (int) $optionsfield->title; // return string USE THIS or $optionsfield->value; // return empty string or value (if your option settings like '1=value|title') Edit: Sorry. Didn't read your post carefully. Form Template Processor is a very old module which doesn't take care about subfields or fields with multiple values. You have to make some changes to this module. Maybe the ProModule FormBuilder could be your solution. As a starting point to adapt Form Template Processor have a look at this topic: https://processwire.com/talk/topic/11733-how-to-get-subfields-or-properties-if-fieldtype-is-unknown-helpful-snippet/ I am using a derivation of FormTemplateProcessor which creates Pages from the submitted stuff which works proper with any kind of fieldtype -
Some useful API Stuff: $config->superUserPageID // return int (Super User ID) $config->guestUserPageID // return int (Guest User ID) $user->isSuperuser() // return bool $user->hasRole('superuser') // return bool to check for any role $user->isLoggedin() // return bool $user->isGuest() // return bool Normally you cannot delete the superuser. Is there a change of Super User ID in your config file? Check if superuser exists with var_dump($pages->get(41)->name) // should return string like 'admin' or so If there is no page with ID 41 only solution is to manipulate your database and set the superuser page back to ID 41.
-
@Jugibur You don't need to be a programmer. Read some of the tutorials. This will help you. Start here: https://processwire.com/docs/tutorials/hello-worlds/ But you will become a programmer, (or something like that) if you stay with PW. This is my experience. Go for it.
-
I am thinking about resp. working on a version which allows multiple values too, something like Setting: date(Y), parent.name, id Result: /myparent/2015-myparent-5067/ This is a bit tricky since some values are provided in the moment when page will be created, some after. I'll keep you informed about how it is going on. If it is working well I will do the PR.