-
Posts
51 -
Joined
-
Last visited
Everything posted by Ferdi Derksen
-
@ryan Happy Birthday! And ... een heel hartelijk welkom in Nederland! (A very warm welcome in the Netherlands) 👋 I hope the weather will be okay and you enjoy the Dutch hospitality. Greets from 's-Heerenberg (right on the border with Germany, feel free to get a cup of coffee with us)
-
Hi all! FYI / to be fixed Background: I tried updating on of our websites from a PHP7 to a PHP8 version, also migrating from 3.0.200 to 3.0.229 when an existing piece of code triggered a timeout. In this case I'm using the Sanitizer->truncate (WireTextTools - truncate) method with option 'collapseLinesWith' using an empty string as value. This triggered a timeout. Finding out why this occurred, I cannot find a clue. It seems between the referred versions there wasn't an update for this method. Anyhow, the fix is quite simple. Just using a blank space instead of the empty string fixed it. $html = '<p>Ligula sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Maecenas faucibus mollis interdum. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Nullam id dolor id nibh ultricies vehicula ut id elit. Donec ullamcorper nulla non metus auctor fringilla.</p> <h3>Header</h3> <p>Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Donec ullamcorper nulla non metus auctor fringilla. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec sed odio dui. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.</p> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Vestibulum id ligula porta felis euismod semper. Nullam id dolor id nibh ultricies vehicula ut id elit. Aenean lacinia bibendum nulla sed consectetur. <a href="https://www.processwire.com" target="_blank">Look at this!</a>.</p>'; $intro = $sanitizer->truncate($html, [ 'type' => 'word', 'maxLength' => 350, 'visible' => false, 'collapseLinesWith' => '', // BUG! - just a blank space fixed it 'keepFormatTags' => false, ]); var_dump($intro);
-
Tnx @neosin for your feedback - I'm currently rewriting the module with a lot of those issues fixed. Also adding a delay time checking for last modified time which is at least half an hour in the past. The preview is also a nice feature which I will take in consideration!
-
Hi @loukote, Nice to hear that solves some problems. To add the fieldtype "PageTitleLanguage" you can simply add this to the module in file "PublishToTwitter.module" at line 399. Since I'd like to keep the module as simple as is, I don't think this will be added soon.
-
Hi @loukote, My first thoughts were about that "user" template. This shouldn't be possible, because the module filters all System flagged templates. After installing the same PW and module as you did, I saw that there isn't a filter on the date-field nor title-field which indicates the option to select the "City" and "first name" fields. Those are valid by filtering only on the fieldtypes "FieldtypeDatetime" and "FieldtypeText" for the date field and fieldtypes "FieldtypePageTitle" and "FieldtypeText" for the title field. Since the filtering isn't that great, I added some minor changes to the module. Now it is possible to select the correct fields depending on the chosen template(s). The fieldtypes (as described above) are still used as a selector as well. Please let me know if this works out now.
-
Hi @loukote, Maybe a stupid question, but you did save the module after selecting a template, right? The list of fields available is depending on the template(s) you selected at the first place. This should indicate the "user" template is selected now. On the other hand, the "date" field is build with a selector for fields of type FieldtypeDatetime or FieldtypeText. Otherwise send/place some screenshots, happy to help!
-
Hi @benbyf, I'll check for the mention and when needed add it, when you need any extra support, let me know!
-
Hi @loukote, There is no limitation/filtering in fields of the selected template(s). Therefore those drop-downs are selecting fields with type "Text" for "page title field" and type "Datetime" for "datefield to check for publication" so the checks when Tweeting (or selecting which to Tweet) can be done properly. Cheers, Ferdi
-
Hi @DL7, First of all I assume you are using the module for version 3.x I think the first thing to change is the 'autoload' option in the getModuleInfo() method to 'autoload' => true (or add another template you are using for the creation of pages). Please let me know if that's working for you. Cheers!
-
Well in this case I (kinda) solved my issue using an array like this; $selector[] = ['field' => 'date_pub_end', 'operator' => '<=', 'value' => $now, 'not' => true]; I also read the documentation about the array-selectors in the blog and from Ryan but I guess we still have to wait a little bit for the upgraded documentation for this announcement; Tnx anyways @Macrura @kongondo for pointing me in the right direction!
-
Hello, I'm trying to build a selector array to work with an OR operator. I need all pages where the datetime field ("date_pub_end") is empty or in the future. In a selector string this could be solved with the following two examples (with and without OR-group) $selector1 = "... ,!date_pub_end<={$now}, ..."; $selector2 = "... ,(date_pub_end=''),(date_pub_end>={$now}), ..."; But I'd like it to work in selector arrays, so far I couldn't find a solution.
-
My guess why PW isn't listed in the most popular CMS systems is because it ain't visible in HTML right away. In my opinion we're lucky about that so any type of hacking is therefor also very limited (look at WP ).
-
Hi Raulyjo, Maybe you can repost the image - it isn't viewable now. Regarding your problem you might consider merging the VirtualHost options into 1 block and using ServerAlias for the www alias; <VirtualHost *:80> ServerAdmin Raul DocumentRoot "/opt/bitnami/apps/mywebsite/htdocs" ServerName mywebsite.es ServerAlias www.mywebsite.es </VirtualHost> Remember to restart Apache again after changing. I hope this works - but just let it know.
-
Using multi-instance in FieldtypePage
Ferdi Derksen replied to Ferdi Derksen's topic in General Support
Before you dive into this too deep - I got this working in a module-setup. I'm only interested to get it working without a module (not needed/critical). -
Using multi-instance in FieldtypePage
Ferdi Derksen replied to Ferdi Derksen's topic in General Support
Tnx for the input, but unfortunately I didn't get that to work, it results in a fatal error; Fatal error: Call to a member function wire() on a non-object in /mypath/htdocs/wire/modules/Inputfield/InputfieldPage/InputfieldPage.module(283) : eval()'d code on line 1 Placed in my ready.php file: $contentWire = new ProcessWire('/mypath/to/content/site', '/content/'); wire('content', $contentWire, true); // using $this->wire.... didn't work Placed in the field PHP code: return $this->wire('content')->wire('pages')->find("parent=/"); I hope you have any thoughts left? Thanks in advance! -
Using multi-instance in FieldtypePage
Ferdi Derksen replied to Ferdi Derksen's topic in General Support
Well, that is where I started ofcourse, but you can't use any other variables in the PHP code then $page or $pages ? -
Using multi-instance in FieldtypePage
Ferdi Derksen replied to Ferdi Derksen's topic in General Support
True, but I don't want to mix, these pages are only be available in certain cases. Because these fields are only set for a specific template we can get content from another PW installation and won't mix them up with the original installation. Have to say I should have mentioned that indeed. For this purpose only I also set a hook on InputfieldPage::getSelectablePages to be certain we could get the page when the current page has the same ID as in the other installation. // in short I removed this bit if($children && $children->has($page)) { $children->remove($page); // don't allow page being edited to be selected } -
Using multi-instance in FieldtypePage
Ferdi Derksen replied to Ferdi Derksen's topic in General Support
I guess you're wrong this time With a hook I managed to accomplish my question. My finished code looks like this: public function init() { $this->pages->addHookBefore('InputfieldPage::findPagesCode', $this, 'findPortalPagesCode'); } public function findPortalPagesCode($event) { if (!$event->object->findPagesCode) return; $event->replace = true; // @TODO check for value in findPagesCode before loading $content so it won't load every time $content = new ProcessWire('/mypath/to/content/site/', '/content/'); if($event->object) {} $pages = $this->wire('pages'); // so that it is locally scoped to the eval if(empty($event->object->findPagesCode)) $event->return = $pages->newPageArray(); $event->return = eval($event->object->findPagesCode); } At the fieldsettings I placed my custom PHP code as selector like this: return $content->find("template=news"); -
Hi guys, I was wondering if there is an option to load another site in the FieldtypePage by using the custom PHP code to find selectable pages. // placed as custom PHP code to find selectable pages return $content->pages->get("/")->children(); When it needs hooking into methods as "InputfieldPage::___getSelectablePages" or "InputfieldPage::___findPagesCode", I'd like to know how. By just placing the following code somewhere in the methods it won't work, but maybe someone else knows how? $content = new ProcessWire('/mypath/to/content/site/', '/content/'); // placed in subdirectory Maybe it isn't even possible, but then also, I'd like to know .
-
0.8.6 : Optional set a prepend text Find out which Twitter-account is connected when saving module 0.8.7 : Supports FieldtypeCroppableImage3
-
welcome to the club - nice comparison ! Remember to move this block of code into <head> though... <script type="application/ld+json"> .... </script>
-
0.8.5: Due to the recent Twitter update changes are made to remove the limitation of media-URLs. In addition there is an option to set the maximum number of images you want to add to the Tweet (when the images-field is set to multiple). Enjoy!
-
I'd prefer - only once per day though - The rest of the time just silence.
-
done that
-
Updated the module to version 0.8.3 for working with PW 3.x (use version 0.8.2 for PW 2.x).