Leaderboard
Popular Content
Showing content with the highest reputation on 08/26/2016 in all areas
-
In this post we take a look at the latest core updates and go into detail about how we might handle the release of ProcessWire 3.0 and 2.8. https://processwire.com/blog/posts/pw-3.0.32/14 points
-
Hello for all, don't know if this is interesting to someone: //pseudocode example (inside some module) //we have some pages array (5 to 10 pages) wire('pages')->find('id=1111|2222|...'); // 0.050s, and ordering is not like selected wire('pages')->getById( array(1111,2222,...) ); // 0.035s, and ordering is exactly like selected It seems that query with "getById" is somehow faster and ordering is correct. Regards4 points
-
Looks like photoswipe, but is a bit more heavy on features: https://sachinchoolur.github.io/lightgallery.js/3 points
-
This panel has been added to the latest version! Just like the core module disable option, it is only available in PW's advanced mode and only for autoload modules. Please don't use this on a live site - it's not a problem with this panel, but rather the core module disable flag. It can break your site quite easily with some modules. For example, disabling the ProcessWireUpgradeCheck module results in a fatal error and the only way to fix is to manually remove the disable flag in the database. I am not sure whether Ryan might be able to fix (https://github.com/ryancramerdesign/ProcessWire/issues/1990) this in the core, or in the ProcessWireUpgradeCheck module itself, but it's definitely a good indicator that you need to be careful and savvy to be able to fix things if they go wrong! Still, hopefully you will find it useful - it is certainly a lot easier than going through all your modules in the admin and disabling them there. Let me know how it works out for you.3 points
-
To be a bit more secure or serious, you want to check if everything went ok, before you delete all images on the old page. If I undestood right, the new page images should be an exact copy of the old one. Therefore we can delete all (optionally) images on the new page first. Then, after adding all images to it, we compare both collections. When on PHP >= 5.6.0, we can compare the ->items(), what contains a list of all image basenames, what is fine! If we, unfortunately, on PHP lower then 5.6, we can at least compare the count of images, or have to loop through both collections and compare the basenames one by one. $pageNew->of(false); $pageNew->images->deleteAll(); $pageNew->save(); foreach($pageOld->images as $image) { $pageNew->images->add($image->filename); } $pageNew->save(); // now check for success or failures $success = version_compare(phpversion(), '5.6.0', '>=') ? $pageNew->images->items() === $pageOld->images->items() : $pageNew->images->count() === $pageOld->images->count(); if($success) { // delete images on old page $pageOld->of(false); $pageOld->images->deleteAll() $pageOld->save(); }3 points
-
In the last Blog Post Ryan said he and Horst are working on it have had a chat about it... On Mobile no Link sorry Link in the next post2 points
-
It's like your daugter's getting married. The name has to change and you got to let go. You better be prepared for this Ryan - test on this one of yours . This decision is clever. We need to take care to transfer everything (all the stars!!!) to the new organization. But I am sure it is thought out already.2 points
-
Tracy Debugger has a console panel, where you can run one-time code to be executed.2 points
-
Working on this module is starting to become a full time job! Unfortunately I don't think it's a simple as that for some modules - for example you can't simply disable a fieldtype without wreaking havoc. I still think this panel is useful - I am just hoping Ryan can sort out that issue which I think is related to just those modules using a separate config file (like ProcesswireUpgradeCheck). This has just been implemented in the latest version. This is Just a first attempt - any variable that is only used once is highlighted with the orange warning color. Other significant changes in the latest version. Fixed a problem with the Validator plugin that was introduced 4 days ago by a new requirement (the user_agent needs to be supplied in the post request) from validator.nu (https://github.com/validator/validator/commit/a6afb4f34402bce421df5102de313ec76295a55f#diff-5f739a043bdc345584b06cb39a7679aaR259) Make it easy to pass maxDepth and maxLength options to bd() calls. This can be very handy when you have a deep array or very long string that you need to see more of without changing the defaults of maxDepth:3 and MaxLength:150 which can cause problems with PW objects if you go too high. bd($myArr, 'My Array', array('maxDepth' => 7, 'maxLength' => 0)); Note that setting to '0' means no limit. I also I just wanted to note how useful the "Preserve Dumps" checkbox in the Dumps Recorder panel is - lots of times when doing module development in particular I found that bd() calls weren't showing up - I think it often has to do with the redirects or the call being made before the panel is ready or something. Now with this feature, even if it doesn't show initially, just reload the page and it will be there!2 points
-
If you have a static IP, you may log UAs for this IP a short time. I assume, you then will find what causes the issue: <?php // somewhere in site/ready.php, for example $myPrivateSaticIP = '123.123.123.123'; if(!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { $ipAddress = $_SERVER['HTTP_X_FORWARDED_FOR']; } else { $ipAddress = $_SERVER['REMOTE_ADDR']; } if($ipAddress == $myPrivateSaticIP) { // log infos of IPs, user agent and more, ... $items = array(); $items[] = 'REMOTE_ADDR: ' . (isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : 'N/A'); $items[] = 'HTTP_X_FORWARDED_FOR: ' . (isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : 'N/A'); $items[] = 'HTTP_USER_AGENT: ' . (isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : 'N/A'); // add more if needed ... $log->save('my_ip_useragents', implode(' || ', $items)); } https://processwire.com/api/ref/log/save/2 points
-
I like the module disabler, thanks! In my module I implemented an enable/disable toggle, and I think it would be a nice thing if such feature would be in all modules (in pw core). This would allow toggling a module state easily, if the developer has implemented this feature. Currently one has to uninstall a module but doing so will remove module settings so if you reinstall later you have to configure again. WP has such feature and I often miss this from PW.2 points
-
I don't think there's a straight-forward solution for this. Usually, advanced search requirements like this are covered by external search engines like Lucene, but those might a bit of overkill. A lean solution would be to create a (hidden) text field, let's call it titlenospace, and add it to all templates you want to search. Then, in site/ready.php (create the file if not there yet), hook into Pages::saveReady and populate the new field with the whitespace-stripped contents of the title field. <?php if($page->template == "admin") { wire()->addHookAfter("Pages::saveReady", function(HookEvent $event) { $page = $event->arguments(0); if($page->template->hasField("titlenospace")) { $page->titlenospace = str_replace(' ', '', $page->title); } }); } For a multi-language site, the titlenospace field has to be created as TextLanguage and the code gets slightly more verbose. <?php if($page->template == "admin") { wire()->addHookAfter("Pages::saveReady", function(HookEvent $event) { $page = $event->arguments(0); if($page->template->hasField("titlenospace")) { $page->titlenospace = str_replace(' ', '', $page->title); if(wire("languages")) { foreach(wire("languages") as $lang) { if(!$lang->isDefault()) { $page->setLanguageValue($lang, "titlenospace", str_replace(' ', '', $page->getLanguageValue($lang, "title"))); } } } } }); } The titlenospace field needs to be populated for existing pages (simply saving them should do). Then you can use the field in your selector instead of or in addition to the regular title field.2 points
-
In the admin we have an option to set a sorting for children using one field only. I have a problem with children getting sorted randomly when using a date field that is the same for multiple children. Usually we would sort by date and by ID or title, but we are only allowed to specify one field at a time. The problem with this is that once you edit one of those children, the sorting is randomly changed (actually everytime you edit a children) That's not really nice and very confusing. I had to use a dirty hook to change the children sorting one parent manually. $this->addHookBefore("ProcessPageList::find", $this, "sortingChildren"); public function sortingChildren(HookEvent $event){ $sel = $event->arguments("selectorString"); $page = $event->arguments("page"); if($page->template == "news-category"){ $event->setArgument("selectorString", $sel . ",sort=-datetime, sort=-id"); } } Maybe there's already a way I don't know or a module? But then I think this should be in core of course and not a module. Thanks.1 point
-
Hi guys so currently am writing a detailed tutorial about creating Modules, I have never created a module because i don't know all the classes and interfaces required, so this is like a detailed research for me, this is how i learn things by writing articles. However I might make some mistakes so i decided to make it on Google Docs to get comments and feedback, before posting on my website and Processwire tutorial site, this is going to be one heck of a detailed tutorial. Here is the link I will be updating it https://docs.google.com/document/d/1VA_WK-5qbnq3Ux_EOW3p92IcjbAcVZJ0aewIiFxmv2Q/edit# However I wanted to get a clear picture of the following Process Class and ConfigurableModule i noticed some modules require it and some don't My interpretation is that Modules with admin setting pages uses ConfigurableModule and Process are modules who require access to $this->pages and that sort Thanks all1 point
-
Recently we have had the absolute pleasure of working the professional grade monitor providers, EIZO. EIZO provide colour accurate monitors, so we took heavy influence from colour in our design process. For the website, as always ProcessWire has been a perfect fit. The modules I have used are as follows: ProCache ProFields Hanna Code MarkupSEO ColorPicker MapMarker MobileDetect Any feedback would be much appreciated — http://eizocolour.com/1 point
-
I'm grateful for the "what 2.8 is for" section in the post. With a limited understanding of namespaces and currently no need to use them in my projects I've been a bit confused about which version (2.8 or 3.0) I should use for new projects. I really just want to use whatever the majority is using as it makes the sharing of code in the forum easier. Now I have some clarity that 3.0 is the way to go for new projects.1 point
-
Thanks Ryan. Again not surprised by your thoughtfulness. Agree 100%. A new step forward.1 point
-
1 point
-
1 point
-
I'm thinking about to give this feature a GUI somehow in adminonsteroids. Any (simple) idea is welcomed.1 point
-
1 point
-
Thumb's up! I'm not a GitHub guru, but it sounds like a clever idea. To tell the truth, I'm a 3.x only guy, but following your blogposts, I can see that you really take it seriously, and thank you for this! I've seen awful major version changes of other CMS'es/frameworks already, so I'm sure anything you will finally come up with will be far better than those.1 point
-
I was thinking of this too. It is incredible what you have achived so far. You might want to charge for the module in the future. How about a light and a pro version? But psst! It wasn't me who gave you the idea1 point
-
Ok, thanks, I get it. I'm with you This topic is bit too advanced for me anyway, I was just trying to figure out how to handle this... So a big praise to @tpr for the idea, and to you too, of course1 point
-
Thanks Horst for adding this to it. I tried it and all code is working. Moving around pictures in the back end seems so easy now. I simply added the code at the beginning of my home page template file, opened the website and reloaded the home page. Which makes me wonder now. Maybe it is an idea to reserve a template file in processwire specially for executing code occasionally like in this case ? Anyway, the more I learn about the api, like in this case, the more it becomes a pleasure to work with processwire.1 point
-
since you are this far in troubleshooting, I assume you had also cleared the site/assets/sessions folder?1 point
-
By any chance, did you add cloudflare or something like that? I ran into this issue recently. The session logs said "Error: Session fingerprint changed (IP address or useragent) (IP: 108.162.219.219)." That IP address is Cloudflare IP. Then, after searching on this forum, I added sessionFingerPrint = false in config.php. The problem then went away. Good. However, the next day I removed that line to test the login/logout issue. Interestingly, I didn't notice any issue. So -- I don't really understand why the problem didn't reappear after I removed that sessionFingerPrint line.1 point
-
wow. That's a powerful script. I am going to use it. I had been running poor man's backup with these lines as cron. 0 0 * * * mysqldump -uusername -ppassword databasename | gzip > /var/www/backups/sql/sql_$(date +\%m-\%d-\%Y).sql.gz 0 0 * * * cd /var/www/backups/files && zip -r files_$(date +\%m-\%d-\%Y).zip /var/www/docroot/site/assets/files 0 0 * * * find /var/www/backups/sql/ -mtime +7 -delete 0 0 * * * find /var/www/backups/files/ -mtime +7 -delete The first two back up the database and files folder at midnight. The last two remove backups older than a week.1 point
-
Bumped to 1.5.41 with a workaround that only allows the use of /? at the end of a source string. As JL2 is in development, trailing slashes will be dealt with differently (provided I can fix the FastRoute implementation this is now fixed, and I'm not sure how I fixed it).1 point
-
@palacios000 - Thanks for bringing that to my attention. It appears to be a bug that seeped in from a previous change. In the early days, making trailing slashes optional involved setting them like this: [?] However, I wanted to retain the regex format for this, and so enabled a workaround that allowed us to do this: /? But, I didn't think about query strings after a trailing slash, and so I did not make it check for the regex optional format only at the end of the source string. Will patch this shortly and bump to 1.5.41.1 point
-
Yeah, it can be a real PITA. I am not too worried at the moment as the functionality requires PW's advanced mode and I am hoping Ryan might have some solution to that issue I posted. This panel is not adding new functionality - it's really just making it easier to disable lots of modules at once / in the once place. If Ryan has no solution, then I might consider removing modules from the list that have know issues (like the ProcessWireUpgradeCheck one). Agreed - I'll start thinking about this.1 point
-
I'm looking for examples of modules (but not Fieldtype modules) that create and query their own custom table in the database. Hoping to learn from these how to incorporate the use of a custom table in one of my own modules. These are the modules I have found so far: http://modules.processwire.com/modules/process-redirects/ http://modules.processwire.com/modules/template-parents/ The simpler the modules the better because my knowledge of SQL is nearly zilch.1 point
-
thank you guys, especially @Soma, helped me a lot! i totally forgot i had to inject the variable on my own in frontend. when i was logged in it was present because i use frontendediting and there it gets injected automatically. totally makes sense i took a slightly different approach with my own js variable: // template <?php echo $modules->get('PwFullCalendar')->render(array( 'editable' => $page->editable(), )); ?> // module public function render($options = array()) { // get settings $settings = array_merge($this->settings, $options); extract($settings); // push settings to javascript $out = '<script>var fullcalsettings = ' . json_encode($settings) . ';</script>';1 point
-
This one might also be interesting. It uses a simple table to store todo entries for adapting links to images and files after a page is cloned. https://github.com/BitPoet/ProcessPageCloneAdaptUrls/tree/dev1 point
-
This one does also use a quite simple custom table. http://modules.processwire.com/modules/migrations/1 point
-
The latest version has several tweaks, and one potentially valuable new config setting. The debug mode panel has the option to NOT show the debug tools when debug mode is off. This might be nice on a production site where you have forced superuser into development mode - you still like having the reminder to confirm that debug mode is actually off, but you don't want all the tools displayed - it is potentially a big performance improvement on some servers.1 point
-
Here's a few more - not sure whether you consider them simple or not http://modules.processwire.com/modules/version-control/ http://modules.processwire.com/modules/process-hanna-code/ http://modules.processwire.com/modules/process-jumplinks/1 point
-
Thanks Horst. I know it's happening for one iOS device and as noted on one Android. If I test and all can login AOK with sessionFingerprint=2 or 4 or 8 then presumably that is better (than 0) since at least some extra security is added, do you think? PS: Wow, never realized config.php could have dynamic statements, I suppose it's .PHP so why not; tks for the tip!1 point
-
I can prove that he does so: He even writes tutorials about the topic: http://soma.urlich.ch/posts/custom-js-in-processwire-admin/1 point
-
not() modifies the original PageArray, so you need to populate your variables with a copy of the original PageArray before you filter them. ($primary_tags = $article->article_tags->slice(0))->not("id=1336|1337|1338|1339|1327|1326|1328"); ($secondary_tags = $article->article_tags->slice(0))->not("id=1042|1043|1044|1340|1341");1 point
-
@Macrura that's outdated info. I've implemented the pipe OR switches probably about a year ago. Only the OR groups are not supported in that regard. The issue here is that support for inputfield dependencies in repeater/matrix fields is still kinda experimantal. It can work, but often it doesn't.1 point
-
Why should it not be available on the front-end? It's just you have to output the stuff in your header. Look at the default.php of templates-admin/. I always use it in my sites. <script type="text/javascript"> var config = <?php echo json_encode($jsConfig); ?>; </script> Then use the config.key in your JS.1 point
-
Hello, I have the same problem today and done this to solve that: $your_field->label = ''; //first need to set field label as empty string (important!) $your_field->skipLabel = true; //works only if the label is set to empty string regards.1 point
-
1 point
-
Ok, I made a huge progress after diving into the Inputfield class where I found those hidden features I needed to put the markup just where I needed. PW is great- it seems that Ryan (and others) have thought about all the things someone needs WAY before I added the field name to show on hover - it's animated from the left, with a small delay because it was frustrating moving the mouse around and they appeared here and there. I still need to finish a few things before I publish this but I think the majority of the work is done.1 point
-
With the awareness of this information, your vacation is over1 point
-
These two api is convenience for developer for next adjacent page of current page. But it only work for, in the order of pages creation How could it possible for, let say I generated a list of pages and sorted by a date field. That's the actual page order listed in the back-end is different from the front-end. if I used $page->prev and $page->next, it reflect the order of the back-end but not the front-end (pages sorted by date)1 point
-
This should work: $sortedPages = $pages->find('selector'); $prevPage = $page->prev($sortedPages); $nextPage = $page->next($sortedPages);1 point
-
What I do is use $config->js to populate the config array that I then output in the head for dynamic variables that want to share in a script. $config->js("myconfig", array("myajaxurl" => $pages->get(1991)->url); You can do this in templates or modules doesn't matter as long as it's before rendering page. Then this little to output as json. This is the same as PW uses in the admin to share config vars with js. <script type="text/javascript"> <?php // output javascript config json string to html // for use in javascripts from this point on $jsConfig = $config->js(); $jsConfig['debug'] = $config->debug; $jsConfig['urls'] = array( 'current_url' => $page->url, 'root' => $config->urls->root, ); ?> var config = <?php echo json_encode($jsConfig); ?>; </script> Then use in your script as var rootUrl = config.urls.root; for example1 point
-
I agree with DaveP that it does sound like there is some sort of cookie conflict in your domain. I don't think copying and pasting between tabs should be a problem at all. Are you working with two different copies of ProcessWire on the same domain? If so you'll want to change your sessionName in /site/config.php for one of them. Does your IP address change during the session? If so, you want to disable sessionFingerprint in your /site/config.php1 point