Leaderboard
Popular Content
Showing content with the highest reputation on 12/23/2015 in all areas
-
This is a reworked website of Imre Baksa, a Hungarian actor and director. His former (static) website was also made by me back in around 2009. He asked me to do a redesign but I decided to involve ProcessWire to make content management easier. http://baksaimre.hu/ Lesson 1: templates - no thanks It is tempting to use ready-made templates for a project because most of the work is done, there's some tweaking here and there and mission completed. Okay, this is the theory. I have to admit that I have never found a suitable template/theme for my projects, but being a web designer this is the way it should be, I guess. This time I found one that looked fine: Landed from HTML5 UP. In fact there was a self-made design for the site and this template looked 90% similar, so it really seemed to be an easy task to bring it into ProcessWire. Soon turned out that some of the fancy features of the template required advanced JavaScript knowledge. That means, I had to dive into it and learn how it worked. I did so and I was able to tweak things then, but I wasn't satisfied with the outcome. So I went back to the drawing board and dropped the template. This experience reassured that starting from scratch would have been a better choice on the long run. The good thing is that I learned some new things that will come in handy in the future. Lesson 2: template engines - Latte is still my best friend I was using Nette's templating engine, Latte in previous projects and I liked it a lot. It is similar to Twig, which is more widespread, so I decided to try that for learning purposes. This sounded like an easy journey because ProcessWire supports Twig through modules. However, at the end of the day I sort of regretted that. Latte has some small helper features that makes templating easier, and these differences made up a huge difference. Maybe I'm getting old but I felt Twig more of a nuissance after Latte. Finally I got rid of Twig and I guess I will never look back I will keep using Latte in the future even if I have to bootstrap it manually. Lesson 3: frontend development is hard Having ProcessWire at hand, backend is the minor part in web development, at least in smaller projects. I've used only a few jQuery plugins but making them work together nicely was a real challenge. At the end I had to make a compromise by removing SmoothScroll because it didn't work well with JScrollPane. Even so, I had tough times to eliminate content "jumps" when a lightbox is opened, and to make JScrollPane work the way I wanted to work. Making the whole thing responsive added another level of complexity as features needed to be destroyed/reinitialized on different screen sizes. I like to polish things as much as possible but the current state of the web makes it almost impossible to reach certain level of perfection. Moduling up This was the project where I felt that a link checker button would be helpful so started to develop InputfieldURLChecker. I use this in a few projects and it does the job nicely. My other pet PW module FEEL also got some polish during site development. For site-wide settings I used MultiValueTextformatter so I didn't need to create a field for every setting, just one for all. Other modules used: SEO: must have! Admin Template Columns for better admin layout Page List Image Label: to add featured image to the list of pages in the admin Pageimage Remove Variations: remove unused image variations Forms: one step closer to simpler form processing For the contact form I used Nette Forms, because it is so easy to add forms to the site with it, with frontend & backend validation in one go. Processing them still needs some sweat, but this time I finally put together a class to make this easier. Surely it still needs some iterations but it's a huge help: it takes only a few parameters to save submissions as Pages or send email to the admin or the visitor. For email templates I also used Latte (what else? ). I also created a "json_storage" field to store submission. The beauty is that while it's only one field (a textarea), in the admin it is displayed as formatted key-value pairs using a hook. Summary The site looks fresh and the year knob on the left makes it fun to use. Content management is easy as 1-2-3 thanks to ProcessWire, even if it's mostly me who will deal with the updates. While it's not visible on the site, in the background there are many improvements to my development tools and workflow that will be of huge help in the future.9 points
-
hey kixe, also the best wishes to you would you mind doing a short screencast so that we do not have to install it, create the fields etc... http://www.cockos.com/licecap/ is a cool small tool to do that in seconds on win/osx. it creates a GIF so you don't even have to upload it to youtube or the like. just record and post it directly here in the forum. thank you for sharing your module5 points
-
I was looking for a more comfortable solution to add pages from a PageField Select. I ended up in this small module. Which is quite simple, but very useful. I created a PageField and another field of Type AddPage (requires FieldtypePageTable) with same settings for template and parent. Now I can easily add the page in the Modal. If you need it, take it as a Christmas Present from my side. (no christmas smiley available ... ) Dear Ryan, dear community, I wish you all the best for christmas and the upcoming year. <?php /** * Excellent side dish to Fieldtype Page. Doesn't store any data. Provides comfortable page creation. * * made by kixe (Christoph Thelen) 22.12.15 * Licensed under GNU/GPL v3 * * ProcessWire 2.x * Copyright (C) 2015 by Ryan Cramer * Licensed under GNU/GPL v2, see LICENSE.TXT * * http://processwire.com * * */ class FieldtypeAddPage extends FieldtypePageTable implements Module { public static function getModuleInfo() { return array( 'title' => 'Fieldtype Add Page', 'version' => 100, 'summary' => 'Excellent side dish to Fieldtype Page. Doesn\'t store any data. Provides comfortable page creation.', 'author' => 'kixe', 'requires' => 'FieldtypePageTable' ); } public function init() { // prevent data storage $this->addHookAfter('FieldtypePageTable::sleepValue', function($event) { $event->return = array(); }); // unneeded configuration fields can be removed $this->addHookAfter('FieldtypePageTable::getConfigInputfields', function($event) { $inputfields = $event->return; $page_behavior = $inputfields->children()->get(2); $removes = array('sortfields','trashOnDelete','unpubOnTrash','unpubOnUnpub',$page_behavior); foreach ($removes as $remove) $inputfields->remove($remove); $event->return = $inputfields; }); } } Screencast3 points
-
Hey guys, this upgrade now appears on PW 3.0 (devns) branch. If you are using the ~= operator in a search, like "title~=disability act" it now asks MySQL for the ft_min_word_len (per @LostKobrakai's suggestion above). If any word length falls under that threshold, it delegates that word to a separate REGEXP command in MySQL that matches whole words. This is actually an improvement over the code I mentioned earlier because the previous code that converts it to use a "%=" for short words could match things like "disability fact" or "react to this disability" etc. Whereas the new core addition will only match whole words in the same way that the MySQL index would, meaning the field would only match if it contained the exact words "disability" AND "act" somewhere in the field, and not some word that happens to contain the partial word "act". To take it further, it also now uses this technique to match stopwords that MySQL doesn't full-text index. Previously it would just exclude them from the search since the presence of a stop word would prevent a search from matching. Now you can perform searches that include those stop words and match them.3 points
-
This is actually one area that I think may be too broad in scope for a tuts plus tutorial. That's because PW doesn't generate markup nor does it have an official front-end forms API, so it would be much more of an HTML and PHP tutorial than a ProcessWire one. Keep in mind the guides there are to demonstrate the simplest possible cases. We use concatenation because it's really simple and easy (and what I prefer), but that doesn't mean it's a requirement of delayed output. You could just as easily use arrays, output buffering, wireTemplateFile(), wireIncludeFile(), etc. The point is to demonstrate delaying your output until the appendTemplateFile inclusion. That's what delayed output is. ProcessWire's API is a PHP API, so I find it a lot simpler to stay in that API rather than constantly jumping in and out of HTML. After all, it requires <?php ?> tags to jump in and out of PHP from HTML, but does not require anything but quotes or heredocs to use HTML within PHP. PHP alternative syntax is handy for large blocks of conditional HTML. But for most markup generation situations I don't recommend it unless you personally find it more readable. For many of us, the additional verbosity and constant jumping in/out of PHP & HTML make it difficult to read and follow, but this is purely a preference thing as I don't think it matters to the end result at all. When it comes to writing tutorials and/or documentation, I try to communicate the concepts in the simplest/shortest way possible so that focus remains on the concept and API calls that we are trying to teach. That doesn't mean you have to do the same, or that doing it differently means you aren't adhering to the concept. Whether you are using alternative syntax or not matters little to the concept. Though since you are in "direct output" when outside of a php tag, it does make your job a little harder for delayed output. But you can amend that by isolating your markup and rendering it with wireTemplateFile(). Fantastic! @benbyf and @isellsoap just let me know if there's anything I can do to assist. Thank you for writing tutorials for PW!3 points
-
hi everyone, i'm happy to share my first little module that could have broader use... use at your own risk! i'm quite new to module development Usage Just install the module and place your preview images in the folder /site/templates/TemplatePreviewImages filename = template-name.png Github https://github.com/BernhardBaumrock/TemplatePreviewImages Notes jquery image picker used in this module (MIT license): http://rvera.github.io/image-picker/ Room for improvement / roadmap: Images are resized via CSS (height: 200px) Images could be placed via masonry or the like create image-field to upload preview images directly to the template looking forward to hearing your feedback ps: is it intentional that i am only allowed to choose from 2 templates when adding the page and have more options available when editing the template settings of the page like you can see in the video? i'm wondering why this should be like this?!2 points
-
AvbMarkupHtml - HTML tag manager for ProcessWire This module allow you to use less HTML elements inside your PHP code ! Added hook for page. For make quick markup calls : $page->html(); Github : https://github.com/trk/AvbMarkupHtml Example usage and all methods : // All Configs $config = array( 'quote' => '"', 'indent_with' => ' ', 'tags_without_indentation' => 'link,img,meta', 'WirePage' => null, 'tag' => null, 'tagSelfClosed' => null, 'tagNoClose' => null, 'tagCustom' => null, 'tagStart' => '', 'tagEnd' => '', 'prepend' => '', 'prepends' => '', 'attributes' => array(), 'dataAttributes' => array(), 'label' => '', 'note' => '', 'text' => '', 'texts' => array(), 'hasTexts' => false, 'field' => '', 'field_value' => '', 'fields' => array(), 'hasFields' => false, 'child' => '', 'children' => '', 'append' => '', 'appends' => '' ); // All Methods $page->html(array('key', 'value')) // $config ->tag('string', $args=array())) // tag name, $args=content,tag-options => "/>" self closed, "->" no close, "=>" special tag ->setQuote('double or single quote') // default is : " ->addClass('string') // Element class name ->id('string') // Element id ->attr('key', 'value') // output : key='value' ->attributes(array('key', 'value')) // attributes ->data('key', 'value') // output : data-key='value' ->dataAttributes(array('key', 'value')) // data-attributes, this will add auto data- prefix to your attribute ->prepend('string') // a string value ->prepends(array('values')) // array for values ->text('string') // text for inner tag ->field('field_name', 'page_object') // Field name and page object ->texts(array()) // enter text array | array('Text 1', 'Text 2') ->fields(array(), 'page_object') // enter field names as array, a page | array('title', 'body') ->note('field_name', 'page') // enter a field name, a page ->label('field_name', 'page') // enter a field name, a page ->append('string') // a string value ->appends(array('values')) // array for values ->r(true|false) // Alis with ->render(); function ->render(true|false) // This will return result ->o(true|false) // Alias with ->output(); function ->output(true|false); // This will print result | default pretty print value is : false // #Example 1 : Working With ProcessWire $ul = html::ul()->addClass('list'); foreach($page->children as $p) { $ul->child( html::li() ->addClass('list-item') ->data('id', $p->id) ->child( html::a($p->title) ->addClass('list-item-link') ->attr('href', $p->url) ->data('id', $p->id)->r() )->r() ); } $ul->o(true); /* output : <ul class='list'> <li class='list-item' data-id='1057'> <a class='list-item-link' href='/en/villas/' data-id='1057'> Villas </a> </li> <li class='list-item' data-id='1001'> <a class='list-item-link' href='/en/location/' data-id='1001'> Location </a> </li> <li class='list-item' data-id='1090'> <a class='list-item-link' href='/en/guestbook/' data-id='1090'> Guestbook </a> </li> <li class='list-item' data-id='1055'> <a class='list-item-link' href='/en/contact/' data-id='1055'> Contact </a> </li> <li class='list-item' data-id='1005'> <a class='list-item-link' href='/en/site-map/' data-id='1005'> Site Map </a> </li> </ul> */ // #Example 2 html::div() ->addClass('container') ->addClass('container-center') ->attr('style', 'border: 1px solid #000;') ->data('id', $page->id) ->data('title', $page->title) ->child( html::h1($page->title) ->addClass('h1-title') ->r() ) ->child( html::div($page->body) ->addClass('container-inner') ->r() ) ->o($config->debug); /* Output <div class="container container-center" style="border: 1px solid #000;" data-id="Page id field data will come here" data-title="Page title field data will come here"> <h1 class="h1-title"> Page title field data will come here </h1> <div class="container-inner"> Page body field data will come here </div> </div> */ // #Example 3 : html::div("Hey !") ->addClass('container') ->addClass('container-center') ->id('centered-container') ->output(true); /* Output <div id='centered-container' class='container container-center'> Hey ! </div> */ // #Example 4 html::ul()->addClass('list')->children(array( html::li('Li element value 1')->addClass('list-item')->render(), html::li('Li element value 2')->addClass('list-item')->render(), html::li('Li element value 3')->addClass('list-item')->render(), html::li('Li element value 4')->addClass('list-item')->render(), html::li('Li element value 5')->addClass('list-item')->render() ))->output(true); /* Output <ul class='list'> <li class='list-item'> Li element value 1 </li> <li class='list-item'> Li element value 2 </li> <li class='list-item'> Li element value 3 </li> <li class='list-item'> Li element value 4 </li> <li class='list-item'> Li element value 5 </li> </ul> */ // #Example 5 $title = $page->html('title')->tag('h1')->addClass('h1-class')->render(); echo $title; // #Example 6 : This will directly print $page->html($page->title)->tag('h1')->addClass('h1-class')->output(); html::h1($page->title)->o(); // #Example 7 : Self Closed Tag $modules->AvbMarkupHtml->html()->tag('hr', array(null, '/>'))->output(); html::hr()->o(); // #Example 8 $page->html($page->title)->tag('h1')->addClass('my-h1-class')->output(); html::h1($page->title)->addClass('my-h1-class')->o(); // #Example 9 $page->html('title', $pages->get('/contact/'))->tag('h1')->addClass('my-h1-class')->output(); html::h1()->addClass('my-h1-class')->field('title', $pages->get('/contact/'))->o(); // #Example 10 $modules->AvbMarkupHtml->html()->tag('div')->addClass('container')->children(array( $page->html('title')->tag('h1')->addClass('my-title')->render(), $page->html('body')->tag('div')->addClass('my-body')->render() ))->output(); // #Example 11 | Multiple child, prepend, append $html = $page->html()->tag('div')->addClass('uk-container')->addClass('uk-container-center'); $html->prepend( $page->html()->tag('div')->text('Prepend #1 !')->render() ); $html->prepend( $page->html()->tag('div')->text('Prepend #2 !')->render() ); $html->child( $page->html()->tag('div')->text('Hey !')->render() ); $html->child( $page->html()->tag('div')->text('Foo !')->render() ); $html->child( $page->html()->tag('div')->text('Bar !')->render() ); $html->append( $page->html()->tag('div')->text('Append #1 !')->render() ); $html->append( $page->html()->tag('div')->text('Append #2 !')->render() ); $html->output(); // #Example 12 | Create A HTML page //-> Create Html Tag $html = $page->html()->tag('html')->attr('lang', 'en')->attr('dir', 'ltr'); //-> Create Head Tag $head = $page->html()->tag('head'); //-> Add TITLE inside HEAD tag $head->child( $page->html()->tag('title')->text('My Website')->render() ); //-> Put HEAD inside HTML Tag $html->child($head->render()); //-> Create BODY Tag $body = $page->html()->tag('body')->addClass($page->template); //-> Create DIV Tag $container = $page->html()->tag('div')->addClass('container'); $container->children(array( $page->html()->tag('h1')->addClass('h1-title')->text('H1 Title')->render(), $page->html()->tag('div')->addClass('body-content')->text('Body Content')->render() )); //-> Put DIV.container inside BODY Tag $body->child($container->render()); //-> Put BODY inside HTML Tag $html->child($body->render()); $html->output(true); // Pretty HTML output /* Output <html lang='en' dir='ltr'> <head> <title> My Website </title> </head> <body class='homepage'> <div class='container'> <h1 class='h1-title'> H1 Title </h1> <div class='body-content'> Body Content </div> </div> </body> </html> */ // #Example 13 Static Call Example $article = html::tag('article')->addClass('uk-article')->children(array( html::field('title')->tag('h1')->addClass('uk-article-title')->render(), html::tag('hr', array(null, '/>'))->addClass('uk-article-divider')->render(), html::field('body')->render() )); $article->output(true); /* Output <article class='uk-article'> <h1 class='uk-article-title'>Page Title</h1> <hr class='uk-article-divider' /> Body Content </article> */2 points
-
Here is the callout style for starting point: http://codepen.io/rolandtoth/pen/obzNom?editors=110/left/ To get the white border, two pseudo elements are used. The ":before" is for the border for the arrow. The "points" are only to show the original points, so that markers are positioned to point exactly to their position. Edit: semantic is using a rectangle rotated in 45 degrees for the arrow. Let me know if you think that would be better.2 points
-
I am a fan of the php alternative syntax as well, szabesz, to keep the focus on the final HTML rather than on the logic when inside of a template and not have to escape your markup. And if you use short tags like <? if($foo): ?> and <?= $foo ?>, ternary statements like <?= $foo ? 'myclass' : '' ?> and leave off unnecessary semi-colons, then I find this solution cleaner and more readable most of the time. Like Ryan said, if you use php output buffering directly or separate all of your markup into individual files and load them using the TemplateFile class, then you can still use the delayed output method with alternative syntax. Personally, however, I prefer setting all templates (in the template settings in the admin) to point to a single output file and then handle the rest with php logic, loading subfiles based on the name of the current template. Actually, I've developed an entire (H)MVC framework on our latest project, which hopefully I will be mature enough to release some time soon. All that to say you can do anything with ProcessWire!2 points
-
er314 sorry I think I misunderstood, as I thought you were suggesting we change the behavior of the existing $pages->get() method, or make it have front-end vs. back-end state (which isn't really possible since PW's API has no front-end/back-end knowledge, and the context of the API is neither). But I'm glad you started this topic because, like I said, I think you've identified a reasonable addition to the API here that should help to further clarify the purpose of the methods for any that may have confusion. And if you and Teppo had confusion about it, then certainly others will too. We've had a $pages->findOne() method in our API since the beginning, but it's just been there as an alias to $pages->get() and just for backwards compatibility. I have dropped the purpose of that method in PW3, since we no longer need that backwards compatibility, and I very much doubt anyone uses it other than the core in a few spots (which I've updated to use the get method instead). I have changed $pages->findOne() to be an alternative to $pages->get() in PW3, that by default filters in the same way as $pages->find(). You'll see this in today's commits. I think this adds more clarity because one can now assume that any $pages method that starts with "find" is also "filtered" by default.2 points
-
FYI I already wrote a PW article for code tutsplus. It's publication-ready and will be released mid-January. Can't wait what you guys will say about it!!2 points
-
@kongondo this is a great project sorry for ot - but may i know why this community is so great...2 points
-
From now you can use multiple values separated by space. Example: "parent.title date(Y) myfield". Page name will remain 'untitled' until last required field is populated. You will get informed about this by a warning. Merry Christmas.2 points
-
Hey, this is the exact use case why I made the http://modules.processwire.com/modules/process-field-generator/ module. It will generate crypto safe strings to use as page names (you don't have to expose the page id, especially with the combined use of urlSegments as a view handler).2 points
-
@ryan How about using this http://stackoverflow.com/questions/5716362/how-can-i-get-the-value-of-mysqls-ft-min-word-len-configuration-variable-usin to retrieve the value on install and maybe a setting somewhere, where it can be readjusted ($config maybe)? It's hard to imagine this value to change often.2 points
-
I believe this as well and here's how I came to the same conclusion... I recently read this post by the original creator of Drupal and the fantastic comments there: http://buytaert.net/should-we-decouple-drupal-with-a-client-side-framework ... and that gets you thinking deeply about the evolution of content management systems and what their role is in the coming years. If you believe their role is ultimately some sort of structured content storage database that's decoupled from the frontend, or entirely headless, then platforms that like already exist. They are called Content as a Service systems, like Contentful: https://www.contentful.com/ More about CaaS: http://ecmarchitect.com/archives/2014/10/27/3944 Contentful is "an API-first CMS" and is entirely headless. It exposes the content as an API. You can then build your frontend separately in any way that you like. A very interesting approach is outlined here, using the Roots static site generator: http://carrot.is/coding/static_cms The thing about Contentful is that the concept and simplicity of fields, templates (known as "Content Types" in Contentful) and pages (known as "Entries" in Contentful) is almost exactly like ProcessWire. If you compare the two, you soon realize that ProcessWire is much more robust and feature rich... more field types, ability to nest pages, finer level of control, a User system, not forced into Markdown for rich text fields, ability to create modules, Hannacode/shortcodes and so on. Contentful is great too, but I feel it has a more precise use case. With that being said, the way I see ProcessWire is that it can be a CaaS-like/headless CMS much like Contentful, but also a "traditional" CMS like Drupal/WordPress but with way better architecture. Best of both worlds. I love my CMS too.2 points
-
ALIF - Admin Links In Frontend EDIT: latest version update with PHP 8 fixes on 05. Nov 2023 (!) The version now is 1.1.9 (!) This module combines some of the admin links that we want to use on the frontpages sometimes. It is a comfortable and easy way to do so. After you have installed and configured the module, you can inject the links into the frontpage with code like this in a template file: echo $modules->isInstalled('AdminLinksInFrontend') ? $modules->get('AdminLinksInFrontend')->render() : ''; . Credits: The comfortable Javascript Color Picker in the Configpage comes from Jan Odvarko (http://jscolor.com). Many thanks for this! * Toolbar The toolbar can be positioned by css values for top/bottom and left/right. It can expand in vertical or horizontal direction. The buttons are links to the PW admin, for logout, or for editing the page in admin, or informational ones. All settings, including the colors, can be defined in the modules config page. This is available for all PW versions from PW 2.3 up to now. Depending on how you configure this part, it can be used for authors and editors too, maybe. * Import / Export Settings It has the possibility to export and import its settings via two textarea fields. When importing settings, you get a second screen where you can select which settings you want to import. * One-click User Account Switcher For PW versions 2.6.8+, there is one really nice function available, that I use when developing / testing sites with different user / roles. A fast User-Account-Switcher that lets you view the same page from different user accounts with only one click. To enter this mode, you need to login as a superuser one time, and the feature needs to be enabled in the module of course. After that, you can log out, login with different user roles, etc. At least the toolbar buttons for the User-Account-Switcher will stay visible for you. This is session based. There is also an extra button with a trash can and the text "Session", that helps you to leave this mode once you are finished. As you can see in the screenshot, after clicking "guest", I was logged out, but a regular login button, a warning for debug mode and my three defined buttons for user accounts are available. When clicking another user button I login with this account. Very handy. ATTENTION! The use of the One-click User Account Switcher is mainly intended for dev sites, not for public sites! You should be aware that there is a huge security risc when using this feature on public reachable sites! We completly leave ProcessWires comfort zone in regard of security, - and the only thing between your site and potentially hackattacks is this module. (Oh mom, - what have I done?) PW 2.6.8+ has a comfortable function for admin tasks, that let us log into different user accounts via API without using passwords. This module uses this function! All data that is needed during a User Account Switcher session is stored in the session data on the server. So, if someone steel your session cookie, there is potentially risc that he can login as a superuser, depending of the user account buttons you have in your admin links collection! To prevent SessionHijacking, the module can be bound to a single IP address, it uses a fingerprint depending of IP(s) and UserAgent string. And you need to define a max time to live in minutes between 2 and 60, a User Account Switcher session may run. A User Account Switcher session only can be initialized by a Superuser who also explicitly has set a permission called 'alif-user-account-switcher', what is defined by the module, when installing it. So, the prefered way to use this module is, to enable and use the User Account Switcher while the site is unpublic, and before it goes public, remove the permission from the superuser role. This way, you can use its menu function, but not the UAS anymore. On a sidenote, for those rare cases where multiple superusers simultaneous developing on a site and want to use the ALIF, but the UAS should be used only by one, you can leave the 'alif-user-account-switcher' permission removed from the superuser role, but need to assign the role 'alif-superuser' to the single user account. This way, only that single superuser has the permission for UAS, whereas all other superusers doesn't have it. . . * The Configpage * Online demo I have pasted it into this old site and enabled it to be present every time (when the site is in demo mode only!). So, it is an earlier state, but the switcher is functional there: http://pwlaf.biriba.de/dbinfo/ * Download From our modules directory or from github repo1 point
-
MySQL's utf8 encoding can only represent a tiny (though useful) subset of the full 31-bit range of Unicode; it's not UTF-8 at all. To fix what never should've been broken, they came up with utf8mb4. It's "of course" (i.e. UTF-8 is some properly designed piece of stuff) upwards compatible with the broken utf8 type. Well, not exactly, but more on that later. Would it be possible to default to the real UTF-8 type, when available? (MySQL 5.5.3+) (even wp did it! nudge nudge) And here comes that "later" you've all been waiting for. This important(ish) change would require the noble sacrifice of cutting some of the core (YES, CORE!) fields down to 250 characters to satisfy MySQL's sad-pathetic-deplorable limitation on index sizes. I know, that's 5 precious characters lost, but think about all those suffering emojis and suddenly you'll feel all fuzzy and warm, right? Anw, just a suggestion, because i18n and l10n and all the like. Edit: It seems a cruel RFC took away much of UTF-8's expressive beauty, and it is now valid only up to 4-byte lengths and values of 0x10FFFF, whichever smaller; I'm gonna go and cry myself to sleep now, goodbye.1 point
-
Hi guys, Been "kicking the tyres" on some UI tweaks to the PW image fields and modal windows. Many of these are in-progress designs and to be straight, none of the designs are entirely resolved. At this stage, I thought I'd throw them up (poor choice of words!) and maybe someone can take them further or offer some fresh eyes. I'm not a developer so making these a reality is impossible for me. They're flat designs. Why? PW is an amazing experience for editors. It's just so elegant and beautifully realised (especially with Reno Theme) that often, my training sessions with clients are very brief. One area which does cause friction though has always been concerned images, image fields and image modals. Especially with the latest image modules, I think a lot of inconsistency has crept into the UI. Hopefully these designs can help improve things a bit. A tiny part of the design work is influenced by a similar idea I had for MODX but which never progressed. 1A. Current Image Modal Editor has clicked 'Add image' icon in CK editor. Issues: I believe the Upload Image button can be better placed. It's not clear to users that they have a choice of two actions (Select an Image OR Upload one) To help solve this, I thought we could: Place available images under a Choose tab Create another tab titled Upload Rename modal to just Image (from Select Image) tweak slightly the Images on page path to be less prominent The following image illustrates the result. Clicking the Upload tab would result in: In the above image I've created toggle-able accordians for Drag and Drop and Manual upload. This follows closely the UI an editor is presented with when choosing Insert Link within CK Editor. IE Link to URL, Select Page and Select File and the extra Attributes tab. So overall, it's more consistent. 1B. Alternative to above - combined Select and Drag/Drop I thought it might be worth exploring what modal would look like with no tabs and a single UI for both Selecting an image and Drag/Dropping. 1C. The Image field I then moved onto looking at the Image field in PW. So currently it looks like this (below) for a simple image field called Image Gallery. So although the current Image field works great, I wondered if there was a way to simplify it by Making the drag/drop more visual and obvious Moving the Choose Files button and removing the No file chosen text and the file types allowed Here's the result. Admittedly, this treatment adds more height to the overall field. Here's how it looks when images are uploading (slightly smaller plus icon and "drag and drop..." text. To be honest, I can't recall what other changes I made there! And here's a proposed layout for when there are multiple images. This includes image titles grid layout mouse-over for edit and delete options/buttons 2. Cropping Next thing I looked at was cropping. Native cropping introduced recently is one of my clients favourite features and time-savers and I wondered if things could be improved a little. So heres the current layout (this may have changed further recently) And here's my proposal. Changes are: Width, height and X and Y fields are moved below the image Apply and Cancel placed bottom right of the image Save Crop should be titled Apply. I think that's less confusing as in some instances there are so many Save options Save and Replace should be greyed out further In addition to this, I thought it'd be neat if we had the free-form cropping function introduced by Ryan combined with some kind of list of pre-sets (displayed on right hand side). Forgive the croptions label (Crop + Options pun - I was tired!) The benfit of this I think is that Modules such as CoppableImage and native Crop would be unified in a single UI. Presets (on right) could be a few out-of-the-box presets which come natively. Croptions houses any crop ratios defined in image modules. if CopppableImage isn't installed, they just don't display.. That's it. I wish I'd more time to work on this but it's at the stage where it's ready for some initial thoughts. Hope you guys like.1 point
-
I'm on mobile. Maybe you want to have a look at semantic labels: http://semantic-ui.com/elements/label.html#basic The great thing is that you don't have to load a heavy framework. It's all devided into small components. That's really great when you are missing something in another framework. Maybe you could provide different marker styles easily using semantic1 point
-
You can use all the api function, which you can use on other pageArrays as well, just keep in mind that it's using the runtime selector engine, which isn't as powerful as the db selection. E.g. there's no automatic replacement for the today keyword. $today = time(); $filtered =$page->activity_create_date->find("date_from>=$today, sort=date_from");1 point
-
Thank you for you thoughts Ryan. I will check out wireTemplateFile() and wireIncludeFile() to see how they can help me to achieve what I am after. I use Pinegrow (Pro) Web Editor for frontend development, and the PHP alternative syntax is the only way to sort of preview what the actual dynamically generated markup will be, and the static preview helps to speed up the frontend design process. Thanks to this preview feature of Pinegrow, it is actually easy to visually separate HTML and PHP, since this is the basic idea behind this software; to be able to work easily with this particular syntax.1 point
-
Where else would someone post a question like I did, and in the same day find people gathering around the subject and build a new module that solves the problem? This forum feels like actually being in a room filled with people who know their stuff and are willing to help a brother out.1 point
-
Credits go to tpr but I think the forum could profit if we spread the word and more people used it to show their work. I think it's the most efficient way to show modules/features and so on1 point
-
SiNNuT by "make it the default" I mean "make it the default when supported". When full-text isn't available for InnoDB, we couldn't use InnoDB for things like FieldtypeText/FieldtypeTextarea. I don't plan to drop MyISAM support, just default to InnoDB in the installer when we're identified that it can be fully supported in the environment. This could be a problem with migration, like when your dev server has the needed versions and your production server doesn't, so the installer will definitely need to call more attention to these considerations when providing the db engine selection at install time. Btw, we already do use InnoDB for some tables where we want to avoid table locking (like DB sessions).1 point
-
My menus work like this First create a "menu" template, a simple empty template that will hold "menu-item" pages as children. Then create the "menu-item" template that can hold 'menu-item' pages as children, fill it with these fields : - (title field) The title for the menu - (item field) A page reference (Single Page or NullPage) field that will link any page in the site except pages with menu or menu-item template. - (isExternalLink field) A checkbox that tells if the link is outside the site. - (externalLink field) a Textbox that holds the external url if the checkbox isExternalLink is active. You can add many additional fields depending on your needs, like css, js, or other information. When that is done just create a page named "Menu" with the "menu" template, later add children pages with the "menu-item" template. Now you have a menu that can be rendered like any other page in processwire. $menu = $pages->get('/menu'); foreach($menu->children as $menu_item) { if($menu_item->isExternalLink){ echo "{$menu_item->externalLink}"; } else { echo "{$menu_item->item->url}"; } } With this approach you can rely on the Processwire backend to give order to the items and create as many children and deep levels as you like1 point
-
It's easy $page->localUrl($user->language); $page->localHttpUrl($user->language); it will output the correct url that belongs to the user language1 point
-
1 point
-
Hi Ben, This is my very first post, so a big hello the the ProcessWire community! Being new to ProcessWire, I'm in your target group I suppose I already started to read the Docs, the weekly newsletters and the blog posts as well (not to mention this forum), which are all useful, but what I am really after is an up to date (v3.x) introduction to all the most important bits that help me develop my very first ProcessWire site that is not just a basic website with a contact form being the most complex element of it, but something that shows us how entity relations should be implemented (Pages vs repeaters: pros and cons). It would also be nice to see how we should implement "fontend users", who can login to the site, update their profiles (info and personal photo) and check out the list of all members, search them, etc... This way you could also introduce us to forms and to saving the posted data, etc... Actually, my site will be developed for a shotokan dojo, so entities like karate tests and results, competitions and results (individual and team), and other events as well will be needed. You get the idea... One more thing: I'm still trying to figure out the best way to organize my template files (and the php partials included in them). I did read Ryan's introduction (How to structure your template files, and the others as well) but I don't really like neither the particular example of the "Direct Output with Includes" nor the "Delayed Output" method. The particular example of the "Direct Output with Includes" method is too "simple and rigid", while the "Delayed Output" uses concatenation, and those php files do not use the PHP alternative syntax, which makes working with the HTML markup frustrating (in my point of view). So I'm planning to come up with something between these two methods, based on Direct Output but utilizing both prependTemplateFile and appendTemplateFile. Since I will build my very first ProcessWire site, I have to spend some extra time trying to figure out all the best practices that fit my usual workflow, and watching your tutorial might help me a lot in this regard. I will definitely consider watching it, whatever you produce BTW, I suppose you have already gathered, that I'm suggesting to create a tutorial at least for reasonably skillful front-end developers, and not for complete beginners. Joss Sanglier's tutorial is just good for that purpose. Thank you anyway! I hope your tutorial turns out to be successful.1 point
-
hello, Thanks for your lastest explanations. To be very clear, I think our discussion has derived a little, from the original question about get() behaviour, to more general approaches about security. Personally, I don't mean to force you, or the whole PW community for that matter, to create and make use of a new API method ; as I said before, regarding the original question, I reiterate that I'm very fine with having my own "getSec" method which I would build via a hook thanks to the code your suggested at reply #10. Thanks again. I'm marking this thread as solved.1 point
-
Amazing work my friend. Looks like my help isn't needed. I agree with percentages. Evaluating the site I'm working on I figured I'd have to compare each dot's coordinates with the image size to make everything scalable and responsive, so I think it's better to have it standard as percentage and convert to px on the frontend if needed. If you can make this available this week, I'll be setting up the CMS on my site starting monday. It would be a good testing ground. (Still stoked by the support this community offers, btw)1 point
-
Tom, there's a setting in MySQL called ft_min_word_len and the default is 4. That means that if you have any word in your query that is less than 4 characters, MySQL won't be able to match it unless that setting has been adjusted (and you've forced it to rebuild the indexes on your db/table). That's why you aren't able to match "Disability Act", because "Act" likely falls under your ft_min_word_len. You should be able to get the result you are looking for by using %= instead. But since you want to match "disability" and "act" anywhere in your search, you'd need to do this: template=document, title%=disability, title%=act The following code should use %= for words less than 4 characters and ~= for the rest. $search = $input->get->text("search"); if($search) { $selector = ''; $parts = explode(' ', $search); foreach($parts as $key => $part) { if(strlen($part) > 3) continue; // use MySQL LIKE for words under 4 characters in length $selector .= ", title%=" . $sanitizer->selectorValue($part); unset($parts[$key]); } if(count($parts)) { // use MySQL fulltext index for words 4 characters and higher $selector .= ", title~=" . $sanitizer->selectorValue(implode(' ', $parts)); } $results = $pages->find("template=document" . $selector); } else { $error = "Please enter a search term in the search box above."; $results = null; } Come to think of it, it might be nice if PW just did this for you automatically when it detected the condition... but we don't know what the ft_min_word_len setting is.1 point
-
Actually, that's only true for MyISAM tables with their 1000 bytes index limit. For InnoDB, field length would drop to 191 characters (max. index size of 767 bytes divided through 4 bytes per character). Going below 200 characters would IMHO be rather inconvenient and possibly dangerous. One could extend the number of indexable characters for InnoDB storage, but that gets a little more involved, as it means re-creating any existing pw database to change the storage engine from antelope to barracuda and adapt innodb_large_prefix in the server configuration. Also something not doable on a shared hosting server.1 point
-
I have to re-write a half-ready WP site so I will make a simple skeleton for the site profile.1 point
-
If $audience is an array of pages then you cannot get the "title"(sic) from it directly. Use the implode function to get a string with all titles. Also you should rather take the names or use some other function to sanitize titles to valid class names.1 point
-
Gotta agree with Ryan here. Most of problems we have faced has been opposite: building different (admin) views for otherwise denied pages and forgetting that find filters results by default.1 point
-
What is front-end and what is back-end? That term is just for our point of view. The code powering the rest of PW doesn't know about this, nor does it know if you are using it for an access controlled website, or some command line API tool, or something else. While your front-end page is rendered, there might be several other core and/or 3rd party modules also doing other things (because they auto loaded, or they were requested by the page), and those modules in turn might be doing several of their own $pages API calls that have absolutely nothing to do with your output, user or access control. There is a much bigger picture than just what you are doing in your template file. The built-in filtering that you have on top of $pages->find() is actually a pretty unique case in the overall API, and the phpdoc for that method outlines it as a unique case. After all, find() is primarily used for lists and pagination. You have access to everything with your API code, but your code is not the user, and the user is not your code, so be careful not to blur those lines. The API is there to assist you in getting any content you need as quickly and easily as possible, but you are the gatekeeper. It's important to keep this in mind anywhere in the API. In the more than 5 years of this open source project, I'm not aware of any instance where someone has misused a get() method and caused a security problem. So we're talking about a hypothetical scenario of someone making a code error, that to my knowledge has never occurred before, though who knows. We could construct all kinds of scenarios where a developer could misuse the power provided and get themselves in trouble. PW is a tool that when used correctly, provides very strong security and its been my primary focus in this project. But I also don't believe in magic_quotes, safe_mode or trying to save developers from themselves by introducing obstacles. These things might seem to provide more security initially, but actually create a perception that one is no longer responsible for their own security and thus become security problems themselves. I have no qualms about an access controlled "one" function per an earlier post, which could be a useful shortcut for some developers and scenarios. But I think it's important that such a method is completely distinct and also outlined as a unique case, because PW's API context is one where the site/app developer using it carries that power and responsibility. We like to access control the user, not the developer. It's good to see this Security board finally getting some discussion.1 point
-
I think you're a spammer. If you were using ProcessWire, you would know where the configuration file is...1 point
-
Despite praising the flexibility and advantages of using ProcessWire as a CMS, I am currently loosing a lot of business, because clients insist on using WordPress, which we all know is a pain to go back to if you once enjoyed the clean API of PW. Many times I get the impression that people don't buy what they don't know. How do you go about this? Do you simply give in and implement it in WordPress? I think it would really help if the official ProcessWire site had an attractive landing page that explains the advantages of using ProcessWire for non-technical users. Probably without bashing WordPress, but making a strong point...1 point
-
Since there are a lot of topics about the same theme, I decided to write a small module which overwrites the core function ___SetupPageName(). The module allows now to populate the page name using proprietary date() function. Works like PHP date() with follwing exceptions: Everything between the brackets is detected as format string, meaning no 2nd parameter possible. No need to use quotes around the format string. Spaces not allowed. from any page property, page field including subfields, parent property, parent field etc. Meaning everything what you get with $page->get(); including dot syntax. The function will give error and warnings in case of unproper settings, but creates the page with name 'untitled' anyway. Download here: http://modules.processwire.com/modules/process-setup-page-name/ Some Examples The following settings in parent template 'Name Format Children' will assign name immediately. date(Y) date('Y-m-d') parent.title parent.parent.title parent.id template.id assign name after page saving and/or population of depending field. Overwrites 'untitled' after all fields which are defined in parent template are populated. id (any other page property) pagefieldname, multiple pagefieldnames show a warning. pagefieldname (value not populated)show an error. date() // empty, no format assigned date(Y // missing closing bracket date(Y md) // unallowed space notexistingfieldname notexistingproperty existingfield.notexistingsubfield The function in the module ___SetupPageName() could be completely copied as is to the core class $pages. @Ryan Would be nice to see this in core. Related topics: https://processwire.com/talk/topic/8576-name-format-children/ https://processwire.com/talk/topic/8217-name-format-for-children-based-on-any-field-not-just-title/ https://processwire.com/talk/topic/11628-custom-page-name/ https://processwire.com/talk/topic/11349-page-add-step-not-being-skipped-when-name-format-for-children-is-set/ https://processwire.com/talk/topic/10701-automatic-page-name-using-processpageaddexecute-and-pagetable/ https://processwire.com/talk/topic/10208-pagetable-automatic-page-name-format-when-multiple-templates-allowed/ https://processwire.com/talk/topic/9979-name-format-for-children-for-multiple-allowed-templates-for-children/ https://processwire.com/api/modules/process-template/ Any recommandations after testing welcome. Download here: Download here: http://modules.processwire.com/modules/process-setup-page-name/ Edit: small enhancement to prevent display of warning twice. 23.12.15 multiple values possible now 24.12.15 made compatible with PW 3.x 27.12.15 Update Version 1.0.8 09.01.16 Update Version 1.1.01 point
-
Writing some tutorials for Envato Tuts+ anyone have any recommendations of topics to help Processwire beginners? Starting with Installation, admin guide and themeing.1 point
-
1 point
-
1 point