Leaderboard
Popular Content
Showing content with the highest reputation on 03/10/2018 in all areas
-
This week we take a look at something really cool we added a few months ago but haven’t told you about yet: owner selectors. We also take a brief look at what’s new in ProcessWire 3.0.95 and and the status of our next master version, which is just about ready! https://processwire.com/blog/posts/processwire-3.0.95-core-updates/11 points
-
If anyone is interested, I have a new fork of this module available here: https://github.com/adrianbj/MarkupSEO/commits/various-fixes-enhancements It's very much a work in progress, but it includes several bug fixes and lots of new features. Please read the commit log to learn about what's fixed and what's new. At the moment you should not upgrade an existing site (new fields won't be created) and probably don't use it on a live site just yet. It's not well tested at all yet, so use at your own peril I'd really appreciate any feedback on it.7 points
-
option 1: w/ 'owner' selector (as mentioned in blog post) $items = $pages->find( "template=architect, " . "architects.owner.parent.name=atlanta, " . "architects.owner.height>1000" ); option 2: w/o 'owner' selector (2 queries required) $architects = new PageArray(); foreach($pages->find("template=building,height>1000,parent.name=atlanta") as $building) { $architects->add($building->architects); } option 3: w/o 'owner' selector but requires a bi-directional relationship field called 'buildings' on the 'architect' template (using the bi-directional approach or possibly PagefieldPairs, or ConnectPageFields): $pages->find("parent=/architects/,template=architect,buildings.parent.name=atlanta,buildings.height>1000"); Hopefully that de-mystifies it. I come across this brain twister once in a while.5 points
-
Hi everyone, I know we'd all like to see ProcessWire grow in popularity (maybe not hugely, but just enough that more people know about it which can help to convince clients to go with it). It strikes me as strange that the ProcessWire Github repo still has less than 300 stars - I'd like to see us well over a thousand which should be an easy task for the forum members to achieve. I see so many other projects with lots of stars but for some reason it doesn't seem like it is something we tend to do around here, despite being a very active, friendly, and supportive environment. I also think that starring your favorite modules doesn't hurt either - I think that will also help to increase the visibility from PW and also help out module authors a little as well. If you can show your Github project has a decent number of stars it shows that you are building things that people want which can help you land a job and helps you to convince the client that you and ProcessWire are a good mix. Anyway, if you have a minute to do some starring of PW and your favorite modules, hopefully it will benefit us all a little. Thanks!2 points
-
Nope. You can delete it if you want. In that case, let PW know what to use for 404 config (see below) Yes. Quite the overkill . just move page with ID 27 under /admin/ (i.e., re-parent it). Editors will not be able to see it. OR Create a new 404 page under /admin/ (and delete page with ID 27 or reuse it for whatever). Editors will not be able to see it. Add this to /site/config.php $config->http404PageID = 1234;// ID of your new hidden 404 page. That's all there is to it.2 points
-
Actually creating separate action files which have hard-coded values will probably be the easiest and quickest; didn't think of that!2 points
-
2 points
-
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. Thanks1 point
-
No worries. I get your point . In this case, though, the module in question has its own support forum, hence, all questions regarding it should be directed to its support forum. Edit: I think our forum guidelines could be clearer in this regard, though. I'll have a word with the other mods.1 point
-
Hi @adrian, I haven't had a bad run with Tracy at all. On the contrary, I nominate Tracy for module of the year. And you have done an excellent job of maintaining this indispensable tool. I've made the changes to the rss module. I don't see anything crop up yet. Thanks for those. Upgraded to Tracy.26 on both local installs and all is functioning well. I appreciate your time and help!1 point
-
Hey @rick - sorry you've hard a bad run with Tracy here. 1) I believe the issue with MarkupRSSLoad to be a bug in that module. Replace this line: https://github.com/ryancramerdesign/MarkupLoadRSS/blob/16e735b9ccc015eb36814689f862c007bff935a9/MarkupLoadRSS.module#L207 with: protected $items = array(); and this function: https://github.com/ryancramerdesign/MarkupLoadRSS/blob/16e735b9ccc015eb36814689f862c007bff935a9/MarkupLoadRSS.module#L428-L430 with: public function getIterator() { return new ArrayObject($this->items); } If that works and you find the module still works as expected, perhaps you could post an issue for Ryan on that module's github page. 2) As for the snippet name field in the Console panel - that is fixed in the latest version just committed. 3) I am getting a horizontal scrollbar in the Console panel here. Maybe there is some specific I am not doing to reproduce - can you provide more details? 4) I have seen the "Failed to init module: TracyDebugger - Tracy\Debugger::dispatch()" error a few times - it can happen when some error is output to the browser before Tracy is called. I am keeping my eye on this to see if it's something that can be fixed, but not sure it can. Let me know if you continue to see it on a regular basis and if something specific triggers it. 5) I can select text from the results pane, but maybe I just fixed that at the same time I fixed the snippet name focus issue. Let me know if you still have problems with this.1 point
-
@szabesz I will try this tomorrow. I remember I've used this method before for a PageTableExtended and it worked. Should work with CKEditor too. Thank you.1 point
-
@Christophe count() warning is coming from php 7.2, but you won't get this warning if you upgrade to the latest dev and you can keep php 7.2. Not sure why you get array to string conversion notice...1 point
-
Not quite sure how a save feature would work at the moment without a significant change to the interface. One possibility might be to store the last used options in a cookie and load those again if available. Would that suit your needs, or do you want something more permanent? If we can come up with an approach that works, I'd be happy to implement at some point though - any thoughts? The quickest option for you might be to simply clone the action into /site/templates/AdminActions and edit the defineOptions() method to hardcode the values you need. Or you could remove that method entirely and hardcode them into the executeAction() method so you wouldn't even get the option to change anything - this would be a good option if you have site editors using this - prevents them from breaking anything. Let me know if this works for your needs and if you need any help implementing.1 point
-
Downgrade php, install the latest dev or wait a week or so for the next master.1 point
-
I got my client to send me a Word file in Outline View of the questions and to indent right for every subsequent question, and put the 3 desired outcomes for each question in brackets. However for two of the questions which appear in succession, how you answer both of the questions, dictates the final 3 results rather than the 3 results being chosen for one option. What the javascript code does, is have a "mayberesults1" array and "mayberesults2" array for both questions, and it checks whether what 3 results are in "mayberesults2", whether they match what's in "mayberesults1". If they match, it is kept, if there is no match, one of the outcomes from "mayberesults1" is dropped and replaced with one from "mayberesults2". If you use Ctrl+U or Cloverleaf+U then you can see the javascript code for yourself at the bottom of the page. The "results" and "mayberesults1/2" are a HTML tag attribute added to the element you click on. What is inside the attribute are three page id's separated by a pipe symbol, (eg. 473|382|943) There is also a sitemap which makes use of the Sitemap module. Other modules used are Form Builder, Blog, Wire Mail SMTP, Padloper will be used in future once my client gets tutors involved on the website. Below are some screenshots of the website that you won't see on the current website. I prefer the old home page that had the photo on it as it is more graphical and I'm not a fan of minimalism, but the client went with his newest idea for a home page.1 point
-
Ryan, great work, as always, on the "owner" selection! Very cool stuff!! I'm eager to use it someday!1 point
-
Welcome to PW h365! I think you are looking for this module for creating/editing pages in a modal: https://modules.processwire.com/modules/admin-page-field-edit-links/ This module will set up a two-way relation: https://modules.processwire.com/modules/connect-page-fields/ (Not sure if you need it).1 point
-
Once upon a time the official PW Repo had way more stars on Github. But as @ryan values customer satisfaction over some abstract regalia like numbers stored in Github database (read the whole story here), they got kind of lost (actually not really lost - they are still present, but lost for the marketing purposes). I guess we could have something about one thousand now if this would be dealt differently . But that is old story. Personally I am visiting https://github.com/trending regularly to see what's going on in the open source world. And stars is what makes me see something. So I am 100% for this @adrian's initiative. And one forum post is not enough for success. At least placing Github star buttons all over the main site and forum and in the sticky top banner somewhere would help. Maybe we could ask @Pete to help here? As I understand from years being here @ryan is expecting ProcessWire to "market itself". But as community is part of PW, us marketing PW is kind of PW marketing itself anyways . So let's attract as much stars as we can to make the real star CMS get a primetime!1 point
-
I'd like to have more people see this as well. I'll let another moderator pin this if they see fit, but in the meantime we have 30 new stars since this post - much appreciated to everyone who took the time, but I am sure we can do much better! I promise I won't gratuitously bump this again1 point
-
BTW, if you use width() you get a cached image with name-200-0.jp. That means it has no height and therefor is not really an image. Using size() gets a correct image.1 point
-
I don't understand them either. Was just working based of the sample's. I googled and it does not seem to matter if you use one block or more. I did quick and dirty fix... looking like this. Note I always have atleast 2 schemes and therefor kinda hardcoded the brackets. There is also a ',' between 2 schemes. <?php $jsonld = $modules->get('MarkupJsonLDSchema'); ?> <script type="application/ld+json">[ <?php switch ($page->template) { case 'product': $options = array( 'logo' => $pages->get(1)->logo->size(200, 200), 'image' => $page->images->first()->size(200, 200) ); echo $jsonld->render('Product', $options) . ","; echo $jsonld->render('BreadcrumbList'); break; case 'categorieen': $options_c = array( 'logo' => $pages->get(1)->logo->size(200, 200), 'description' => $page->summary, 'image' => $pages->get(1092)->images->first()->size(200, 200) ); echo $jsonld->render('Product', $options_c) . ","; echo $jsonld->render('BreadcrumbList'); break; default: $options = array( 'logo' => $pages->get(1)->logo->size(200, 200), 'image' => $page->images->first()->size(200, 200) ); echo $jsonld->render('WebPage', $options) . ","; echo $jsonld->render('LocalBusiness') . ","; echo $jsonld->render('BreadcrumbList'); break; } ?> ]</script>1 point
-
Done, 318 Having almost finished my first ProcessWire project I can honestly say its been a pleasure. A site / service built out of the PW admin, custom modules etc (theres no frontend at all) to help manage a manufacturing setup. Has been a great fit and shows how flexible PW is. Even with learning about PW and not being the strongest PHP coder out there I've manage to get things done in a fraction of the time. Heres to PW, glass raised1 point
-
I rushed over the the PW repo, all geared up to star... oh, I already did that. Wish I could star it twice.1 point
-
done...in fact i put the star on many modules...but not on the main repo...1 point
-
Velotraum is a small German manufacturer, building rather costly, individually manufactured bicycles for both globetrotters and everyday bikers. We use RepeaterMatrix for long structured texts, and we use a lot of individual fields for metadata. We even built our own "preview" function for blog comments and included Textile light for blog comments, too. Have a look: velotraum.de1 point
-
Very, very alpha but working: https://github.com/BitPoet/ProcessMention1 point
-
Hello @abdus, congrats on your really great venture. Much appreciated. Is there any news about your newsletter module?1 point
-
Hi @mvdesign. So sorry that I could not respond earlier. I decided to make an introduction video for this module to help people that are trying to use it. But then, I never made a screencast video before, and on top of that, the last time I spoke english was 2011. So I had to take dozens of try-outs till I got something watchable. So here is the video. It shows how you would create/update pages with this module. The video is far from OK, so I will probably record another one after I get some feedback. Until then please refer to this video to learn about how the module works.1 point
-
Thank you @Werner Pilnei. I am excited because I like using ProcessWire . I try to do my best in introducing this module to the community. GraphQL is very young standard and is not mainstream yet. I intentionally started this thread in the Pub section, to make sure this is not a module support page but more a discussion on GraphQL (as this new api standard by facebook) and ProcessWire. To talk about how they could fit with each other, what ways we could use it, the new ways to use ProcessWire and so on. I personally never think about ProcessWire as a CMS. Though it is in fact a true CMS in its literal meaning, it is best at managing your content. But when people are introduced to ProcessWire it is presented as CMS and since the web is cursed by WordPress, people start using ProcessWire with wrong assumptions in their minds which result in negative impressions. I am generalizing here but when an average web developer hears CMS, she thinks it is a ready website with bunch of functionality baked in like tags, searching, blogging, commenting and so on. Those functionalities become the evaluation criteria and when they see that there is no tags in ProcessWire they count that as one of the things ProcessWire is missing. They don't understand that tags are something ProcessWire shouldn't have, because they are used to see tags in a CMS. I don't think that I am telling something new here. The community is well aware of this problem and the release of new site profile states that these problems are being addressed. But it doesn't have to be the only way. The modular architecture of ProcessWire allows us to extend it anyway we want, and this module is one of those attempts in presenting ProcessWire in different perspective. Even if it won't make much difference, I think we should keep trying and experimenting. Who knows what could come up along the way. I was only thinking about SPAs when creating this module. Never thought of PWA and usage with service workers like you approached it. Which is, by the way is great to hear. I hope there will be bunch of other ways people use it.1 point
-
I've had the go-ahead from @ESRCH and have now pushed this to the module repository. Repository Link1 point
-
Hi Hieu, first of all welcome to PW! When i saw all the tables created from PW i was afraid too, but there are some functionalities that maybe can help: 1) You can set some fields that load only when you access them. 2) You can set "$config->dbCache = true" for caching the queries. 3) I think the search is the major problem concerning the memory consumption because by default the PW need to search in every field and so in every DB table. But i made a module that store all the keywords extracted from those fields in only one, doing so PW search in only ONE table without any JOIN. 4) There is also the cache of the entire page. Look at this module and here I must say that currently i don't had the chance to do a site with a million records, it would be interesting if we can do a test with tons of pages ! USSliberty1 point