Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 01/30/2019 in all areas

  1. ElasticsearchFeeder This ElasticSearch module for ProcessWire will sync your page content to an ElasticSearch index, which provides you a convenient way to search it. Thanks to @jonathan-dart who created the first ES Module for PW and which influenced us a lot. Our approach was to create an a module where we can make for each template a flexible schema. You can define on you own which data ind which format should be transfered to ElasticSearch. Github Page: https://github.com/blue-tomato/ElasticsearchFeeder Module Page: https://modules.processwire.com/modules/elasticsearch-feeder/
    8 points
  2. TemplaneEngineMustache This module adds Mustache as engine to the TemplateEngineFactory. Project page in Github: https://github.com/blue-tomato/TemplateEngineMustache/ Module Page: https://modules.processwire.com/modules/template-engine-mustache/
    6 points
  3. https://processwire.com/api/ref/page/next-all/ / https://processwire.com/api/ref/page/prev-all/
    3 points
  4. Module starting to come together. Will of course give credit to other devs whose module code I've studied and in some cases, unashamedly copied, including @elabx draft OnSignal and nico's MarkupSEO. Ready now to jump
    3 points
  5. ---DEPRECATED--- Please use RockSkinUikit Just install the module and you can change the look&feel of your admin instantly by changing only one color: Download: https://modules.processwire.com/modules/rock-skin-uikit/ https://github.com/BernhardBaumrock/RockSkinUikit I'd be very happy if any of the CSS pro's could do some final improvements to the default.less theme - though I'm already very happy with the result! Happy Admin-Theming ? PS: At the moment this downloads a fork of the original AdminThemeUikit module because one method is not yet hookable. You can support this request here: https://github.com/ryancramerdesign/AdminThemeUikit/pull/77 and then I can update my module to pull the original theme from ryan.
    2 points
  6. You have to make the ajax call with the url .. not the template file. Make sure you have created a page with that template. $.post('ajax.inc', function(e) {}); $.post('/path-to-ajax-page', function(e) {}); Example Ajax Template from different db: $mydb = new Database('host', 'username', 'password', 'db'); $result = $mydb->query("SELECT * FROM example"); from pw db: $query = $database->prepare("SELECT id, name FROM pages LIMIT 10"); $result = $database->execute($query); Your js $.ajax({ type: "GET", url: "/path-to-ajax-template", success : function(data){ var markup = $(data).find('#result'); $('#result').html(markup); } });
    2 points
  7. Count me in too. ? I'm also waiting for this for a project where the website is done and I have to add the shop in later. No point to go with the old version. Let me know if you need any testing done, happy to help and pay the price.
    2 points
  8. No worries at all! Completely understand. Let me know if you want me to give this a trial run at any point when it's in Beta. Would pay the going rate up front also. Best of luck with it mate! Looking forward to putting it to good use! ?
    2 points
  9. node-processwire-logger Node.js module to log directly into the ProcessWire CMS/CMF log. Why? We had an use-case where we pre-generate static html pages from ProcessWire with ProCache and some internal node.js generator script. We thought it would be helpful to log errors when something goes wrong in the generator-process directly to the ProcessWire log. For this reason we created this Node.js Package. Github Page: https://github.com/blue-tomato/node-processwire-logger NPM Page: https://www.npmjs.com/package/node-processwire-logger
    2 points
  10. Hi again, problem solved(hopefully) using bd($textformatter, $field->name); I found that always after the second field the last element of $textformatters contained a NULL Element. Checking the name of the textformater i found that this always hapened to this formatter "TextformatterOnly0To9" After taking a really close look i found that the classname differed from the filename: "TextformatterOnly0To9" "TextformatterOnly0to9" Its only a upper/lower case difference and PHP (as far as i know) normally does not care about that in classnames. Changing this back lets me reproduce the issue. Still one thing i don't understand is the fact that exporting one field works perfect, i can't get the point why only fetching $textformatters a second time leads to this issue. Btw. i did not experience any other issues whith that wrong named classname the textformater did what he was expected to do....
    2 points
  11. Hi all, Introducing a new GDPR Cookie Management Banner module. https://github.com/adrianbj/CookieManagementBanner https://modules.processwire.com/modules/cookie-management-banner/ This module was sponsored by VentureWeb in Squamish, BC, Canada. I converted a Drupal module written by Oliver Walker from VentureWeb into what you see here. The Drupal module requires jQuery so at the moment, this module also requires jQuery. I will probably remove this sometime soon. This module certainly has similarities to MarkupCookieConsent but provides the user with the following features: The user can accept all cookies or they can choose to not accept tracking/marketing cookies. Module config options allow you to: define all text and button labels (multi-language support) manually increment the cookie policy version which forces the user to review their consent again select whether users can manage their cookies, or just accept all option to limit display of banner to users only in European Union (by IP address) position selection (top or bottom overlay, or content pushed down from the top) It comes with basic default styling which is easily overwritten by site CSS The module sets various values to the dataLayer array which works together with Google Tag Manager - please read through the code in /assets/js/CookieManagementBanner.js to get a better idea of how this works and what is made available for GTM. You can wrap your tracking/marketing cookie code in a check for the localstorage key of: pwcmbAllowCookies if(localStorage.getItem('pwcmbAllowCookies') == 'y') You can also provide a link on your site (probably in the footer) like this that will allow the user to show the banner even after they have saved their preferences / accepted. <a href="#cookies" class="js-pwcmb-notice-toggle">Manage Your Cookies</a> Would love to hear feedback from anyone who gives this a go.
    1 point
  12. Hi, So today I will writing a small tutorial on developing templates in Processwire using Twig Template, Processwire is a highly flexible CMS which gives developers/designers/users options and allows easy extension of the platform. So here goes the tutorial What is Twig Template ? Simply put in my own words, Twig is a modern templating engine that compiles down to PHP code, unlike PHP, Twig is clean on the eyes , flexible and also quite *easy* to have dynamic layout site with ease ,without pulling your hair out. Twig is trusted by various platforms. It was created by the guys behind Symfony. Take this code as an example {% for user in users %} <h1>* {{ user }}</h1> {% endfor %} This will simply be the equivalent in PHP World <?php $userArray = ["Nigeria","Russia"]; foreach($userArray as $user): ?> <h1><?= $user ?></h1> <?php endforeach; The PHP code though looks simple enough however, you start to notice that you have to be concerned about the PHP tags by ensuring they are closed properly , most times projects gets bigger and comes complex and harder to read/grasp, and also in PHP you can explicitly create variables in the template making it very hard to read as it grows and prone to getting messy WordPress is a major culprit when it comes to that regard. Have you ever wanted to created separate layouts for different pages and break your sites into different parts e.g Sidebar, Comment Section, Header Section ? the regular approach would be to create individual pages for each section and simply add them as templates for the pages and with time, you can end up having tons of templates, however Twig allows you to easily inherit templates and also override the templates where you can inject content into the block easily. Don't worry if you don't understand the concept, the following parts will explain with an example of how to easily inherit layouts and templates. Layout <!DOCTYPE html> <html lang="en"> <head> {{include("layout/elements/header.twig")}} </head> <body> <div class="container-fluid" id="minimal"> <header id="pageIntro"> <div class="bio_panel"> <div class="bio_section col-md-6"> <h1>Okeowo Aderemi</h1> <h2>{{ page.body }}</h2> </div> </div> <div class="clearfix"></div> </header> <section id="page-body"> <div class="container"> <div id="intro" class="col-md-7 col-lg-7"> <h1>About me</h1> <h2> {{ page.summary }} </h2> </div> {block name="content"}{/block} <a style="font-size:1.799783em; font-style:italic;color:#d29c23" href="{{pages.get('/notes').url }}">Read more articles</a> </div> <div class="clearfix"></div> </div> </section> </div> <footer> <div class="header-container headroom headroom--not-top headroom--pinned" id="header-container"> {{include("layout/elements/footer.twig")}} </div> </footer> </body> </html> This is basically a layout where we specify blocks and include other templates for the page, don't panic if you don't understand what is going on, I will simply break down the weird part as follows: Include This basically is similar to native PHP 'include', as it's name suggests it simply includes the templates and injects the content into the layout , nothing out of the ordinary here if you are already familiar with php's include function. {{ output }} This simply evaluates the expression and prints the value, this evaluate expressions, functions that return contents , in my own short words it's basically the same as <?= output ?> except for the fact that it's cleaner to read. {% expression %} unlike the previous this executes statements such as for loops and other Twig statements. {% for characters in attack_on_titans %} <h1> {{characters}} </h1> {% endfor %} This executes a for loop and within the for loop, it creates a context to which variables in that context can be referenced and evaluated, unlike dealing with the opening and closing PHP tags, Twig simply blends in with markup and makes it really quick to read. I will simply post the contents of both the header and footer so you can see the content of what is included in the layout header.php <meta charset="utf-8"/> <meta content="IE=edge" http-equiv="X-UA-Compatible"/> <meta content="width=device-width, initial-scale=1" name="viewport"/> <title> {{ page.title }} </title> <link href=" {{config.urls.templates }}assets/css/bootstrap.min.css" rel="stylesheet"/> <link href="{{config.urls.templates }}assets/css/main.min.css" rel="stylesheet"/> <link rel='stylesheet' type='text/css' href='{{config.urls.FieldtypeComments}}comments.css' /> <link rel="stylesheet" href="{{config.urls.siteModules}}InputfieldCKEditor/plugins/codesnippet/lib/highlight/styles/vs.css"> <script type="text/javascript" src="{{config.urls.siteModules}}InputfieldCKEditor/plugins/codesnippet/lib/highlight/highlight.pack.js"></script> <script src="{{config.urls.templates }}assets/js/vendors/jquery-1.11.3.min.js"> </script> <script src="{{config.urls.templates }}assets/js/vendors/bootstrap.min.js"> </script> <script src="{{config.urls.FieldtypeComments}}comments.js"></script> <link rel="stylesheet" type='text/css' href="{{config.urls.templates}}js/jquery.fancybox.min.css"> <script src="{{config.urls.templates}}js/jquery.fancybox.min.js"></script> {block name="javascriptcodes"}{/block} footer.php <nav class="site-nav pull-right"> <div class="trigger"> <a class="page-link" href="{{pages.get('/about').url}}"> <span>{</span> About <span>}</span> </a> <a class="page-link" href="{{pages.get('/notes').url}}"> <span>{</span> Journals <span>}</span> </a> <a class="page-link" target="_blank" href="https://ng.linkedin.com/in/okeowo-aderemi-82b75730"> <span>{</span> Linkedin <span>}</span> </a> <a class="twitter page-link" target="_blank" href="https://twitter.com/qtguru"> <span>{</span> Twitter <span>}</span> </a> </div> </nav> There's nothing special here, other than twig simply injecting these fragments into the main layout , the next part is the most interesting and important concept and benefit that Twig has to offer {% block content %}{% endblock %} This tag simply creates a placeholder in which the content would be provided by the template inheriting this layout, in lay terms it simply means child templates will provide content for that block, the 'content' simply uses the name 'content' to refer to that specific block, so assuming we were to inherit this template it would simply look like this. Inheriting Template Layout {% extends 'layout/blog.twig' %} {% block content %} <div class="container blog-container"> <section class="blog"> <header class="blog-header"> <h1> {{page.title}} </h1> <h5 class="blog_date"> {{page.published|date("F d, Y")}} </h5> <br> </br> </header> <div class="blog_content"> <hr class="small" /> {{page.body}} <hr class="small" /> </div> </section> </div> {% endblock %} {% block nav %} <div class="col-md-4 col-xs-4 col-sm-4 prev-nav"> <a href="{{page.prev.url}}"> ← Prev </a> </div> <div class="col-md-4 col-xs-4 col-sm-4 home-nav"> <a href="{{homepage.url}}"> Home </a> </div> <div class="col-md-4 col-xs-4 col-sm-4 next-nav"> <a href="{{page.next.url}}"> Next → </a> </div> {% endblock %} In this snippet you can easily notice how each blocks previously created in the header and layout are simply referenced by their names, by now you will notice that twig doesn't care how you arrange the order of each block, all Twig does is to get the contents for each blocks in the child templates and inject them in the layout theme, this allows flexible templating and also extending other layouts with ease. Twig in Processwire Thanks to @Wanze we have a Twig Module for Processwire and it's currently what i use to build PW solutions to clients https://modules.processwire.com/modules/template-engine-twig/ The Modules makes it easy to not only use Twig in PW but also specify folders to which it reads the twig templates, and also injects Processwire objects into it, which is why i can easily make reference to the Pages object, another useful feature in this module is that you can use your existing template files to serve as the data provider which will supply the data to be used for twig template. take for example, assuming I wanted the homepage to display the top six blog posts on it, TemplateEngineTwig will simply load the home.php ( Depending on what you set as the template), it is also important that your twig file bears the same name as your template name e.g home.php will render into home.twig here is an example to further explain my point. home.php <?php //Get the Top 6 Blog Posts $found=$pages->find("limit=6,include=hidden,template=blog-post,sort=-blog_date"); $view->set("posts",$found); The $view variable is the TemplateEngine which in this case would be Twig, the set method simply creates a variables posts which holds the data of the blog posts, the method allows our template 'blog.twig' to simply reference the 'posts' variable in Twig Context. Here is the content of the 'blog.twig' template blog.tpl {% extends 'layout/blog.twig' %} {% block content %} <div class="block_articles col-md-5 col-lg-5"> {% for post in posts %} <div class="article_listing"> <span class="article_date"> {{post.published}}</span> <h2 class="article_title"> <a href="{{post.url}}">{{post.title}}</a> </h2> </div> {% endfor %} {% endblock %} So home.php sets the data to be used in home.tpl once Twig processes the templates and generates the output, twig takes the output from the block and injects it in the appriopriate block in the layout, this makes Processwire templating more flexible and fun to work with. The major advantage this has; is that you can easily inherit layouts and provide contents for them with ease, without the need of running into confusions when handling complex layout issues,an example could be providing an administrator dashboard for users on the template side without allowing users into the Processwire back-end. You can also come up with several layouts and reusable templates. Feel free to ask questions and any concerns in this approach or any errors I might have made or overlooked. Thanks
    1 point
  13. I've added support for CKEditor within a Table field in v0.1.10.
    1 point
  14. Sorry, that was my fault - fixed now!
    1 point
  15. Thanks for sharing your modules today ? Just a quick note of a copy-paste error, this links to your other module:
    1 point
  16. yup, it says So if an image is simply uploaded and downloaded without manipulation (i.e. sizing), the original, unaltered version should be retrieved. At least that's the case in all my setups.
    1 point
  17. Yeah, this is a little painful. I use the same approach in Tracy. I think it might be better if Ryan replaces that json detection code with the following which seems to be the most common approach to problem. /** * is the provided string a valid json string? * * @param string $string * @return boolean */ public function isJson($string) { json_decode($string); return (json_last_error() == JSON_ERROR_NONE); } PS - actually maybe this isn't useful at all with this issue, but in general I think he should be using a function like this for determining if a string is JSON.
    1 point
  18. I'll try to find time to write a simplified version of the module and share it here. (because the module I wrote is a bit quite messy code wise).
    1 point
  19. A couple of things have derailed me some, so I cannot promise this. Beta testing will also take a bit of time, sorry.
    1 point
  20. @kongondo Are you still working to a March/April timeframe for the first release? I've got a project that I'm doing in phases and if it's a matter of a couple months I may well hold off on installing the existing version I have to save switching things out later. @HMCB Cool idea.
    1 point
  21. GoCardless is perfect for membership type payments. Direct Debit mandates are created and then once a customer has set up a mandate with you you can subscribe them to a package and set recurring payments and the interval between payments in years or months and how many payments should be taken. e.g. you can have a package that takes a payment monthly and you can set it to recur 10 times or it could be a yearly membership. GoCardless have various webhooks which can send info back to your application via a callback URL. @porl You could definitely get something like this set up. The API documentation is pretty damn good. You could then suspend a membership automatically if for instance a payment fails or the member cancels their direct debit.
    1 point
  22. Hello @monica and welcome to the PW forum. Is your field-name intro or introduction?
    1 point
  23. I have some width and height restrictions on my images field so the image gets uploaded and resized. In this case I'd assume anything specified in the gets applied. But i'm only guessing.
    1 point
  24. Probably totally stupid question, but do the user-uploaded images go through PW-side image processing at all?
    1 point
  25. PushAlert4PW WIP.... Some more on the PushAlert REST API. Every sent alert requires a URL and it appears in the notification. Silly me thought that was 'just life'. Didn't realise until I chatted with Alex from PushAlert, that it is in fact the URL to which notification responses are sent. It does not have to be the page, eg an admin page, that sent the push notification. So cool! The URL also appears in the notifications so thinking about hooking into the front end home page URL to capture the json responses and save the data to a different page that connects the sending page with the message id. Onward & upward
    1 point
  26. PS - when you have found the field in question, check out the Field settings in the RequestInfo panel to see if there are any textformatters showing there that are null or empty or something.
    1 point
  27. Have you tried: bd($textformatter, $field->name); so you can see which one at the end there is returning null? If you know the field affected, you might be able to check which textformatters are assigned to the field and find the problem that way.
    1 point
  28. You could follow or show to us the full stack trace to see which Textformatter is being called. Are they all set in the field option / details tab ? if yes, you might from there compare which one is missing ?
    1 point
  29. JSON in the description field is detected if the first character is { and the last character is }, or if the first character is [ and the last character is ]. See here. So one workaround could be to prefix the JSON with some character... *{"json": "here"} ...and then trim the first character before the module decodes the JSON.
    1 point
  30. I think I have found an issue which affects the "Live Search" feature of PW on edit language pages. The info for manually loading assets contains html markup, and even they are inside "```" quotes they make the Live Search choke ("invalid character at ..."). The JS error made the whole index file of Live Search outputted on the page and broke other JS functionality. It was not easy to track down, first I though it's AOS, then Tracy but finally it turned out to be this module (the reported line and column was not entirely proper). What made it even harder that you have to manually clear the Live Search cache and rebuild the index to test. This page can be found at "/setup/languages/edit/?id=1041", and the index file is at /site/assets/files/1041/.phrase-index.txt (use an existing language ID). First I tried to use only one "`" quote, then adding extra double quotes, etc. but nothing worked. Finally I replaced starting and closing html tags with their html entities and it worked well: array( 'type' => 'checkbox', 'name' => 'autoload_assets', 'label' => __('Autoload Assets'), 'description' => __('Autoload module CSS and JS files.'), 'notes' => __("If you disable this, you will need to load these files manually:\n```&lt;link rel='stylesheet' type='text/css' href='/site/modules/CookieManagementBanner/assets/css/CookieManagementBanner.css' /&gt;\n&lt;script defer src='/site/modules/CookieManagementBanner/assets/js/CookieManagementBanner.js'&gt;&lt;/script&gt;```\nNOTE: you must load the JS file with the defer attribute."), 'value' => 1 ), Let me know if you need more info.
    1 point
  31. Just install it on 3.0.98, so far didn't found any problem .. yet.
    1 point
  32. That's correct. Doc & do are used for %1$s and %2$s.
    1 point
  33. @Macrura I think this might be covered by this issue on the repo. That linked page also shows how to fix the issue.
    1 point
×
×
  • Create New...