Leaderboard
Popular Content
Showing content with the highest reputation on 11/11/2017 in all areas
-
Edit: Because of the great response to this topic I wrote a guest blogpost: https://processwire.com/blog/posts/building-custom-admin-pages-with-process-modules/ One of the hidden treasures of processwire seems to be the creation of custom admin pages. Technically speaking those pages are ProcessModules - but i guess that's the reason why so many people out there seem to be afraid of building them... it sounds so hard! You've never created a module for ProcessWire? You have never created a plugin for any other CMS? You have no clue about OOP with all its classes, methods and properties? No problem! I'll show you how simple you can start: <?php class CustomAdminPage extends Process { public static function getModuleinfo() { return [ 'title' => 'Custom Admin Page Example', 'summary' => 'Minimalistic ProcessModule to show that nobody has to be afraid of building custom admin pages.', 'href' => 'https://processwire.com/talk/topic/17709-how-to-create-custom-admin-pages-aka-processmodules-yes-its-that-simple/', 'author' => 'Bernhard Baumrock, baumrock.com', 'version' => 1, // page that you want created to execute this module 'page' => [ 'name' => 'customadmin', // your page will be online at /youradmin/setup/customadmin/ 'parent' => 'setup', 'title' => 'Custom Admin Page Example' ], ]; } public function ___execute() { return 'This is the most simple Admin-Page you have ever seen :)'; } } Now save this file as CustomAdminPage.module and place it in your /site/modules folder. After a refresh it will show your module in the modules manager of your site where you can install it: After installation you already have your first very own admin page! Congratulations! Was not too hard, was it? It's as simple as that! Now lets add some more custom HTML. And to show you another nice feature we will add this code to a separate method called executeDemo(). And because everything is so simple we will also add some javascript to this page public function ___executeDemo() { $out = ''; $out .= '<h1>H1 has some special css styling in the admin, thats why it seems to have no effect</h1>'; $out .= '<h2>H2 looks different ;)</h2>'; $out .= '<h3>...and so does H3</h3>'; $out .= '<button onclick="myFunction()">Click me</button>'; $out .= '<script>function myFunction() { alert("this is a demo javascript"); }</script>'; return $out; return ''; } Now thanks to ProcessWire-magic your page will already have its own URL: Just append /demo to your url and see what you get: And of course don't forget to click the button Ok, now that code looks a bit hacky, right? Inputfields and especially InputfieldMarkup for the win! We add another method with some advanced code. To use inputfields we need a form that holds all those inputfields and that makes it possible to handle user input lateron. See somas great tutorial about forms here for a quickstart and more details: public function ___executeAdvanced() { $out = '<h2>A more complex Example</h2>'; $form = wire()->modules->get('InputfieldForm'); $field = wire()->modules->get('InputfieldMarkup'); $field->label = 'Markup Test 1'; $field->value = '<h1>h1</h1><h2>h2</h2><h3>h3</h3><h4>h4</h4>'; $form->add($field); $out .= $form->render(); return $out; } Ok, it get's boring Let's do something more fun and add a chart in a second field and change the fields to 50% screen width (I'm sure you know that already from the GUI template editor)! public function ___executeAdvanced() { $out = '<h2>A more complex Example</h2>'; $form = wire()->modules->get('InputfieldForm'); $field = wire()->modules->get('InputfieldMarkup'); $field->label = 'Markup Test 1'; $field->value = '<h1>h1</h1><h2>h2</h2><h3>h3</h3><h4>h4</h4>'; $field->columnWidth = 50; $form->add($field); $field = wire()->modules->get('InputfieldMarkup'); $field->label = 'Chart Sample'; $field->value = '$chart'; //$field->notes = 'Example code taken from here: http://www.chartjs.org/docs/latest/getting-started/usage.html'; $field->columnWidth = 50; $form->add($field); $out .= $form->render(); return $out; } OK, we are almost there... we only need to add the chart library! To keep everything clean we will put the code for the chart in another method. We will make that method PRIVATE to add some security. Our new Method: private function renderChart() { // prepare chart code wire()->config->scripts->add('https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.1.3/Chart.min.js'); ob_start(); ?> <canvas id="myChart"></canvas> <script> var ctx = document.getElementById("myChart"); var myChart = new Chart(ctx, { type: 'bar', data: { labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"], datasets: [{ label: '# of Votes', data: [12, 19, 3, 5, 2, 3], backgroundColor: [ 'rgba(255, 99, 132, 0.2)', 'rgba(54, 162, 235, 0.2)', 'rgba(255, 206, 86, 0.2)', 'rgba(75, 192, 192, 0.2)', 'rgba(153, 102, 255, 0.2)', 'rgba(255, 159, 64, 0.2)' ], borderColor: [ 'rgba(255,99,132,1)', 'rgba(54, 162, 235, 1)', 'rgba(255, 206, 86, 1)', 'rgba(75, 192, 192, 1)', 'rgba(153, 102, 255, 1)', 'rgba(255, 159, 64, 1)' ], borderWidth: 1 }] }, options: { scales: { yAxes: [{ ticks: { beginAtZero:true } }] } } }); </script> <?php return ob_get_clean(); } Now we just need to call $this->renderChart() in the right place! Here is the complete Module: <?php class CustomAdminPage extends Process { public static function getModuleinfo() { return [ 'title' => 'Custom Admin Page Example', 'summary' => 'Minimalistic ProcessModule to show that nobody has to be afraid of building custom admin pages.', 'href' => 'https://processwire.com/talk/topic/17709-how-to-create-custom-admin-pages-aka-processmodules-yes-its-that-simple/', 'author' => 'Bernhard Baumrock, baumrock.com', 'version' => 1, // page that you want created to execute this module 'page' => [ 'name' => 'customadmin', // your page will be online at /youradmin/setup/customadmin/ 'parent' => 'setup', 'title' => 'Custom Admin Page Example' ], ]; } public function ___execute() { return 'This is the most simple Admin-Page you have ever seen :)'; } public function ___executeDemo() { $out = ''; $out .= '<h1>H1 has some special css styling in the admin, thats why it seems to have no effect</h1>'; $out .= '<h2>H2 looks different ;)</h2>'; $out .= '<h3>...and so does H3</h3>'; $out .= '<button onclick="myFunction()">Click me</button>'; $out .= '<script>function myFunction() { alert("this is a demo javascript"); }</script>'; return $out; return ''; } public function ___executeAdvanced() { $out = '<h2>A more complex Example</h2>'; $form = wire()->modules->get('InputfieldForm'); $field = wire()->modules->get('InputfieldMarkup'); $field->label = 'Markup Test 1'; $field->value = '<h1>h1</h1><h2>h2</h2><h3>h3</h3><h4>h4</h4>'; $field->columnWidth = 50; $form->add($field); $field = wire()->modules->get('InputfieldMarkup'); $field->label = 'Chart Sample'; $field->value = $this->renderChart(); $field->notes = 'Example code taken from here: http://www.chartjs.org/docs/latest/getting-started/usage.html'; $field->columnWidth = 50; $form->add($field); $out .= $form->render(); return $out; } private function renderChart() { // prepare chart code wire()->config->scripts->add('https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.1.3/Chart.min.js'); ob_start(); ?> <canvas id="myChart"></canvas> <script> var ctx = document.getElementById("myChart"); var myChart = new Chart(ctx, { type: 'bar', data: { labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"], datasets: [{ label: '# of Votes', data: [12, 19, 3, 5, 2, 3], backgroundColor: [ 'rgba(255, 99, 132, 0.2)', 'rgba(54, 162, 235, 0.2)', 'rgba(255, 206, 86, 0.2)', 'rgba(75, 192, 192, 0.2)', 'rgba(153, 102, 255, 0.2)', 'rgba(255, 159, 64, 0.2)' ], borderColor: [ 'rgba(255,99,132,1)', 'rgba(54, 162, 235, 1)', 'rgba(255, 206, 86, 1)', 'rgba(75, 192, 192, 1)', 'rgba(153, 102, 255, 1)', 'rgba(255, 159, 64, 1)' ], borderWidth: 1 }] }, options: { scales: { yAxes: [{ ticks: { beginAtZero:true } }] } } }); </script> <?php return ob_get_clean(); } } I hope you enjoyed reading this and it will open up many new possibilities for you! Updates: permissions: https://processwire.com/talk/topic/17709-how-to-create-custom-admin-pages-aka-processmodules-yes-its-that-simple/?do=findComment&comment=174746 tutorial on file uploads: https://processwire.com/talk/topic/17709-how-to-create-custom-admin-pages-aka-processmodules-yes-its-that-simple/?do=findComment&comment=185261 snippet how to use NavJSON: https://processwire.com/talk/topic/17709-how-to-create-custom-admin-pages-aka-processmodules-yes-its-that-simple/?do=findComment&comment=2164126 points
-
I'm hoping to release it in alpha early next year. It will come as a site profile which has a starter theme and everything.6 points
-
Kind of pointing out the obvious here, but that could be asking for trouble. A number of modules (including core ones, such as Repeaters) perform cleanup etc. with hooks. Unless you're really careful, you could easily leave a ton of orphaned data behind with this method.4 points
-
I'm currently in a full on switch away from php to elixir, but I'd still not say php is generally bad. For websites with none or some business logic involved it's certainly good enough and has lot's of tools/people for moving quickly in that space. But I'd no longer use it for anything more complex or custom made. The things, which drew me to switch over where actually not the language per se, but rather the environment: Elixir is a compiled language, which is way more performant than php. It's damn easy to do concurrent computation harnessing the power of multi-core cpus, which is just a pain in php (react-php or threading). Long running computations are hard to do in a php world, where 98% of the time each request starts/terminates the whole world. Sure one can start a php script in the cli, but it's the communication which is the annoying part. Websockets or http2 streaming are the things in the web world, which are only possible with long running processes. Elixir does come with a own testing framework within the language. Code documentation is first-class citizen and the community/package manager push people actively to use it e.g. with automatic documentation hosting for packages. So there's a kinda canonical place for documentation and hell can it be good for the more popular packages. In PHP there's not even real consensus about using composer. And the final point is that a functional language with immutable data does now fit my mind way better than oop and shared memory.4 points
-
This week's version adds the new Uikit 3 admin theme to the core! Plus we've got some nice upgrades our built-in Password field. https://processwire.com/blog/posts/processwire-3.0.83-core-updates/3 points
-
Your code copied from the GitHub issue: $options = wirecommerce_get_all_variations($page); $variations = $page->wirecommerce_variations; // Detect added $added = 0; foreach($options as $option) { if(!$variations->has("wirecommerce_variation_value='$option'")) { $new_option = $variations->getNewItem(); $new_option->wirecommerce_variation_value = $option; $new_option->save(); $added++; } } if($added > 0) $this->message("$added variations added."); The code example for adding a repeater item from the documentation: $building = $page->buildings->getNew(); $building->title = 'One Atlantic Center'; $building->feet_high = 880; $building->num_floors = 50; $building->year_built = 1997; $building->save(); $page->buildings->add($building); $page->save(); So I think your code should be: $options = wirecommerce_get_all_variations($page); $variations = $page->wirecommerce_variations; // Detect added $added = 0; foreach($options as $option) { if(!$variations->has("wirecommerce_variation_value='$option'")) { $new_option = $variations->getNew(); // Or getNewItem(), they are the same thing $new_option->wirecommerce_variation_value = $option; $new_option->save(); $variations->add($new_option); $added++; } } $page->save(); if($added > 0) $this->message("$added variations added.");3 points
-
Thanks @Samc and @maxf5, you gave me an idea about the future of my AdminOnSteroids module, rewriting it as an admin theme. This has been come up earlier too but there was no Uikit theme then, now it's perhaps more easy to do this.3 points
-
It’s certainly a different language, but besides any language/runtime based differences it’s actually not to different to use phoenix compared to using e.g. laravel in php. It’s got routers, controllers, views and behind that some business logic. I also noticed that the functional nature of the language does actually make the latter easier to understand than some oop classes and I found learning a functional (/actor based) language actually made me understand some principles behind oop quite a bit better. Anything which you’d use laravel or similar frameworks for in the php world or rails in ruby. So custom web-applications, json api's, applications which often require things to run longer than the few second web requests. So kinda anything which is not just a website (cms) with a handful of forms and not full on e-commerce. I'd also do websites in elixir if they're supposed to handle a really big number of users / spikes of users. Some early adopters of elixir could reduce their number of servers to a quarter after switching to elixir (most from ruby/rails). For the thing's I'll be using elixir for the client's won't really care. We're not doing very many marketing sites, where the client might want to edit texts or something. We run a SaaS product, where any client interaction is on the frontend anyways and also some web-applications, which we fully manage for our customers. Those also have the most interaction with people using the application on it's frontend and very few to no interaction with the client themselves.3 points
-
I've just installed 3.0.83, but what happened to the sidebar option? The options I have now are: Masthead only has no sidebar and the other options have the entire page tree in a sidebar. So I go to 'Navigation': And the options are to either click the logo to go back to default tree list page, or click logo for an offcanvas menu, which is just weird. Who would expect a menu when clicking on a logo? I would have liked this sidebar menu positioned to the left and kept there, with the masthead doing a disappearing act. Or having a dumbed down masthead when there is a sidebar present. Modern monitors have a lot of width, why used a masthead and cram everything in vertically? I feel this makes my editing experience worse than using the older reno theme. The design just feels so unbalanced. You can probably tell I'm not a fan of masthead navigation at all, but of course this is all personal opinion. These are the best looking admins IMO so I need to look into how to create a custom admin theme in order to emulate something like these. Of these three, craft is my favourite. I've used it to make a site before and it was extremely nice to use. It's obviously possible with the new uikit so need to find some info on making my own theme. I see in the readme: "To install a new admin theme, you would place it in /site/templates-admin/ and leave the one that is in /wire/templates-admin/." ...so I guess that's my starting point. Looking at the current uikit admin module files though, I may be in a bit over my head here! Not sure whether you need to make a whole new module of just a '/site/templates-admin/' folder. Can't work out how the module AdminThemeUikit relates to the stuff in templates-admin folder.3 points
-
2 points
-
A little while ago, I began a complete rewrite of the module that was set to add additional features (like SASS and Stylus, for example). Unfortunately, I won’t have time to work on it as fast as I’d like. But, it’s still something I’d like to do.2 points
-
Can say that again! What sort of stuff are we talking about here?2 points
-
https://processwire.com/talk/topic/17707-php-in-2017-rasmus-lerdorf-wearedevelopers-conference-2017/ +1 Progress can be great, fiddling with new stuff is fun but acquiring new skill takes time – for me a lot of time – so I try to stick to well tested and proven tech. For example, when I was young and bold I used to upgrade Mac OS as soon as the new version came out. These days I wait at least for six months before I do it, in order to watch and learn. There are enough beta testers out there, I'm no longer one of them.2 points
-
Another question: Is PW a great peace of software? If yes, hmmm, - you know it's build in PHP. In short: there may be some better or less better programming languages regarding to use cases, and yes, there are also some points in PHP that are bad, like in other languages too. But all that doesn't take to much account in comparision with what a developer do with it. So, it depends on the developer to 90% and 10% on the programming language. just my 2 cents2 points
-
Client suddenly realised she needed a website in order to hand out her new business cards which had the website URL & email address, less than 2 weeks before her TED talk. Was given 1x logo, 1x photo, 1x phone screenshot of a paragraph of text and told she'd like to see the 'wings flying'. TED talk event 2 Nov 2017: https://www.ted.com/tedx/events/23988 End result landing page: https://beautifulhumanway.com/ Hopefully site will grow to show more of this amazing woman and her achievements Using PW 3.0.79 with delayed output and regions Modules (many thanks to @ryan and his pro modules): Profields: Functional fields Profields: Repeater Matrix ProCache FormBuilder MarkupSEO MarkupJson-LDSchema MarkupSimpleNavigation MarkupSrcSet EmailObfuscator and for a short time during development, PageProtector2 points
-
Just checked in a first beta version of a new module I'm working on. Feel free to test out and see what's up with it. Pollino (beta) A simple poll module for ProcessWire This module makes it simple to setup polls for your website. It is based on a simple page setup to create the polls. So each poll is a page, and its children are the answers. Pollino will create the templates and a PollinoPolls page in the root to start with. You can add fields to the templates as you wish and later use hooks to modify the output of the poll. This can be useful, for example, to use images as options or just some custom markup etc. It provides some API to render the poll form and the result. These methods are hookable and it's easy to customize the output if needed. It can be rendered on any page and even multiple on the same page. Pollino takes care of saving the votes and preventing multiple votes. It comes with some configuration settings to choose what method to use to prevent from multiple votings: using cookie and an expire time or by IP and optionally also the UserAgent with and expire time or by logged in User Pollino isn't 100% plug'n'play but it provides a solid foundation and comes with some premade theme and output for you to start. It takes care of the boring stuff and lets you concentrate on the front-end stuff and styling. That's what matters after all. It does support multilanguage, as all strings are translatable in the module. Also since it's using simple pages and templates you're free to add or change fields to make its output multilanguage without much hassle. ----- Read more and download https://github.com/somatonic/Pollino Online Demo I setup a little demo here to see using https://lightning.pw http://titanium-x77.lightningpw.com/ Have fun.1 point
-
Tasker is a module to handle and execute long-running jobs in Processwire. It provides a simple API to create tasks (stored as PW pages), to set and query their state (Active, Waiting, Suspended etc.), and to execute them via Cron, LazyCron or HTTP calls. Creating a task $task = wire('modules')->Tasker->createTask($class, $method, $page, 'Task title', $arguments); where $class and $method specify the function that performs the job, $page is the task's parent page and $arguments provide optional configuration for the task. Executing a task You need to activate a task first wire('modules')->Tasker->activateTask($task); then Tasker will automatically execute it using one of its schedulers: Unix cron, LazyCron or TaskerAdmin's REST API + JS client. Getting the job done Your method that performs the task looks like public function longTask($page, &$taskData, $params) { ... } where $taskData is a persistent storage and $params are run-time options for the task. Monitoring progress, management The TaskerAdmin module provides a Javascript-based front-end to list tasks, to change their state and to monitor their progress (using a JQuery progressbar and a debug log area). It also allows the on-line execution of tasks using periodic HTTP calls performed by Javascript. Monitoring task progress (and log messages if debug mode is active) Task data and log Detailed info (setup, task dependencies, time limits, REST API etc.) and examples can be found on GitHub. This is my first public PW module. I'm sure it needs improvement1 point
-
1 point
-
+1 @Tom. When you reach the point of needing testers, do not hesitate to ask1 point
-
While you are at it, I also recommend https://processwire.com/api/ref/input/ over isset($_POST["submit"] etc... After all, we have an API at our disposal1 point
-
1 point
-
ok sure - thanks for using and testing these; another small change may be needed once it is tested with the latest version of AdminThemeUIKit, based on some info in the blog post.1 point
-
Hi @webhoes ... I changed the code using sanitizer and downloaded $ _POST using input->post ... I added also at the top of the namespace Processwire and <form action ='./' ... Code below for me to work: <?php namespace Processwire; ?> <div id='content-body' class="page-b" pw-append> <?php if (isset($_POST["submit"])) { $result = '<div class="alert alert-success">Form submitted</div>'; if (!$_POST['name']) { $error = "<br />Vul je naam in"; } if (!$_POST['email']) { $error .= "<br />Vul je emailaddress in"; } if (!$_POST['comment']) { $error .= "<br />Vul een opmerking in"; } if ($_POST ['email'] != "" AND !filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) { $error .= "<br />Gebruik een geldig emailaddress"; } if (isset($error)) { $result = '<div class="alert alert-danger"><strong>Da hej mangs, er is iets niet goed ingevuld:</strong> ' . $error . '</div>'; } else { // MAIL NEW https://processwire.com/api/ref/mail/new/ // SANITIZER https://processwire.com/api/variables/sanitizer/ // INPUT https://processwire.com/api/variables/input/ // YOUR MAIL $your_email = 'yormail@gmail.com'; // OR GET FROM CONTACT PAGE // $your_email = $sanitizer->email($page->email); // LIKE strip_tags($_POST['email']) // SANITIZE MESSAGE $email = $sanitizer->email($input->post->email); // LIKE strip_tags($_POST['email']) $name = $sanitizer->text($input->post->name); // LIKE trip_tags($_POST['name']) $comment = $sanitizer->text($input->post->comment); // LIKE trip_tags($_POST['comment']) $message = $mail->new(); $message->to($your_email)->from($email); $message->subject('Mail Subject') ->body('Name: ' . $name . "\r\n" . 'Email: ' . $email . "\r\n" . 'Comment: ' . $comment) ->bodyHTML('Name: ' . $name . "\r\n" . 'Email: ' . $email . "\r\n" . 'Comment: ' . $comment); $numSent = $message->send(); $result = '<div class="alert alert-success"><strong>Wysłałeś wiadomość.</strong></div>'; } echo $result; } ?> <!-- Button trigger modal --> <!-- Modal --> <div class="modal fade slide left" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span> </button> <p class="modal-title" id="myModalLabel">Contact met Webhoes!</p> </div> <div class="modal-body"> <p class="lead">Laat wat van je horen!</p> <form action='./' method="post" id="myForm"> <div class="form-group"> <label for="name">Naam:</label> <input type="text" name="name" id="name" class="form-control" placeholder="Name" value="" required/> </div> <div class="form-group"> <label for="email">Email:</label> <input type="email" name="email" id="email" class="form-control" placeholder="Email" value="" required/> </div> <div class="form-group"> <label for="comment">Opmerking:</label> <textarea class="form-control" id="comment" name="comment" required></textarea> </div> <input type="submit" name="submit" class="btn btn-success btn-lg" value="Verstuur"> </form> </div> <div class="modal-footer"> <button type="button" class="btn btn-error" data-dismiss="modal">Annuleren</button> </div> </div> </div> </div> </div>1 point
-
1 point
-
Depends on a) your point of view and b) what you're doing with it. While I might recommend something else for a programmer just starting out, that's mainly because PHP is a major abstraction layer and most PHP devs never get a proper idea about all the stuff that goes on behind the scenes. Also if you're doing something requiring a specific set of tools – such as working with big data and statistics – you'll probably find a language that is better suited for that particular task. That being said, PHP is a decent language if you're primarily working on the web. It's rich in features, well supported, properly maintained, very widely spread, and so on and so forth. Additionally many online "this is why PHP sucks" lists focus on issues found from early PHP 5.x releases – or, better yet, PHP 4. These days there are a ton of things going for PHP, and not that many going against it. (Much of this could also be said about WordPress, but... let's just not go there. It's not the same thing.) ... and, like @horst pointed out, in many cases the language isn't the most important thing to consider. You can do a lot with PHP, and the good thing is that (if you're doing something it's suited for) you can usually get it done fast. Surely there are languages that have technical advantages over PHP, but those usually apply to either specific situations or somewhat extreme cases, such as "I'm running Facebook"1 point
-
There was a recent post somewhere in the forum of a video of Rasmus briefly explaining (sort-of) why PHP was "bad" at the beginning, and how far PHP has come in 2017 with PHP 7+. I personally love PHP despite its reputation because it's almost as old as the internet itself, and has endured with it. While that's not directly a measure of being a good programming language, it's a measure of stability that means anything I learn doing in PHP will be useful for years to come, unlike how some modern frameworks/language/libraries come and go. And like horst said, there are always good and bad coders regardless of the language. Just like how they hail Python as a good programming language, but I've seen some people write some horrible stuff in it, ProcessWire is probably one of the best things I've come across that's written in a "bad" programming language.1 point
-
Thanks @bernhard! This needs to be on the front page1 point
-
1 point
-
http://artistblacksmith.org.uk/ Portfolio site for Blacksmith working in Gloucesterhire, UK. Design and build. http://stellardebating.nicegrp.com/ Not yet live site for school debating courses across UK. Custom payment system for booking and managing courses and teachers at multiple schools. Design, logo design, build. Illustrtion by http://torritaylored.com/ http://store.benbyford.com/ Not yet live store fo premium modules. Started working on this and got lots of client work so haven't got back to it yet to finish and release modules. Fingers crossed will have the time soon. Design and build.1 point
-
Very nicely done! Only thing I would add is <noscript>. By default I have all scripts off until I am certain of the site I visit, so an empty page is initially displayed with no indication of js/cookie requirements.1 point
-
1 point
-
Mpdf has a pagebreak method and you can also add CSS avoid-pagebreak to prevent two blocks from being split into multiple pages. I'm using [pagebreak] tags in ckeditor to give my clients the possibility of adding breaks1 point
-
1 point
-
I've always thought that the "template engines make it easy for non-programmers" was a myth, as it really just comes down to semantics and what characters you think are easier to type. But the reality is that template engines give you something like a jailed environment, and that increases the comfort level of some people. The prospect of limitation becomes an asset in that context. It means it's going to be harder to break things, and there is going to be a ceiling on what can be learned. I don't ever want to be in a "jailed" environment with a low ceiling, but also kind of understand the appeal to someone that may have never stepped beyond the likes of EE (which has come crossover with our audience). As we work to broaden the audience for ProcessWire, an alternate template engine for those that desire limitation here may help us to capture new audiences. There is also just the word "PHP", which scares off some, regardless of what is real or what we do. ProcessWire is always going to be an PHP API-driven environment at it's core, but I'm not opposed to adding on template engine(s) as an option for those that want them, in the future. It's something that's not at the top of the list on priorities, but it is something we'd like to eventually offer. They are a little more tricky to implement in PW vs. a system that is built purely for tags. The reason for this is that ProcessWire templates are executed directly by PHP rather than by ProcessWire itself. ProcessWire just hands off some API variables to the templates and lets PHP and the template execute natively. It's nice, fast and efficient. (Other systems like EE actually execute PHP code in templates using eval(); which is slow and inefficient… they hope you won't be using much PHP). The way we'd have to implement a template engine in ProcessWire, while still retaining the speed, is with compiled templates. The template using template-tags would have to be compiled to a native PHP template before it could be executed. Lots of these new template engines are designed to work that way anyway, so not a big deal, but just outlining how it would be done.1 point