Leaderboard
Popular Content
Showing content with the highest reputation on 03/11/2015 in all areas
-
I recently finished my first bigger from start to finish ProcessWire website. It's a website for a local architecture agency which does lot's of the more prestige projects in my area. The image of the partners is still missing, but the rest is ready. I did the design together with a ex-fellow student of mine, the programming is completely done by me. The self-imposed challange was building something that does really cater to current standarts. Therefore templating is done with mustache. On the initial page request the page is rendered serverside, everything else works via ajax, as long as the history api is available. If not it's not even loading the whole templating stuff and pages are served traditionally. http://wunderle-partner.de/ Modules uses: ListerPro AdminCustomFiles Jumplinks MarkupSEO HannaCode ProFields: Multiplier6 points
-
The zoom controls doesn't work because of the css. Try this: #map_canvas_id img { max-width: none; }5 points
-
I'm reviving this thread! This needs to gain traction! I would really like to improve the docs, and I propose we start a documentation team. I've already started a Google Spreadsheet (open for comments, PM me your Google account for modification access) with a tree of the current documentation with comments and improvements (see What's in and What's missing or needs improving tabs). Note that this is mostly made from memory and notes I have laying around. I haven't personally read 100% of the documentation (these days I just go straight to the source code), so I would appreciate your input/feedback/additions. I suppose a spreadsheet might not be the best way to go at it, let me know how you'd like to organize things moving forward. Cheers!5 points
-
@mr-fan, Indeed, ProcessWire is quite unique in that you never feel that something is too difficult to do from the outset. I explored Drupal a little before, and there were many times when I was wondering how to approach a project. PW is very open and allows you to have a very consistent structure in your project (Fields > Templates > Pages). And the hook system is very well done to be able to expand the CMS when needed. I do love this CMS4 points
-
I just committed big refactoring to Fredi, which fixes all the known bugs and simplifies a code a lot. I haven't tested this yet on other pw versions than latest dev, so be careful when testing. It "should" work pretty universally, since now it uses ProcessPageEdit instead of own custom processes. So image/file uploads and reordering (tested) and repeaters (not tested...) should work also.4 points
-
want to express my deepest gratitude to the PW folks for selecting this as site of the week! As someone who worships PW and all of the developers and contributors alike, it is a tremendous honor to receive this.3 points
-
I don't know where your memory error comes from, but your application is already stuffing >256MB inside your RAM. You should definitely start searching for the actual cause of that problem, or your application might run into this on other occasions. Are you fetching all your 2m+ records at some place? Install Xdebug and use the profiler to analyze what happens before you run into serious problems. That said, your problem of getting rid of a field can easily be solved by directly working with SQL commands on the database. You'll need shell access to the mysql command line tool or a tool like phpMyAdmin or Adminer to execute arbitrary SQL in your database. You probably already know a way to get this done so I'll leave it to you, how you do it. Before you do anything: do yourself a favor and dump the contents of your database and save that backup somewhere safe for later. Never work on a live instance of your application, especially not without a backup and a tested way to reset your database from it. Ok, now let's get to the work. Field data is, as you already mentioned, only saved in three places of the database: the actual content data of the pages for field is saved in it's own table (called field_fieldname), the field settings are saved in the fields table, and the association between a field and a fieldgroup and therefore a template is saved in the fieldgroups_fields table. So, let's get rid of it all. Let's assume that your field is called your_field. To keep things simple (without any joins) we'll get the id of your field in the first step and use it later as your_field_id. # Get the ID of your field. Note it down somewhere, you'll need it later SELECT `id` FROM `fields` WHERE `name` = 'your_field'; # Delete field data from fields table by it's ID DELETE FROM `fields` WHERE `id` = 'your_field_id'; # Delete field associations from fieldgroups_fields table by the field's ID DELETE FROM `fieldgroups_fields` WHERE `fields_id` = `your_fields_id`; # Now drop the table created for your field called field_your_field DROP TABLE `field_your_field`; That should have been all that was needed. With kind regards Marc3 points
-
It's like this: - Videos - Video - Video - Video - Fitness Programs - Program - Program - Program - Users - User - User You upload all the videos, than you create users and then you can create the program for each user. This program has some pagefield where the trainer can chose the videos for the program (e.g. videos) and a pagefield to select which user this program relates to (e.g. user). Then you can use selectors like this: $pages->get("template=program, user=$user")->videos; // Get all videos from this users program $pages->find("template=program, videos=$someVideoID"); // Get all programs featuring this one video3 points
-
This is my first site I made for a client with PW: http://www.springbeestjes.be It is a simple online shop used (for the moment) PayPal. It is expandable for the future. Modules: - Maintenance module http://modules.processwire.com/modules/maintenance-mode/ I want to thank all the PW-people who helped me learning and understanding PW, also for the fast and good support. I like this CMS!!! Now I preparing the next project Regards, Christophe3 points
-
Nope User template... take a look at edit templates at the top ->filter ->show system templates.....in PW the backend is not really more than the frontend... So you can add fields to the user template like a pagefield! So now there are many options again.... 1. should the admin set the users to the videos or 2. should the admin set the videos for the user it's a kind of usability question here....so how many users how many videos? Option 2 should be the best since it all depends personally - so you could create a little special admin page to let the coach choose first which user and then add some videos all on one page. Take also a look at http://modules.processwire.com/modules/process-admin-custom-pages/ this is unique with PW while you have all options on your side....3 points
-
Menu Builder As of 29 December 2017 ProcessWire versions earlier than 3.x are not supported Modules Directory Project Page Read Me (How to install, use, etc..) For highly customisable menus, please see this post. If you want a navigation that mirrors your ProcessWire page tree, the system allows you to easily create recursive menus using either vanilla PHP or Soma's great MarkupSimpleNavigation. In some cases, however, you may wish to create menus that: 1. Do not mirror you site's page tree (hirarchies and ancestry); and 2. You can add custom links (external to your site) to. That is primarily where Menu Builder comes in. It is also helpful if you: 3. Prefer creating menus via drag and drop 4. Have a need for menus (or other listings) that will be changing regularly or that you want to allow your admin users to edit. The issue of custom menus is not new here in the forums. The difference is that this module allows you to easily create such menus via drag and drop in the Admin. Actually, you can even use it to just create some list if you wanted to. In the backend, the module uses the jQueryUI plugin nestedSortable by Manuele J Sarfatti for the drag and drop and is inspired in part by the WP Custom Menu feature. Please read the Read Me completely before using this module. For Complex or highly-customised menus, it is recommended to use the getMenuItems() method as detailed in this post. Features Ability to create menus that do not mirror your ProcessWire Page Tree hierarchy/structure Menus can contain both ProcessWire pages and custom links Create menu hierarchies and nesting via drag and drop Easily add CSS IDs and Classes to each menu item on creating the menu items (both custom and from ProcessWire pages) or post creation. Optionally set custom links to open in a new tab Change menu item titles built from ProcessWire pages (without affecting the original page). E.g. if you have a page titled 'About Us' but you want the menu item title to be 'About' Readily view the structure and settings for each menu item Menus stored as pages (note: just the menu, not the items!) Menu items stored as JSON in a field in the menu pages (empty values not stored) Add menu items from ProcessWire pages using page fields (option to choose between PageAutocomplete and AsmSelect [default]) or a Selector (e.g. template=basic-page, limit=20, sort=title). For page fields, you can specify a selector to return only those specified pages for selection in the page field (i.e. asm and autocomplete) For superusers, optionally allow markup in your menu titles, e.g. <span>About</span> Menu settings for nestedSortable - e.g. maxLevels (limit nesting levels) Advanced features (e.g. add pages via selector, menu settings) currently permissible to superadmins only (may change to be permission-based) Delete single or all menu items without deleting the menu itself Lock down menus for editing Highly configurable MarkupMenuBuilder - e.g. can pass menu id, title, name or array to render(); Passing an array means you can conditionally manipulate it before rendering, e.g. make certain menu branches visible only to certain users [the code is up to you!] Optionally grab menu items only (as a Menu object WireArray or a normal array) and use your own code to create custom highly complex menus to meet any need. More... In the backend, ProcessMenuBuilder does the menu creation. For the frontend, menus are displayed using MarkupMenuBuilder. Credits In this module's infancy (way back!), I wanted to know more about ProcessWire modules as well as improve my PHP skills. As they say, what better way to learn than to actually create something? So, I developed this module (instead of writing PW tutorials as promised, tsk, tsk, naughty, naughty!) in my own summer of code . Props to Wanze, Soma, Pete, Antti and Ryan whose modules I studied (read copied ) to help in my module development and to Teppo for his wonderful write-up on the "Anatomy of fields in ProcessWire" that vastly improved my knowledge and understanding of how PW works. Diogo and marcus for idea about using pages (rather than a custom db table), onjegolders for his helpful UI comments, Martijn Geerts, OrganizedFellow, dazzyweb and Mike Anthony for 'pushing me' to complete this module and netcarver for help with the code. Screens2 points
-
This is a very simple way to display some instructions to the admin users. Before starting, you need to write some docs; they can be a hidden branch of your page tree, using basic-page, or a different template of your choosing. You should make each subject it's own page under the docs so you can output each one under an accordion trigger. Required Module: Admin Custom Pages 1.) Follow all instructions to install the module; Also add the ACP_scripts_and_styles field to the admin template. 2.) Make a new page under admin, called Docs or whatever; assign the process as described in the module instructions. 3.) Make a template in your themes directory to generate the output of the docs page. 4.) Select that template from the page select in the admin custom page you created. 5.) also make a folder to keep your admin custom pages scripts and styles; 6.) create a css file to use for the display output and some basic styles (like ol, ul li etc..) 7.) Add the custom css file to your ACP_scripts_and_styles field. You can use any output you want, but i'm using a nested accordion, which is provided here: http://tympanus.net/codrops/2013/03/29/nested-accordion/ this is the content of the admin custom page: <?php $docs = $pages->get(4259); ?> <div id="docs"> <ul id="cbp-ntaccordion" class="cbp-ntaccordion"> <?php foreach($docs->children as $doc) { ?> <li> <h3 class="cbp-nttrigger"><?php echo $doc->title ?></h3> <div class="cbp-ntcontent"> <?php echo $doc->body;?> </div> </li> <?php } ?> </ul> </div> <script src="<?php echo $config->urls->templates ?>_admin_custom/js/jquery.cbpNTAccordion.min.js"></script> <script> $( function() { $( '#cbp-ntaccordion' ).cbpNTAccordion(); } ); </script> you'll also want to add the provided css, js and fonts that come with the Nested Accordion; in the css file you'll need to point the fonts to the actual font directory, for example: /site/templates/_admin_custom/fonts/icomoon_arrows/icomoon.eot it should come out looking something like this: *if you are using Reno theme, you can customize the icon, like for example fa-book, which is used in this example: -- Thanks & Credits to Diogo for originally creating the ACP module, and for Nico for getting it to work with the new admin theme system...2 points
-
Google doesn't care about the CMS you use. If the content and url structure of the public site stay the same the pagerank should stay the same. Pagespeed and maybe https could have a little influence. If you do adjust the url's, be sure to setup the correct 301 redirects from old to new url's, and you should be fine.2 points
-
hey mr-fan - good idea, makes it easier to setup; hoping at some point to improve this whole thing, including how it displays (needs more styling for the text), and bundle it with the page docs tab, as a module...2 points
-
Are you keeping the exact same design, content and structure? If so, your page rank won't be affected (negatively OR positively) unless the server is slower as speed is now a google metric. That's my belief anyway.2 points
-
thanks - a pity that i didn't google for "weird UI display glitches (with screenshot)"2 points
-
Stackoverflow http://stackoverflow.com/questions/7471830/google-maps-api-v3-weird-ui-display-glitches-with-screenshot2 points
-
Yes, that's an interesting approach, and very flexible. A concrete way of doing this could be to create a fitness-program template, with a title field, a videos multi-page field and a description textarea field. You can then create a PageTable field called fitness_programs that uses that fitness-program template, and add it to the user template. This way, the coach can create for example weekly or monthly programs by adding a fitness program to a user like this: Title: Week #1 Videos: Video 1, Video 4, Video 5 Description: Do 5 times: Crunches 20x Push-ups 15x Chin-ups 12x2 points
-
The more flexible way would be to use the user template only for "userdata" and just use a pagefield to link each user to a section of the page where his fitness program is located. This way it's easier if you later decide that maybe a user could have more than one fitnessplan or something like that. It's kinda like in object oriented programming: A fitnessprogram is an object and a user is an object (already the case in pw), so it's the easiest to structure it this way in the backend, too.2 points
-
The user template and the profile page are not quite the same thing: The "user" template is basically similar to any other template in Processwire. In the same sense that you might have a "product" template with fields "reference", "title" and "price", you have a "user" template with fields "email", "pass" (for password) and "roles". You can see this template by going in Setup > Templates, then expanding "Filters" > "Show system templates?" and choosing "Yes". The "user" template then appears, and when you click on it, you can see that it has different fields, and that you can add fields to it (for example "selected_videos"). When editing a user (Access > Users), you can see all these fields and edit them. This is managed by the ProcessPageEdit module, which is the same as for all other pages. The profile page is a special page which shows only a few fields (e-mail and password) for the logged in user. This is managed by the ProcessProfile module. So in your case, you can simply add the "selected_videos" to the user template, so that the coach can attribute videos to each user.2 points
-
No problem because you are a fast learner Besides Foxy Cart you can have a look at Open Cart. It's open source and I am using it with great results. It is stable, easy for both coder and end user and many extensions available.2 points
-
2 points
-
Hi doolin, I would suggest checking this post from Soma, which "corrects" ryan's original code for the custom login. Concerning the redirection after logging out, I am assuming that you are using the link in the admin area, right? Since the admin doesn't know about your custom login page, it can't redirect to it. You need to hook into the Session::logout function to force redirection to the right login page, for example with a module: class CustomLogout extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'Custom Logout', 'summary' => 'Redirects to a custom login page after logout', 'singular' => true, 'autoload' => true ); } public function init() { $this->addHookAfter('Session::logout', function($event) { $this->session->redirect($this->pages->get('/login/')->url); }); } } Concerning the login page itself, it should remain accessible for non-admin users, since they need to access it to login. What you could simply do is make it non-editable by non-admin users by configuring the permissions for the login template (in the Access tab). Removing it from the page tree is somewhat of a hassle...2 points
-
hey quickjeff - maybe you could post your final code, to see how it was adjust for the use case? cheers!2 points
-
This Textformatter allows you to designate areas in a single textarea to be converted to a collapsed accordion list. The markup pattern for this module is based on the Pagination Textformatter module with the idea that they could be interchangeable. Github Page Simple Demo To define an accordion item Put 5+ hyphens '-----Your Title Here' on a single line (within paragraph tags) to specify a title for the accordion item. The paragraphs below will be collapsed. This is the same idea as the Pagination Textformatter, however titles are not optional. If you just put the dashes, the item with be automatically titled "Untitled". To end an accordion To end a group of accordion items and return to regular textarea content, put exactly 5 slashes on a single line '/////' (within paragraph tags). This is only needed if you want to end collapsed content and return to regular textarea content. Notes I've been using this on a production site for nearly a year, but before Ryan released the Pagination Textformatter it was using with a totally different markup pattern to designate the accordion items. It should be pretty stable, but consider it a beta release. Markup pattern inside a textarea (Nearly identical to the Pagination Textformatter) ----- Accordion Item The paragraphs beneath each accordion item are collapsed by default and open when you click on the title specified above. You can use multiple paragraphs, and any other content allowed in the textarea. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec odio. Quisque volutpat mattis eros. Nullam malesuada erat ut turpis. Suspendisse urna nibh, viverra non, semper suscipit, posuere a, pede. ----- Another Accordion Item Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec odio. Quisque volutpat mattis eros. Nullam malesuada erat ut turpis. Suspendisse urna nibh, viverra non, semper suscipit, posuere a, pede.Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec odio. Quisque volutpat mattis eros. Nullam malesuada erat ut turpis. Suspendisse urna nibh, viverra non, semper suscipit, posuere a, pede. ///// The 5 slashes above signify an end to the accordion group above. You only need to specify the end of a group if you want to return to regular textarea content. You can continue to use the same pattern to collapse content into accordions as many times as you wish. Results in the following markup: <dl class="accordion"> <dt> <a href="#accordion-item">Accordion Item</a> </dt> <dd> <p>The paragraphs beneath each accordion item are collapsed by default and open when you click on the title specified above. You can use multiple paragraphs, and any other content allowed in the textarea.</p> <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec odio. Quisque volutpat mattis eros. Nullam malesuada erat ut turpis. Suspendisse urna nibh, viverra non, semper suscipit, posuere a, pede.</p> </dd> <dt> <a href="#another-accordion-item">Another Accordion Item</a> </dt> <dd> <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec odio. Quisque volutpat mattis eros. Nullam malesuada erat ut turpis. Suspendisse urna nibh, viverra non, semper suscipit, posuere a, pede.Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec odio. Quisque volutpat mattis eros. Nullam malesuada erat ut turpis. Suspendisse urna nibh, viverra non, semper suscipit, posuere a, pede.</p> </dd> </dl> <p>The 5 slashes above signify an end to the accordion group above. You only need to specify the end of a group if you want to return to regular textarea content. You can continue to use the same pattern to collapse content into accordions as many times as you wish.</p>1 point
-
Just wanted to share what I recently used to create forms in modules and in frontend using the API and Inputfield modules PW provides and uses on its own. I think many newcomers or also advanced user aren't aware what is already possible in templates with some simple and flexible code. Learning this can greatly help in any aspect when you develop with PW. It's not as easy and powerful as FormBuilder but a great example of what can be archieved within PW. Really? Tell me more The output markup generated with something like echo $form->render(); will be a like the one you get with FormBuilder or admin forms in backend. It's what PW is made of. Now since 2.2.5~ somewhere, the "required" option is possible for all fields (previous not) and that makes it easier a lot for validation and also it renders inline errors already nicely (due to Ryan FormBuilder yah!). For example the Password inputfield already provides two field to confirm the password and will validate it. De- and encryption method also exists. Or you can also use columns width setting for a field, which was added not so long ago. Some fields like Asm MultiSelect would require to also include their css and js to work but haven't tried. Also file uploads isn't there, but maybe at some point there will be more options. It would be still possible to code your own uploader when the form is submitted. Validation? If you understand a little more how PW works with forms and inputfields you can simply add you own validation, do hooks and lots of magic with very easy code to read and maintain. You can also use the processInput($input->post) method of a form that PW uses itself to validate a form. So getting to see if there was any errors is simply checking for $form->getErrors();. Also the $form->processInput($input->post) will prevent CSRF attacks and the form will append a hidden field automaticly. It's also worth noting that processInput() will work also with an array (key=>value) of data it doesn't have to be the one from $input->post. Styling? It works well if you take your own CSS or just pick the inputfields.css from the templates-admin folder as a start. Also the CSS file from the wire/modules/InputfieldRadios module can be helpful to add. And that's it. It's not very hard to get it display nicely. Here an code example of a simple form. <?php $out = ''; // create a new form field (also field wrapper) $form = $modules->get("InputfieldForm"); $form->action = "./"; $form->method = "post"; $form->attr("id+name",'subscribe-form'); // create a text input $field = $modules->get("InputfieldText"); $field->label = "Name"; $field->attr('id+name','name'); $field->required = 1; $form->append($field); // append the field to the form // create email field $field = $modules->get("InputfieldEmail"); $field->label = "E-Mail"; $field->attr('id+name','email'); $field->required = 1; $form->append($field); // append the field // you get the idea $field = $modules->get("InputfieldPassword"); $field->label = "Passwort"; $field->attr("id+name","pass"); $field->required = 1; $form->append($field); // oh a submit button! $submit = $modules->get("InputfieldSubmit"); $submit->attr("value","Subscribe"); $submit->attr("id+name","submit"); $form->append($submit); // form was submitted so we process the form if($input->post->submit) { // user submitted the form, process it and check for errors $form->processInput($input->post); // here is a good point for extra/custom validation and manipulate fields $email = $form->get("email"); if($email && (strpos($email->value,'@hotmail') !== FALSE)){ // attach an error to the field // and it will get displayed along the field $email->error("Sorry we don't accept hotmail addresses for now."); } if($form->getErrors()) { // the form is processed and populated // but contains errors $out .= $form->render(); } else { // do with the form what you like, create and save it as page // or send emails. to get the values you can use // $email = $form->get("email")->value; // $name = $form->get("name")->value; // $pass = $form->get("pass")->value; // // to sanitize input // $name = $sanitizer->text($input->post->name); // $email = $sanitizer->email($form->get("email")->value); $out .= "<p>Thanks! Your submission was successful."; } } else { // render out form without processing $out .= $form->render(); } include("./head.inc"); echo $out; include("./foot.inc"); Here the code snippet as gist github: https://gist.github.com/4027908 Maybe there's something I'm not aware of yet, so if there something to still care about just let me know. Maybe some example of hooks could be appended here too. Thanks Edit March 2017: This code still works in PW2.8 and PW3.1 point
-
This Textformatter module for ProcessWire enables you to break up a single textarea field (using either TinyMCE or CKEditor) into multiple pages. You include all of the content in a single rich text field and separate each pagination with a line of hyphens (5+). When rendered on the front-end, the user will see pagination links at the bottom of the page enabling them to move forward and backward through the content/article. Also included is the option for title pagination. That means assigning a title/headline to each pagination and giving the user a list of those titles they can click on to move to each section of the article. Example of this module in action Documentation and customization options GitHub Page Module Page Download ZIP Install class: TextformatterPagination1 point
-
A client asked me what will happen with his page rank in Google if I migrate his old website made with Joomla CMS to Processwire CMS ? Anyone know more about this ?1 point
-
Sorting by subfields is now supported (see https://github.com/ryancramerdesign/ProcessWire/pull/862). It was my first contribution, so I'm pretty proud1 point
-
From previous experience (and have also just now quickly tested), as long as the subfield is a db column name, it should work...so.. $items = $pages->find("sort=parent.title, limit=50"); will not work...you will get an error about column not found...but... $items = $pages->find("sort=parent.name, limit=50"); will work...1 point
-
Steve, Just wanted to say thank you again for this module. I just added about 15 notifications, and threw all kinds of tags at it — works flawlessly. Cheers!1 point
-
Maybe try this before you save the page. I'm not that fluid in pass by reference and this stuff, but maybe the changes are to a variable, that does not get picked up by the page. $p->isChanged($name); This is the line that made me curious. I would also rather use getFile() as it's nicer / more descriptive than the array notation. $file = $field[$identifier]; Also did you take a look at the database, to be sure it's the part before the saving, that does not work?1 point
-
1 point
-
Oooooh, I love this moment when you first think about the possible structure of a website, and all the great things you can do with it, it's awesome My take on a possible structure could be: Home -- My Program (only accessible to logged in users) ---- Video 1 (video template with a video_file field to store the video) ---- Video 2 ---- Video 3 ---- ... -- About -- Contact You can create a page field called selected_videos, that links to the video template, and that you add to the user template (Setup>Templates>Filters>Show system templates) so that the coach can select the videos he suggests for each user. Then at the beginning of the video template, you can have some code like this to make sure that a user can only see the selected videos: (Edit: I made a typo, so I corrected from $user->has to $user->is) if (!$user->is("selected_videos=$page")) $session->redirect($page->parent->url); To embed your video, here are some resources: https://processwire.com/talk/topic/4580-video-fieldtype/ https://processwire.com/talk/topic/7380-whats-your-favourite-video-embedder-and-why/ https://processwire.com/talk/topic/4956-addinguploading-audiovideo-files-to-pages-media-manager/?p=48085 https://processwire.com/talk/topic/4956-addinguploading-audiovideo-files-to-pages-media-manager/?p=48126 You might also be able to use the Comments Fieldtype and the Comments Manager (with recent updates here, here and here) so that clients can add some comments to the video and encourage each other. Anyway, take these suggestions as you wish. I just love thinking about how to structure a site1 point
-
You can always just store the values to variable and see if it's filled. Also, note that PW provides a native way (shortcut, really) for getting the first non-empty field value: $item->get("field1|field2|field3") etc. // like this: $price = $item->get("price1|price2"); if ($price) echo "From: € " . $price; else echo "please ask"; // this works too: $price = $item->get("price1|price2"); echo $price ? "From: € " . $price : "please ask";1 point
-
Well the easiest way seems to simply use an else if: if ($item->price1) { echo "From euros {$item->price1}"; } else if ($item->price2) { echo "From euros {$item->price2}"; } else { echo 'please ask'; }1 point
-
Thanks! I'm trying to make the site as fun as possible (it's a non-income-generating pet project), to make it emotionally rewarding for the authors that have volunteered to provide content. I'm attaching a screen shot of the post-login home page for an author (non-superuser). Fair warning, the color scheme may hurt the eyes. I'm going for quirky here. The challenge area is the 'ticket' system I was referring to.1 point
-
The main difference is this: When creating, editing or deleting elements in a PageTable field, you are creating, editing and deleting independent pages, which appear in your page structure. Each element can be viewed, edited and deleted separately in the Page List. Since each element is a page, it can also appear as a result from a $pages->find() query. As the name implies, the PageTable field is simply a table of links to pages, and in this sense, it is very similar to a simple multi-page field. When creating, editing or deleting elements in a Profields Table, you are creating, editing and deleting rows in a table in the database. The elements can't be viewed, edited or deleted except through the owning page, and when querying, you get the owning page rather than the table row. In terms of efficiency, the Profield Table is better, since it allows for less queries/joins to get the different values. Generally speaking, Processwire stores the value of each field in a separate table, so you have a fields_question table, a fields_answer table, a fields_display table, etc. If you want to show all three fields for a page, the system will have to query three different tables to get the values. That's how things work for the PageTable field, since it creates normal pages. The Profields Table field on the other hand stores values for the different columns in a single table. So if you have a Profield Table field called questions with columns called "question", "answer" and "display", you will have a single table called fields_questions with columns called "question", "answer" and "display". When accessing the values of a row, it is more efficient, since you get all three values in the same query to the database. The Profield Table has however some drawbacks: The list of types you can use for the different columns is limited: you don't have a page field, or a file field for example. Since elements in a PageTable field are normal pages, you have access to all field types. The options on those fields (dependencies, visibility, etc.) are also limited. The queries that you can do are also more limited, since you can't query directly for table rows. As an example for the last point, let's say that you have a questionnaire with several questions. If you use a PageTable field called questions that references a question template (with topic, question, answer, display and include_in_email fields), you can count how many people answered that they had children like this: $pages->find("template=question, topic=children, answer=yes"); If you use a Profield Table, that won't work, since you can't search by question (@field.subfield selectors as presented here also don't work). In your case, I think that the best approach is to use PageTable fields as explained in my previous post.1 point
-
For thoose how work with AdminCustomFiles Module: https://processwire.com/talk/topic/7588-admin-custom-files/ You could easy get this both together just setup the docs - but instead of loading via ACP_scripts_and_styles field and on the admin template you could use this two files to get all the things right up...unzip the package in your "AdminCustomFiles" Folder and use it only with the output generating php stuff in the admin template like above: <?php //only load the doc pages without js or css all done via AdminCustomFiles for ProcessAdminCustomPages $docs = $pages->get(1149); ?> <div id="docs"> <ul id="cbp-ntaccordion" class="cbp-ntaccordion"> <?php foreach($docs->children('include=all') as $doc) { ?> <li> <h3 class="cbp-nttrigger"><?php echo $doc->title ?></h3> <div class="cbp-ntcontent"> <?php echo $doc->body;?> </div> </li> <?php } ?> </ul> </div> Thanks to Macura for this great idea! Regards mr-fan ProcessAdminCustomPages.zip1 point
-
page-edit-created is an optional permission that you can choose to create yourself in Access > Permissions. You would use this permission if you wanted a user to only be able to edit specific pages that they had created, or that you assigned to them.* For instance, lets say you had a blog with multiple contributors. All the blog posts use the same blog-post template. Then lets say you had a role named contributor. That role has page-edit permission. Your blog-post template (Setup > templates > blog-post > Access) has that contributor role assigned for "can edit pages" and "can create pages". The template used by the parent of the blog /posts/ (template blog-posts) would have "can add pages" assigned as the only permission on the access tab. If you've got the setup above, then users with the contributor role can edit any of the blog-post pages. But if you then add page-edit-created permission to the contributor role, suddenly those users can only edit blog-post pages that they created (or that you assigned them as the created user*). They can't edit blog post pages that other users created. To take the example one step further, add another new permission called page-publish (in Access > Permissions), but don't assign it to the contributor role. Now those contributor users can create blog-post pages, but not publish them. At this point, you've got a nice workflow setup where you as the administrator (or someone else you assign) has to approve those blog posts before they are published. *To adjust the "created user" on specific pages, see the setting under Setup > Templates > [your-template] > Advanced > Template Toggles > Allow created user to be changed on pages? Once that box is checked, you can change the "created user" on any page from the Settings tab. Not positive I understand the questions, but if i did then what I wrote above answers these as well. They are different permissions that do different things, so there's isn't crossover. But page-publish requires page-edit, so page-publish does nothing without a user first having page-edit on the same role. If your system has a page-publish permission, and a user doesn't have it in their role(s), then they can only edit unpublished pages (or create them if you assigned that ability somewhere).1 point
-
Hi, Here is what you can do to redirect the home page '/' to the French home page: Set page names for both languages for the home page ('en' for English, 'fr' for French) In the LanguageSupportPageNames settings, choose the option "No - Root URL performs a redirect to: /name/". When you go to the root url '/' it will redirect you to '/en/' Finally, create a module to hook into Session::redirect to force the redirection of the root url to the French translation as follows: public function init() { $this->session->addHookBefore("redirect", function($event) { if ($this->page->id == 1 && $event->arguments(0) == $this->page->localUrl('default')) { $event->arguments(0, $this->page->localUrl('fr')); } }); } The hook checks whether you are viewing the home page, and whether you are redirecting to the English url, and if so, it changes the url to the French url. This solves the problem of the home page. The problem remains if someone has saved a direct link to a page without a language prefix, e.g., '/about/', since this will still be redirected to '/en/about/'.1 point
-
I think you didn't add those fields to the user template? If so you can still add variables like above, but these are runtime only and won't be save, as there are no columns in the database for these fields. You can add fields to the user template like you'd do it with every other template. It's just hidden by default so you need to enable "show system templates" on top of the templates-list.1 point
-
There are a lot of new features in TableSorter, but mostly I'm just hoping to be able to reset sorting for admin tables. http://mottie.github.io/tablesorter/docs/example-method-sortreset.html1 point
-
@awebcreature I have modified the MapMarker module so you can add a polyline (both admin and front-end). You can download it here: https://github.com/madebymats/FieldtypeMapMarkerDraw Please note that you should not use the module in production, but may give you an idea how to build the functionality you needed.1 point
-
@horst you can add such functionality to your map via google maps api. https://developers.google.com/maps/documentation/javascript/examples/infowindow-simple @Mats nice! @awebcreature i have no experience with this using google maps but using openlayers. of course that's quite a beast regarding complexity and file size - here you have an example: http://openlayers.org/en/v3.2.1/examples/draw-and-modify-features.html. you can also achieve that with the simpler framework leaflet - there are plenty of plugins like this one you would need I'm thinking to create such a module for my master thesis - but you are 2 years early, sorry maybe you find some helpful code in my processwire mapping project "geowire": http://geowire.org/1 point
-
1 point
-
@ESRCH That login code will throw error if you login 3 times with wrong credentials... I already tried to put a note in those various (dozens already and lost track of) threads that use this "exact" frontend login code, which works but has one flaw. Problem is that once the login throttle kicks in you're left with a exception error. It's not obvious and I think posting that code in the forum over and over just creates problems in the long run for everyone copy paste such code. Funny thing is that the code originally is from Ryan himself. Either Ryan should change the behaviour of the throttle code or you need to use this code instead with a try catch to catch the login throttle error: if ($user->isLoggedin()) { $session->redirect($pages->get('/')->url); } if ($input->post->user && $input->post->pass) { $username = $sanitizer->username($input->post->user); $password = $input->post->pass; try{ $u = $session->login($username, $password); if ($u) { if ($redirectUrl = $session->get('redirect')){ $session->remove('redirect'); $session->redirect($redirectUrl); } else { $session->redirect($pages->get('/')->url); } } else { $error = "Wrong username or password. Login failed."; } } catch(Exception $e){ $error = $e->getMessage(); } }1 point
-
Nice! How about an option for tabs vs accordion, and maybe the ability to switch from tabs to accordion automatically on phone sized devices?1 point
-
@all Just pushed v0.6.0 adding... Config of watches using empty strings (detect changes from empty->non-empty or vice-versa.) Hookable triggerMatch() method - so you can define your own actions when a watch triggers.1 point
-
I recommend using either Textile or Markdown if you need to support this type of stuff in your image/file descriptions. For instance, in Markdown you would make bold text **like this** You'll need to run your image/file descriptions through Textile or Markdown before outputting them. So can do that like this. I'll use Markdown in this example since the module is already in the core. $markdown = $modules->get('TextformatterMarkdownExtra'); $description = $page->image->description; // your image description $markdown->format($description); echo "<p><img src='{$page->image->url}' alt='' /> $description</p>"; We'll likely add internal support for these Textformatters for image/file descriptions in the near future, so that you don't have to do the above if you don't want to.1 point