Jump to content


Popular Content

Showing content with the highest reputation on 11/24/2019 in all areas

  1. 4 points
    Found this article to be a good read: https://tsh.io/blog/tips-on-keeping-php-code-under-control/
  2. 2 points
    I never used Hanna Code myself, but can't you just do $buttons = $hanna->render("[[subscribebuttons]]"); and then $out .= $buttons; ? Don't know if you gotta have $hanna = $modules->get('TextformatterHannaCode'); inside or before your function definition though...
  3. 2 points
    Maybe it's also: long time no sea? πŸ˜›
  4. 2 points
  5. 2 points
    Hi @Joss, long time no see. Nice to see you're still making the seas unsafe, Mr. Pirate. :-)
  6. 2 points
    Just use animejs, makes all the kid stuff animate.css obsolete website : https://animejs.com/ how to : https://animejs.com/documentation/ examples: https://codepen.io/collection/XLebem/
  7. 1 point
    NOTE: This thread originally started in the Pub section of the forum. Since we moved it into the Plugin/Modules section I edited this post to meet the guidelines but also left the original content so that the replies can make sense. ProcessGraphQL ProcessGraphQL seamlessly integrates to your ProcessWire web app and allows you to serve the GraphQL api of your existing content. You don't need to apply changes to your content or it's structure. Just choose what you want to serve via GraphQL and your API is ready. Warning: The module supports PHP version >= 5.5 and ProcessWire version >= 3. Links: Zip Download Github Repo ScreenCast PW modules Page Please refer to the Readme to learn more about how to use the module. Original post starts here... Hi Everyone! I became very interested in this GraphQL thing lately and decided to learn a bit about it. And what is the better way of learning a new thing than making a ProcessWire module out of it! For those who are wondering what GraphQL is, in short, it is an alternative to REST. I couldn't find the thread but I remember that Ryan was not very happy with the REST and did not see much value in it. He offered his own AJAX API instead, but it doesn't seem to be supported much by him, and was never published to official modules directory. While ProcessWire's API is already amazing and allows you to quickly serve your content in any format with less than ten lines of code, I think it might be convenient to install a module and have JSON access to all of your content instantly. Especially this could be useful for developers that use ProcessWire as a framework instead of CMS. GraphQL is much more flexible than REST. In fact you can build queries in GraphQL with the same patterns you do with ProcessWire API. Ok, Ok. Enough talk. Here is what the module does after just installing it into skyscrapers profile. It supports filtering via ProcessWire selectors and complex fields like FieldtypeImage or FieldtypePage. See more demo here The module is ready to be used, but there are lots of things could be added to it. Like supporting any type of fields via third party modules, authentication, permissions on field level, optimization and so on. I would love to continue to develop it further if I would only know that there is an interest in it. It would be great to hear some feedback from you. I did not open a thread in modules section of the forum because I wanted to be sure there is interest in it first. You can install and learn about it more from it's repository. It should work with PHP >=5.5 and ProcessWire 3.x.x. The support for 2.x.x version is not planned yet. Please open an issue if you find bugs or you want some features added in issue tracker. Or you can share your experience with the module here in this thread.
  8. 1 point
    That's what @elabx said! :-) 😁😁 Good to see you (again) as always πŸ˜‚.
  9. 1 point
    @elabx was right :-) Here't two ways in addition to @dragan's above: Method 1: Call Hanna inside your function function SomeFunction(){ $out ="<div>"; // hanna in here $hanna = wire('modules')->get('TextformatterHannaCode');// @note: wire! $out .= $hanna->render("[[hello]]"); $out .="</div>"; return $out; } $out = SomeFunction(); echo $out; Method 2: Pass your function an argument/parameter with Hanna rendered output $hanna = $modules->get('TextformatterHannaCode'); $hannaString = $hanna->render("[[hello]]"); function SomeFunction2($string){ $out ="<div>"; // hanna in here $out .= $string; $out .="</div>"; return $out; } $out = SomeFunction2($hannaString); echo $out;
  10. 1 point
    Got it!! It just took waking my brain up and using the clue from @dragan But, of course, this is inside a function - we have to use wire, don't we!!! $hanna = wire("modules")->get('TextformatterHannaCode'); $buttons = $hanna->render("[[subscribebuttons]]");
  11. 1 point
  12. 1 point
    Hi @elebx Yeah, I'm okay with the first line, erm, I think. It was how to then get the actual specific code [[subscribebuttons]] and render it within the function, outputting it as part of my $out chain, if you know what I mean.
  13. 1 point
    Hi @Joss !! What are you having trouble with? Most of the time I forget to call ProcessWire variables like this inside custom functions: $hanna = wire('modules')->get('TextformatterHannaCode')
  14. 1 point
    This is really the problem: the fieldtypes/inputfields having no support for pagination. I hit that on a project of mine, where users are linked to tickets. Given that the event in question does attract up to around 10k users registering I needed to hide the inputfield completely, because even just showing the value uneditable would load all the users when showing the ticket.
  15. 1 point
    New Version Release: 1.0.3 - Improves performance for FieldtypeFile & FieldtypeImage fields. @dragan Looking forward to your feedback. I'm still very curious how you managed to get 6s response time from GraphQL. Let me know how the latest version works for you. @nbcommunication That's great to hear! Any involvement is absolutely welcome. If you have your module available on github or some other place I would love to look at your approach and maybe steal some ideas πŸ˜›. Also, if your implementation is different than mine I would encourage you to finish it. We will only benefit from different approaches.
  16. 1 point
    Just for the record (not saying that it would be the best solution overall), FieldtypePageIDs also has certain benefits if/when the problem is loading too many Page objects into memory. It could be worth looking into in this sort of situation πŸ™‚
  17. 1 point
    I'm glad you believe @Robin S if you didn't want to believe me πŸ˜› Just create a custom $page method that does your logic, then you have your own performant API. That should get you started: $wire->addHook("Page::readByUser", function($event) { $result = $this->database->query("SELECT id,templates_id FROM pages LIMIT 5"); $ids = $result->fetchAll(\PDO::FETCH_OBJ); $user = $event->arguments(0); d("check for user $user"); $event->return = $ids; }); d($page->readByUser($user));
  18. 1 point
    I have a spare computer laying around so I did a fresh install of Windows and installed Laragon. I must say, it is very slick, feature rich and I can understand the appeal... it just works and has a lot of useful magic (such as auto virtual hosts and easy SSL setup).
  19. 1 point
    Hi @Jonathan Lahijani thx for that link. It looks nice indeed. Nonetheless I'm not sure how useful it would be. I'm not doing a lot of frontend, and ~5€/month doesn't sound too bad, but, well... it's 60€ per year and I'm not sure if I want to spend that. I think I don't need that fancy screenshot and zooming stuff (or do I?!), so I just hacked together a simple html page that shows an input for an URL and loads iframes in different sizes: https://bernhardbaumrock.github.io/devtools/ First problem I got was the same-origin restriction, so I copied the HTML file to my PW site. Well... that does not have synchronized scrolling but maybe it could still be helpful? This could also quite easily be turned into a PW module that hooks into the 404 exception when logged in as Superuser on /devtools url (or the like). What do you guys think? Anybody up for that? πŸ˜„ Here's the code: https://github.com/BernhardBaumrock/devtools
  20. 1 point
    @LostKobrakai suggestion is better, but if you decided to not add the field to the language page, the previous code will be: <?php // handle output of 'hreflang' link tags for multi-language // this is good to do for SEO in helping search engines understand // what languages your site is presented in foreach($languages as $language) { // if this page is not viewable in the language, skip it if(!$page->viewable($language)) continue; // get the http URL for this page in the given language $url = $page->localHttpUrl($language); // hreflang code for language uses language name from homepage $hreflang = $pages->get('/')->getLanguageValue($language, 'name'); if ( $language->isDefault() ) $hreflang = 'en'; // output the <link> tag: note that this assumes your language names are the same as required by hreflang. echo "\n\t<link rel='alternate' hreflang='$hreflang' href='$url' />"; } ?>
  • Create New...