Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/18/2018 in all areas

  1. From https://processwire.com/api/selectors/https://processwire.com/api/selectors/https://processwire.com/api/selectors/
    5 points
  2. Hi @Soma! First of all, thanks for another really useful module. Since I'm planning to add polls to my blog site profiles, I've dabbled with it abit. To make things work nicely with the existing templates, I had to tweak a bit of the generated HTML and, in the course of that, changed your module a bit: It now uses templates for every bit of HTML produced Added config settings for all these HTML template snippets There's a template for the main wrap, so wrapping the renderPoll() return manually is no longer necessary Added a config option and poll template field for a poll closing date (+time) pollino-ajax-script.js now wraps a div around the result before inserting it. That prevents a jQuery error if the result contains more than one HTML element. I'm storing any array $config data passed to renderPoll() in the user session and retrieve it in the AJAX action Added collapsed fieldsets for different template areas (generic, form, result) in the module config Last but not least, added "PHP" hints to the code blocks in README.md I have made a fork and added a branch with all these changes here. Perhaps you could give it a look (test drive?) and tell me if I should prepare a pull.
    4 points
  3. Update: I have been playing around some more. There's now another branche dev-bitpoet-cke that includes a Textformatter which replaces ##POLL:name-of-poll-page## with the poll output and a CKEditor plugin for easy insertion.
    3 points
  4. Thanks, will do. I've just finished making it multilanguage-ready but need to check first on non-ML site too, though the way it's set up I don't expect any issue. I ended up adding multiple divs to the DOM containing the list of files, one for each language (#link-files-menu, #link-files-menu__1088, and so on). Then on menu toolbar click I get the current lang ID of the editor (from data-configname and ckeditor ID) and show/hide the corresponding menu. Update: see here
    3 points
  5. I've got too many sites now that I need to be able to manage them all (my wife's included) from a single dashboard (since most are WP) and I've also got a number of WP clients I look after so I went 100% WP across the board. Nothing to do with PW, which served me wonderfully for a long long time.
    2 points
  6. If you don't need to search by specific field names nested in the matrix, you could add a concatenated (hidden) textarea field, hook into saveReady and render the matrix contents into that field. Then include that field for your search. Or, if you want to be able to search by property names (at any depth) have at least MySQL 5.7.8, you could try out the attached module JsonSearchable.zip. It's a field type derived from Textarea that uses native JSON storage. Supposed you made a page field named "myfield" and entered a JSON of: { "testdata":[ { "segment":1, "title":"Hello World", "average":20, "max":"30", "min":5 }, { "segment":2, "title":"This is Funny", "average":40, "max":"30", "min":5, "details":{ "name":"nobody", "email":"secret" } } ] } You could e.g. search for <?php $pages->find("myfield=30"); $pages->find("myfield.max=30"); $pages->find("myfield.details.name=nobody"); Note however that this kind of search on many large datasets can be an absolute performance killer. Numeric comparisons are not supported.
    2 points
  7. has something to do with settings of your MySQL server. The string is only 3 chars long. Try someting with 5 chars for example.
    2 points
  8. My experiences in 15 years with PHP on windows told me to not make any (platform) differences with filesystem related stuff. Simply use the / forwardslash for everything as long as you can achieve all operations with PHP internal functions! (copy, delete, ZIP!, etc) The one and only rule where you need to convert forwardslashes to backwardslashes on windows is, when you do calls in the commandline via exec() or system(). All other stuff is handled well from PHP internallly across all platforms. So, on windows you should not use functions like realpath() or dirname() without to convert backslashes to forwardslashes afterwards! Thats the only rule I followed all the time. (locally detect windows = convert \ to /)
    2 points
  9. UPDATE 2022 Simple and powerful - put this at the end of your config.php file: $localConfig = __DIR__ . "/config-local.php"; if (is_file($localConfig)) include $localConfig; Then put all local settings into config-local.php (same concept for DEV/STAGING/PRODUCTION): <?php namespace ProcessWire; /** @var Config $config */ $config->debug = true; $config->advanced = true; $config->dbName = 'db'; $config->dbUser = 'db'; $config->dbPass = 'db'; $config->dbHost = 'db'; $config->userAuthSalt = '1234'; $config->tableSalt = '1234'; $config->httpHosts = ['xyz.ddev.site']; // this prevents logout when switching between // desktop and mobile in chrome devtools $config->sessionFingerprint = false; // RockFrontend $config->livereload = 1; // RockMigrations // $config->filesOnDemand = 'https://your-live.site/'; $config->rockmigrations = [ 'syncSnippets' => true, ]; // tracy config for ddev development $config->tracy = [ 'outputMode' => 'development', 'guestForceDevelopmentLocal' => true, 'forceIsLocal' => true, 'localRootPath' => '/Users/xyz/code/yourproject/', 'numLogEntries' => 100, // for RockMigrations ]; $config->rockpagebuilder = [ "createView" => "latte", ]; -------------------- OLD POST from 2018: Have you ever come across the situation where you needed to change your config.php file for local development? Have you ever come across this warning? Say goodbye to this little annoying tasks Some of you might know that you can have a separate config-dev.php file for local development. This is nice, but also needs some setup (for example excluding this file for git upload) and there is still some danger of uploading this file to a place where it should not be... The other option was to keep the database settings for your live and dev server in sync - also not easy and maybe not the best... My solution is as simple, fast and I think it should be even safer than the other options. Just put these lines at the end of your config.php file: if(strpos($config->paths->root, 'C:/www/') === 0) { $config->dbUser = 'root'; $config->dbPass = ''; $config->httpHosts = [$_SERVER[HTTP_HOST]]; $config->debug = true; } elseif(strpos($config->paths->root, '/var/www/vhosts/') === 0) { $config->httpHosts = []; $config->dbUser = 'XXX'; $config->dbPass = 'XXX'; $config->debug = false; /** * Redirect to HTTPS * ATTENTION: This will NOT work with ProCache enabled! Use .htaccess instead */ if(empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == "off"){ $redirect = 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; header('HTTP/1.1 301 Moved Permanently'); header('Location: ' . $redirect); exit(); } } else die('wrong config.php'); Having a separate config-dev.php file also makes it necessary to keep both files in sync. That was my first idea: To include the original config and then overwrite settings. But it's just simpler the other way round: Using the default config.php file and overwriting settings there.
    1 point
  10. If you've ever needed to insert links to a large number of files within CKEditor you may have found that the standard PW link modal is a somewhat slow way to do it. This module provides a quicker way to insert links to files on the page being edited. You can insert a link to an individual file, or insert an unordered list of links to all files on the page with a single click. CKEditor Link Files Adds a menu to CKEditor to allow the quick insertion of links to files on the page being edited. Features Hover a menu item to see the "Description" of the corresponding file (if present). Click a menu item to insert a link to the corresponding file at the current cursor position. The filename is used as the link text. If you Alt-click a menu item the file description is used as the link text (with fallback to filename if no description entered). If text is currently selected in the editor then the selected text is used as the link text. Click "* Insert links to all files *" to insert an unordered list of links to all files on the page. Also works with the Alt-click option. Menu is built via AJAX so newly uploaded files are included in the menu without the page needing to be saved. However, descriptions are not available for newly uploaded files until the page is saved. There is an option in the module config to include files from Repeater fields in the edited page. Nested Repeater fields (files inside a Repeater inside another Repeater) are not supported. Installation Install the CKEditor Link Files module. For any CKEditor field where you want the "Insert link to file" dropdown menu to appear in the CKEditor toolbar, visit the field settings and add "LinkFilesMenu" to the "CKEditor Toolbar" settings field. http://modules.processwire.com/modules/cke-link-files/ https://github.com/Toutouwai/CkeLinkFiles
    1 point
  11. Like the last few weeks, most efforts this week focused on resolving issue reports at GitHub and preparing the master version. We are at a point where I think our dev branch is far better than our previous master (3.0.62), in every way, stability included. So there's no reason to delay further—3.0.96 is our new master version. This post covers all the details: https://processwire.com/blog/posts/pw-3.0.96-master/
    1 point
  12. I now have 100% for PWA in lighthouse on all pages. I forgot the url to the pwabuilder-sw.js in _main.php. Still not sure how it all works but the tips above do help. thanks.
    1 point
  13. Looks like the new CMS Critic website is back on WordPress again. I am curious to why WP (again) and what prompted the switch away from PW? Perhaps @cmscritic can comment on this? Thx Rudy
    1 point
  14. Hey @flydev - I was debugging some Notices in my code and had Tracy in strict mode (via the Panel Selector) and came across this. Let me know if you need any help reproducing.
    1 point
  15. Hello all, I'm experiencing serious issues when using PW built in template cache together wit AIOM. When a page is loaded from cache and you then change any of your CSS or JS assets, the rebuilding of the combined/minified versions is not being triggered at all. This explains @anttila's problem mentioned above. Also when you use the button in the module config screen to clear the asset cache, the template caches are not being cleared. So next time a page is loaded from cache, it will point to old asset files that do not exist anymore. I also did extensive testing with @matjazp's fork. But same problem there. After looking at the module code, I think that the problem lies in the module hooking into Page::render. But this never gets called once pages are cached. Please correct me if I'm wrong here. One possible solution would be to hook into PageRender::renderPage instead. This always gets called for every page request and returns a cached version if available or a fresh Page::render. I forked @matjazp's version as it seems to be the most up to date and will try to fix these issues...
    1 point
  16. What's the big picture? Where are these JSON files coming from? Do you just build a frontend with externally fetched JSON data? Do you have to fetch / update JSON data on a regular basis? Or do you create this JSON yourself?
    1 point
  17. Thanks a lot for the feedback @Robin S Of course you are totally right about returning false by default, that was bad practice on my part. Providing I haven't missed something silly then I guess my code is good? I'm not sure about how efficient it is, but I doubt it would cause too many issues? The other suggestion you made seems good, but for this project I need to limit all permission in the PW admin. Thanks again
    1 point
  18. I had a look at this, and it seems it isn't possible to directly set the optionAttributes property of inputfields that extend InputfieldSelect. That is probably why @kixe made this module. But what you can do is use a hook to remove the existing options, and then add them back with some attributes... $wire->addHookBefore('InputfieldCheckboxes::render', function(HookEvent $event) { $inputfield = $event->object; // Only for a specific field if($inputfield->hasField != 'your_field_name') return; $options = $inputfield->options; // Get the existing options $inputfield->options = []; // Remove all the existing options // Add the options back with attributes foreach($options as $value => $label) { // Set whatever attributes you want as $key => $value in the last argument of addOption() $inputfield->addOption($value, $label, ['disabled' => 'disabled', 'data-foo' => 'bar', 'class' => $this->sanitizer->pageName($label, true)]); } $event->return = $inputfield; });
    1 point
  19. You were on the right path but that file is only a sample. Copy it elsewhere to templates/scripts for example and load it in assetpaths. I don't know what is that, will do a search.
    1 point
  20. +1 Been using the devs as they come out each week and only found a couple of very minor issues that were fixed almost immediately. Also been using a few of the new features, it's pretty amazing what's been added in the past 12 months.
    1 point
  21. No, I don't mind. Go right ahead.
    1 point
  22. Great job, @ryan! It was really astounding to watch the commits roll in and the open issues melt over the last few weeks, and there are so many new features too! I've been using latest dev versions extensively, and the few minor bugs I stumbled upon were solved before I could report them I even used some of the newly implemented features without realizing it This year already rocks!
    1 point
  23. I've played around a bit with setting up a blog in PW using @kongondo's blog module and, since I'm anything but not a designer, incorporated the free "Striped" template from HTML5UP. The result is Striped Travel Blog Template (Responsive). Update: link now points to the official module repository. The layout is classical (some might say "very nineties" ) but I do like sidebars on the left and content starting close to the top. Features are: You can the sort order for lists that are sorted by date to ascending or descending. This is the "killer feature" I'm missing everywhere else, and as an avid reader of hiking blogs (mostly long distance, so long series of blog entries) I always hate when "next" buttons take me backwards (in time) and lists have to be read top down. Post lists are paginated Since it uses the blog module, comments and email notifications for them are a given Contact form using @justb3a's Simple Contact Form module Auto-generated sitemap.xml using @Pete's XML Sitemap module The usual stuff like recent comments, recent posts, recent tweets Calendar for the current month with links to dates with pages 3-column home layout with posts, configurable number of posts shown there "Sticky" option for posts to glue them to home RSS feed Already added all templates with translatable strings to site translation files Todos: Add post overview by year and month Allow paging through the calendar widget by month I'm a bit of two minds whether to show the full posts in lists or just summaries and still have to decide on that As written in the title, it is still in development, and I'm not completely happy with the lack of integration of my additional site-wide settings with the blog module's settings widget. I just thought I'd share it. Of course, I'd be happy about any feedback. Screenshots:
    1 point
  24. I got tired of having to open the link dialog in CKEditor in order to check where a link is pointing to, so made this simple plugin. Link Hover A plugin for CKEditor. Shows the href attribute of a link in a tooltip when the link is hovered. This saves you from having to open the link dialog in order to check where a link points to. Installation This readme assumes installation in ProcessWire CMS. The plugin folder must be named "linkhover" – if necessary, rename the folder to remove the "-master" suffix added by GitHub. Copy the "linkhover" folder to /site/modules/InputfieldCKEditor/plugins/ In the field settings for each CKEditor field that you want to activate the plugin for, check the "linkhover" checkbox at Input > Plugins > Extra Plugins https://github.com/Toutouwai/linkhover
    1 point
  25. Best way to search the modules directory is via the PW Info panel in TracyDebugger:
    1 point
  26. Perhaps I'm the only one who does this but I usually load the site's main css into ckeditor. This way the look is much closer to the final result, at least for font size, family, color etc. If I need to exclude a style from ckeditor I use body:not(.cke) in css (if I remember right for the classname).
    1 point
  27. It's working here in Firefox, and it's unlikely that there will be a difference between browsers in how that JS works. I think it must be a caching issue. Please visit Modules > Site and click "Refresh", and then scroll down and click "Clear compiled files".
    1 point
  28. I just stumbled upon this collection of .gitignores: https://github.com/github/gitignore Should we add a PW default .gitignore file there?
    1 point
  29. Hey, The Form API has CSRF protection build in, but if you for some reason don't want to use the API you can however use the CSRF protection. Its very simple but it took some time for me to find out, so i figured i share my findings with the rest. What is CSRF? First you need to create a token and a token name you do that as following: $tokenName = $this->session->CSRF->getTokenName(); $tokenValue = $this->session->CSRF->getTokenValue(); Very simple. Now what you want to do is create a hidden input field like this: $html .= '<input type="hidden" id="_post_token" name="' . $tokenName . '" value="' . $tokenValue . '"/>'; Now this will generate something that will look like this: You are done on the form side. You can now go to the part where you are receiving the post. Then use: $session->CSRF->validate(); This will return true (1) on a valid request and an exception on a bad request. You can test this out to open up your Firebug/Chrome debug console and change the value of the textbox to something else. Basicly what this does is set a session variable with a name (getTokenName) and gives it a hashed value. If a request has a token in it it has to have the same value or it is not send from the correct form. Well I hope I helped someone.
    1 point
  30. @cmscritic Hey Mike, The fact that you can drop in and share with us so much about your reasons for the move says a lot about you. I like that; I respect that. As others have said, we've also gained a lot as a community from your collaboration with Ryan: Hanna Code, the awesome CMS Critic development write-up, and who knows how many people have found ProcessWire because of your site . So, thanks for the ride... Best wishes for the future.
    1 point
  31. Wow - I was surprised to read this and even thought it was a joke. I'm sorry to see CMS Critic go. They did a lot for ProcessWire in that short space of time. Then again, ProcessWire does a lot for ProcessWire too I'm sure both parties will survive their CMS Brexit! Regardless of the CMS which powers CMS Critic, I must admit I almost never visit the site. IMHO they primarily have a design and information architecture problem and not a CMS problem. Ok, they're running on WP now so they have a CMS problem once again but you know what I mean ...
    1 point
  32. Wow, the new Pingdom Website Speed Test result is... amazing Grade D, 10.29 seconds load time, 3.5 MB page size, and 206 (!!) requests.
    1 point
  33. It's not unusual to hear of a website moving from WP to PW but this is the first time I've heard of one going the other way. Call me crazy, but I thought a business that wants us to believe they are qualified to pass judgement on the software used to develop websites might be capable of doing their own website development and customisation in-house.
    1 point
×
×
  • Create New...