Leaderboard
Popular Content
Showing content with the highest reputation on 11/16/2018 in all areas
-
This week we take a look at what's new in ProcessWire 3.0.119 and then we finish up by taking a look at a few screenshots from the new ProcessWire development website. If you read my post last week in the forum, you may already be familiar with some of these updates, but we'll cover them in a little more detail here: https://processwire.com/blog/posts/processwire-3.0.119-and-new-site-updates/11 points
-
Hi guys! I just uploaded a module to explore files based on elFinder. By default it will show the "Files" folder. Screenshots: Video: To do: More options To fix: The function of rotating or scaling an image fails Image editors V 1.01 (view issue) Fixed the bug working with the Multi-Language support ( translation of folders ). Fixed the name of elfinder.en Github: https://github.com/LuisSantiago/ProcessElFinder/ I hope you like it.10 points
-
4 points
-
It's the infinitely useful Console panel in Tracy Debugger: https://adrianbj.github.io/TracyDebugger/#/debug-bar?id=console3 points
-
This seems like it could be reasonable solution: disable session fingerprint when a site is on localhost. That way when developing locally the user agent is allowed to change without causing a logout. In /site/config.php: if(in_array($_SERVER['SERVER_ADDR'], ['127.0.0.1', '::1'])) { $config->sessionFingerprint = false; }3 points
-
I recommend using a virtual host for each local project - it avoids little issues like this and will be more consistent with how the site will operate when migrated to a remote host. It's not difficult to set up virtual hosts manually, although if you use a tool like Laragon it's an absolute breeze because it automatically creates virtual hosts for every project in the document root: https://laragon.org/docs/pretty-urls.html2 points
-
When a page is rendered by another page PW populates a "stack" of pages that called render in an $options variable. See Ryan's comment: So if a page is accessed directly and not rendered by another page then the page stack will be empty (in fact the $options variable will not be set). So you can put the following at the top of template files that should not be directly viewable but only rendered as part of another page: if(empty($options['pageStack'])) throw new Wire404Exception();2 points
-
2 points
-
If you don't want to go to deeply into writing your loop with comparing the previous letter, you could use the PageArray::groupBy method I posted: With it, you could write something like this (i't a bit of guesswork since I don't know if the "A" "B" "C" parts are really in the title or in a different field, but you should get the gist: <?php echo "<h2>Services</h2>"; $children = $page->children(); $children->sort("title"); // Important for grouping to work $grouped = $children->groupBy(function($pg) { // first argument ($pg) is always the page object we are examining $letter = preg_replace('/^Server "(.)".*$/', '$1', $pg->title); return array($letter); }); foreach($grouped as $letter => $letterPages) { echo "<h3>$letter</h3>"; echo "<ul>"; foreach($letterPages as $lpg) { echo "<li>{$lpg->title}</li>"; } echo "</ul>"; }2 points
-
I do it usually as follows: 1.) Create a file /site/translations.php <?php namespace ProcessWire; /** * TRANSLATABLE STRINGS * Define globally available translatable strings * * USAGE * place this file under /site/translations.php * __("My translatable string", $ferry); * The wire property $ferry refers to the textdomain of this file * */ __("My translatable string"); 2.) Define a wire derived object and place it in /site/ready.php /** * TRANSLATABLE STRINGS * Include translatable strings * @see /site/translations.php * @var $ferry */ $this->wire('ferry', '/site/translations.php', true); output in any template /** * output in template */ echo __("My translatable string", $ferry); Now you need to translate it only once, by using the string in any template. Usecase: strings like "read more" etc. For strings specific to a template you can use simply: /** * output in template */ echo __("My translatable string");2 points
-
I always have a dev-section in my config where this would perfectly fit into:2 points
-
The language pack is available at https://modules.processwire.com/modules/german/ or in the github repository https://github.com/jmartsch/pw-lang-de/releases/tag/latest The master branch will (try to) be up to date with the most recent stable version of ProcessWire. The dev branch will (try to) be up to date with the most recent dev version of ProcessWire. If you find any missing translations or errors, please create a PR or submit a bug/improvement. I hope we as a community can work together, to update translatations as soon as a new dev branch is pushed. Please let me know if you want to translate a new dev version, so we are not both doing the same task. If you want to help, you can clone my ProcessWire environment for language packs which provides an easy way for translating a language pack. You simply clone it, make changes to the language in ProcessWire and commit the changes back to your (or the german) language pack repository. This is a boilerplate which could work with any language, but right now it is tailored to the german language pack. Then I am able to quickly release an updated stable language pack when a new ProcessWire stable version is released. Big thanks to @Nico Knoll and @yellowled for their initial work on the translations.1 point
-
For some reason enabling the device mode in the Chrome developer tools logs me out of the ProcessWire admin. I'm using Windows 10, Chrome 70.0.3538.102. Steps to reproduce: 1. Login to PW admin. 2. View the site frontend in a new tab (e.g. Home page). 3. Open the Chome dev tools, enable device mode, and reload the Home page: 4. Switch to the admin tab (where dev tools is not open) and reload - you are now logged out. Can anyone else confirm this? Is there a setting in the dev tools that would avoid this? Or is this logout behaviour something that could/should be fixed in the PW core?1 point
-
Tip: If you install TracyDebugger, you automatically also get Adminer, with which it is very easy to import/export your full database from and to your local/staging server.1 point
-
1 point
-
If you run multiple PW under the same hostname, then setting $config->sessionName to something unique is recommended as well as it prevents one installations logged in state from clashing with another (and other weird admin caching things). I usually set its value to $config->dbName since that's easily unique enough. $config->sessionName = $config->dbName; $config->sessionFingerprint = 2;1 point
-
I can't sort them manually because the order is used in other layout components across the site. Technically I could build an extra kind of sortable page list but I also want to keep this really simple for a client who will be maintaining the site.1 point
-
I believe that ProcessWire automatically sorts out duplicates so you could do $Cats = $pages->find("parent=1086, id!=$page, sort=sort"); $Cats->prepend( $Cats->eq(4) ); foreach($Cats as $Cat) { }1 point
-
I've modified that first post with a new update to link here. Let me know if you'd like anything changed.1 point
-
Thanks, makes sense. So a couple of solutions would be: Use an incognito window when working with dev tools device mode. Or set $config->sessionFingerprint = false in /site/config.php These are okay but still kind of annoying. The incognito solution is a bit less convenient than working within the current browser window and easy to accidentally forget when opening view links from Page Edit / Page List. And I wouldn't want to forget the sessionFingerprint setting and leave it disabled as it reduces security a bit. I wonder if there is some way the PW session fingerprint feature could detect and allow for user agent changes that specifically come from the Chrome dev tools?1 point
-
Just from the bit of reading I was doing, each device has a different HTTP_USER_AGENT and therefore the sessions no longer match (between chrome and the device agent). A solution someone came up with on stackoverflow was to store the user agent in the session and check against it once the switch has been made. Perhaps someone better than I could give a better way to handle it in a PW sense. https://stackoverflow.com/questions/45532678/chrome-toggle-different-devices-view-destroys-the-session1 point
-
I've also been struggling with this: Thats because the $page you want to check is the first argument of the HookEvent, so you need to apply it there, not at the first part, which is the class (or object). You can also do this:1 point
-
The not saving thing is actually something I encountered too a few days ago when populating select options in a hook. Unfortunately, I didn't find the time to dig deeper (and it isn't an urgent case). Come to think of it, it might be a validation issue, as when saving in ProcessPageEdit, the render hook isn't called before processInput is triggered. So running the same hook code before InputfieldSelect::processInput might solve it.1 point
-
This is how I've done it, hooks to the rescue. Clean. $this->addHookProperty('Language::code', function(HookEvent $event) { $lang = $event->object; $event->return = $lang->name === 'default' ? 'en' : $lang->name; }); So now you can access it as a property of languages. $user->language->code;1 point
-
Hi @BrendonKoz Are you developing a custom module? $(document).on("pw-panel-opened", function(e) { console.log('opened'). }); This works for me. Where do you place your code? As for columns, it works for me, but only when screen larger than 1745 px. In this case, the width of the panel gets larger than 960px @media (min-width: 960px) .uk-width-1-5\@m { width: 20%; } Default width of pw-panel is 50%, but you can use ' data-panel-width='60%' or ' $button->attr('data-panel-width', '100%');' to tune the width, so you will get columns on smaller screens.1 point
-
I know this old, but the answer to this question is to add: $accept->attr('data-href', wire('config')->urls->admin . 'page/edit/?id=1479'); Remove this line: $accept->attr('href', 'http://localhost/winkelmann/www/bewerbertool-talents/admin/page/edit/?id=1479'); Hope that helps the next person.1 point
-
Hello, I fixed my problem. The solution was easier than its research Just needed to truncate cache table in MySQL.1 point