Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 09/25/2018 in all areas

  1. PW has an option to keep a history of pageviews in $session. You use a setting in /site/config.php to define how many history items you want to keep... // Keep the last 10 pageviews in the session history $config->sessionHistory = 10; ...and then get a multi-dimensional array of history data with... $history = $session->getHistory(); You could use this history to build your breadcrumb trail from.
    6 points
  2. @Bacelo, you can do all of that more efficiently in a single selector string: $termine = $page->children("(standort_reference~=$standort), (standort_alle=1), sort=date, limit=10, date>=today"); https://processwire.com/api/selectors/#or-groups
    4 points
  3. Hi @Hurme, this would be an ideal use case for language-alternate fields, if you haven‘t heard of them.? Or if you dont‘ want to use them, you could try to disable, that if no translation exists, the default language will be used. But language-alternate fields would be better. Regards, Andreas
    3 points
  4. You could also use the Field Code section (created by @bernhard) which lets you copy / paste the API code need to create the field. Be sure to grab the very latest version of Tracy because I just committed a fix to this feature. It was previously missing certain properties. Note that this option is not enabled in Tracy by default so you need to go to the module settings and enable:
    2 points
  5. I use this app on my Mac: https://www.bluem.net/en/projects/plain-clip/ Press SHIFT when launching Plain Clip.app to see its preferences settings panel. I use it by launching it with ctrl+option+command+V and afterwards my launcher app performs a paste operation by simulating command+V. This way I rarely run into copy/paste issues like that.
    2 points
  6. Hey friends, I will answer each of your questions below: @bernhard thanks for the link. Some good insights on $page->rootPage->find and "*=" selectors. Your summary sums it up perfectly, we need to load lots of different pages and fire hundreds/thousands of different complex selectors each customized per user. But a big chunk of the page is actually displaying content in a grid, so your module will come in handy although memory on our web server is not the issue currently. For concurrent edits to be honest I caused some misconception here, they work on different parts on the site concurrently but never on a single page together, so mySQL basically queues the inserts and performs them in sequence. @BitPoet we ruled that out already, latency averages at 0.500ms. We will implement better cache strategies later. The hidden JSON field is nice, this would at least reduce some joins and balances work between DB and Web. @Beluga We're giving InnoDB a shot now, thanks for the reminder. I will get back if that was the issue. @Jonathan Lahijani we're running latest PW master (= 3.0.98). We also had issues with ListerPro being unusable when querying specific fields. Site is slow in general, even without many users. We do not have debug mode enabled on prod. I think InnoDB is worth a shot at this point, also some cache strategies sound quite interesting. I will get back with more infos. Edit: InnoDB is working smooth, but performance is still mediocre. I'm checking whether or not joins are the reasons for the slowdowns we are expecting and try to fetch data from a single field. Thanks so far.
    2 points
  7. New version adds some configurable settings for the ACE code editor used in the Console panel and the File Editor panel: I went with the defaults I like, but adjust to suit your preferences - don't judge my use of spaces over tabs - it's mostly about consistency when pasting into web forums and other places, but if you need another reason: Developers Who Use Spaces Make More Money Than Those Who Use Tabs ? I am also a big fan of 4 character indentation but I do know that some people prefer 2, so take your pick. The one thing that is new is the intro of Show Invisibles being set to true. That results in the following which I find quite useful at times. Note the highlighted (in pink) character at the end. That actually isn't due to the Show Invisibles setting, but I thought I'd include in this screenshot to bring attention to this thread: https://processwire.com/talk/topic/19995-changing-structure-of-pages/?do=findComment&comment=173671 and how the Console panel can be a useful tool in finding non-printable characters that are causing syntax errors in your code.
    2 points
  8. On the Advanced tab: Also, in case it's useful, there is this module for restricting by page / branch: https://processwire.com/talk/topic/14891-restrict-multi-language-branch/
    2 points
  9. Hey Ryan, hey friends, we, Mobile Trooper a digital agency based in Germany, use ProcessWire for an Enterprise-grade Intranet publishing portal which is under heavy development for over 3 years now. Over the years not only the user base grew but also the platform in general. We introduced lots and lots of features thanks to ProcessWire's absurd flexibility. We came along many CMS (or CMFs for that matter) that don't even come close to ProcessWire. Closest we came across was Locomotive (Rails-based) and Pimcore (PHP based). So this is not your typical ProcessWire installation in terms of size. Currently we count: 140 Templates (Some have 1 page, some have >6000 pages) 313 Fields ~ 15k Users (For an intranet portal? That's heavy.) ~ 195 431 Pages (At least that's the current AUTOINCREMENT) I think we came to a point where ProcessWire isn't as scalable anymore as it used to be. Our latest research measured over 20 seconds of load time (the time PHP spent scambling the HTML together). That's unacceptable unfortunately. We've implemented common performance strategies like: We're running on fat machines (DB server has 32 gigs RAM, Prod Web server has 32gigs as well. Both are running on quadcores (xeons) hosted by Azure. We have load balancing in place, but still, a single server needs up to 20 sec to respond to a single request averaging at around about 12 sec. In our research we came across pages that sent over 1000 SQL queries with lots of JOINs. This is obviously needed because of PWs architecture (a field a table) but does this slow mySQL down much? For the start page we need to get somewhere around 60-80 pages, each page needs to be queried for ~12 fields to be displayed correctly, is this too much? There are many different fields involved like multiple Page-fields which hold tags, categories etc. We installed Profiler Pro but it does not seem to show us the real bottleneck, it just says that everything is kinda slow and sums up to the grand total we mentioned above. ProCache does not help us because every user is seeing something different, so we can cache some fragments but they usually measure at around 10ms. We can't spend time optimising if we can't expect an affordable benefit. Therefore we opted against ProCache and used our own module which generates these cache fragments lazily. That speeds up the whole page rendering to ~7 sec, this is acceptable compared to 20sec but still ridiculously long. Our page consists of mainly dynamic parts changing every 2-5 minutes. It's different across multiple users based on their location, language and other preferences. We also have about 120 people working on the processwire backend the whole day concurrently. What do you guys think? Here are my questions, hopefully we can collect these in a wiki or something because I'm sure more and more people will hit that break sooner than they hoped they would: - Should we opt for optimising the database? Since >2k per request is a lot even for a mysql server, webserver cpu is basically idling at that time. - Do you think at this point it makes sense to use ProcessWire as a simple REST API? - In your experience, what fieldtypes are expensive? Page? RepeaterMatrix? - Ryan, what do you consider as the primary bottleneck of processwire? - Is the amount of fields too much? Would it be better if we would try to reuse fields as much as possible? - Is there an option to hook onto ProcessWires SQL builder? So we can write custom SQL for some selectors? Thanks and lots of wishes, Pascal from Mobile Trooper
    1 point
  10. It's been there for about a week - pretty much just after all the new fullscreen and pane sizing shortcuts were added.
    1 point
  11. Did you read my mind or was that always there? I wanted to post this request yesterday but found all shortcuts in the docs... then I thought why bother adrian again with something that is already there ? awesome! thx
    1 point
  12. I'm pretty sure it's CKEditor doing that and not sanitizer->textarea(); Maybe this will help?
    1 point
  13. I was not totally serious and it was more targeting @Jonathan Lahijani and meaning something like: Why not use the functions api when it is only one setting away and does not need any modifications to any module? $config->useFunctionsAPI = true, that's it. Of course that's everybody's own decision, but I also started using it quite late and now I really like it. It makes things easier, shorter and better to read: public function executeTransactions() { $form = $this->modules->get('InputfieldForm'); $f = $this->modules->get('InputfieldRockGrid'); $f->name = 'transactions'; $f->label = 'Overview of Transactions'; $f->ajax = true; $form->add($f); return $form->render(); } I also prefer the array syntax now for adding fields: public function executeEfforts() { $form = modules('InputfieldForm'); $form->add([ 'type' => 'RockGrid', 'name' => 'efforts', 'label' => 'Overview of Efforts', 'ajax' => true, ]); return $form->render(); } To answer your question: If you've ever come across errors like "$pages/$modules/$users is not defined" or the like I'd suggest trying it out ? Using VSCode + Intelephense I also get very nice code completion, so I don't see any reason not to use it. Only thing bothering me is when I am developing public modules I need to remember not to use the functions API as I can't assume everybody is using it. that's a lot worse IMHO ?
    1 point
  14. I actually stumbled upon these two articles when I did some resarch on saturday and I think I'm getting your point. However I don't agree with all of the statements made there: On the flow chart on the far right it says “I'll just use refresh tokens" which he states couldn't be revoked – afaik usually you save the refresh token in the datebase of your Auth Server and everytime a user wants to refresh a token you check if it is still valid. So e.g. you could hand out short lived tokens (like 5-10 minutes) and everytime it expires the client has to obtain a new token via the refresh token if it's not revoked. In an upcoming project we might have multiple endpoints for different task, where it just sounded good to have an Auth Server which holds all the user information and hands out tokens, which the client uses on the other server to access something. On "Footnote: microservice architectures" of part 2 the autor suggests to use single use tokens to get a session on the other service, which I think means, If I want to revoke a session I need to do it on multiple places right? Aaaanyway, I did some tests with the API Module, sessions and a cross-origin client and it also works quite well, so with 0.0.3 you can choose your auth method in module settings between none / session / jwt
    1 point
  15. Glad you like it ? I don't see any reason not to. Would you mind submitting a PR? Please bump the version number as well so I can just accept and it's done. Thanks!
    1 point
  16. Great module @adrian. For the Custom PHP Code option, can you make it also have access to the $pages variable (in addition to just the $user variable)? I have a use case for it and it would be helpful. I modified the module to include it and it worked fine for me.
    1 point
  17. Go to the field edit page in the PW admin and then in TracyDebugger open the RequestInfo panel. This shows you all the properties currently set for a field. Just use these in the API as needed.
    1 point
  18. Try @Mike Rockett's sitemap module: http://modules.processwire.com/modules/markup-sitemap/
    1 point
  19. @quickjeff You can exclude some unneeded parents by using selectors like $breadcrumbs = page()->parents('template=catalog_category|home')->append(page()); @Robin S Wow, thanks for the hint. Didn't know about it.
    1 point
  20. 1 point
  21. You probably need to define your $month variable more thoroughly. Currently you query everything based of of month long sections around „today“, which does not align with where month start/end.
    1 point
  22. I just posted a new version of Tracy that may also help a little with this sort of thing: https://processwire.com/talk/topic/12208-tracy-debugger/?do=findComment&comment=173674 by highlighting invisible characters (as well as the non-printable ones in the above screenshot).
    1 point
  23. Are you logging in as a non-superuser? If that's not it and you have copy/pasted the hook code then it would be worth checking to see if any invisible characters got pasted which will prevent the code from working. I notice that this forum software has gotten quite bad recently at inserting invisible characters into code blocks - I see these characters in the email notifications I get from the forum. Most reliable thing for short blocks of code from the forum is to retype them yourself in your code editor. Another way is to use a tool that shows hidden characters. When I copy/pasted the hook code above into this online tool this is what I got: If that's still not it then I'm out of ideas, but you can try debugging with Tracy Debugger. Assuming you are developing your site locally, you'll need the "Force guest users into DEVELOPMENT mode on localhost" option checked in order to see the Tracy bar when logged in as a non-superuser. Bar dump $id and $page->template->name to check that these are what the hook is looking for in the conditional. I've modified the hook slightly just to make it clearer how the conditional relates to what you will be seeing in the bar dumps: $wire->addHookAfter('Page::listable', function(HookEvent $event) { // Only for non-superusers if($this->user->isSuperuser()) return; // The ID of the page that Page List is listing children of $id = $this->input->get->int('id'); $page = $event->object; // Dump to Tracy bar bd($id, 'parent page id'); bd($page->template->name, 'template name'); // Don't list pages with certain templates under Home (adjust template names as needed) if($id === 1 && ($page->template->name === 'internal_db' || $page->template->name === 'newsletter')) { $event->return = false; }; });
    1 point
  24. @adrian I'd actually assumed that hidden included unpublished (?). Will sort the changes out in the coming days (public holiday here today, back to work tomorrow).
    1 point
  25. IMHO the uikit docs are somewhat hard to read if you are not familiar with them. I've asked my design-partner a lot of such "dump" questions - everything was there, I just didn't see it as well ? They are more of a reference than docs. Listing all components and all options, but to know how everything plays together you need some experience and practise.
    1 point
  26. Have done it with tags in the end!... simples! ?
    1 point
  27. One more thing - the new version of Admin Actions now automatically "installs" new actions for superusers without needing to first visit the module settings page. Of course you can still go there to adjust the authorized roles and checking "In menu" if you want. Thanks to Robin for pushing me to make this happen ?
    1 point
  28. Just a quick note to say that AdminActions now supports installable custom actions like @Robin S suggested above. He has posted his new Unordered List to Pages action over here: If you have any ideas for custom actions, please take a look at Robin's example, but the key things to note is that you need to include a .module file named like: There are two requirements: The classname must start with "AdminActions" It must have 'requires' => 'ProcessAdminActions' This is the entire contents needed in a file named AdminActionsMySharedAction.module class AdminActionsMySharedAction extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'Admin Actions My Shared Action', 'summary' => 'My new action does really cool stuff', 'version' => '0.1.0', 'author' => 'John Doe', 'href' => 'https://github.com/JohnDoe/AdminActionsMySharedAction', 'requires' => 'ProcessAdminActions' ); } } Once the module is installed on a site, AdminActions will detect it and allow users to configure and use it like any other action. A big thanks to Robin for his ideas and significant feedback on getting this implemented!
    1 point
  29. I know this is ancient, but: $session->errors('clear');
    1 point
  30. @thlinna I have my development copy using LibLocalisation and working with Form Builder now - though it needs some more testing on my part. I'm also not 100% happy with the config controls for the localisation yet, so I'm going to wait a week or so before I release it.
    1 point
  31. http://tonsky.me/blog/disenchantment/ regards mr-fan
    1 point
  32. Yeah, you might be right about the XML sitemap idea. I think for some sites it could be ok to convert slugs to titles etc, but obviously some would be less useful. I might still have a play on a rainy day though ? I really love the idea of using the PW modules directory as a way to install these action pseudo modules. I'll make the adjustments to AdminActions to support this. Thanks for a great idea!
    1 point
  33. I think authors maintaining actions in their own repos is the way to go. I know from past experience that when tinkering around I often do several commits after I think I've done my "final commit" for a version as I spot little errors or think of new ideas. I wouldn't want to have to bother you or me with pull requests for these. Having a list of third-party actions in the readme sounds like a good idea, but I have another idea too. I think it would be cool if we could leverage the power of the modules directory and ProcessWireUpgrade for actions, so users can see when updates are available and easily pull those updates in. So the idea is that each third-party action that extends ProcessAdminActions would have its own "pseudo-module" - a module file containing just the required getModuleInfo() method. So for my action above the module folder would look like this: And ActionUnorderedListToPages.module would consist of this: <?php namespace ProcessWire; class ActionUnorderedListToPages extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'Unordered List to Pages', 'description' => 'Creates a structure of new pages from an unordered list.', 'version' => '0.1.0', 'author' => 'Robin Sallis', 'href' => 'https://github.com/Toutouwai/ActionUnorderedListToPages', 'extends' => 'ProcessAdminActions' ); } } ProcessAdminActions would look for third-party actions like this... $third_party_actions = $this->wire('modules')->findByInfo('extends=ProcessAdminActions'); ...and then get the action by looking for an ".action.php" file in the module directory. ProcessAdminActions could hopefully grab the action title/description from getModuleInfo() rather than this needing to be duplicated inside the action file (but no big deal if that wont fly). So this would require coding some extra features in ProcessAdminActions but I think being able to use the modules directory would be really cool. And the exact details of how all this would work is up for discussion of course - this is just me brainstorming here. What do you think? I might be wrong but this sounds like it wouldn't work very reliably. Sitemaps generally just have the URL to the resource and that seems like it would problematic to parse into the desired page structure in many cases: There is no page title in an XML sitemap so pages would have to use the slug name as page title, which may not be that close to the desired title - so potentially requiring a lot of manual fixes later and not making the action much of a time-saver. Many sites don't have the tidy connection between URL and page structure that PW has - worst are ones like /index.php?id=1234&view=detail&foo=bar. I'm not sure what the action would be able to do with this. XML sitemaps often include entries for non-page resources such as PDF files. If you think the XML sitemap idea can work I'm happy to be proved wrong. ? Maybe you want to have a play around with it?
    1 point
×
×
  • Create New...