Leaderboard
Popular Content
Showing content with the highest reputation on 02/15/2013 in all areas
-
Hi everyone! With Batcher you can batch-edit and create Pages in the Pw Admin. If you install this module, you get a new Page "Batcher" under Setup. Modules page: http://modules.processwire.com/modules/process-batcher/ Github: https://github.com/wanze/ProcessBatcher Editing How does it work? Search your pages with a selector. You can check if you want to include also hidden/unpublished pages with the filters. Select the pages you want to execute an action (the action only gets executed on "checked" pages). Select the action and if necessary, additional data like the new parent or the new template. Execute. Supported actions: Publish/Unpublish Pages Hide/Unhide Pages Lock/Unlock Pages Trash Pages Delete Pages Change Parent Change Template Batcher does the following permission checkings for the current user: Don't display pages that are not editable Remove Actions if the user doesn't have the permissions (page-delete, page-move, page-template, page-lock) Important notes: When changing a template, data in fields of the old template which are not assigned to the new template gets deleted. When changing the parent, the template of the new parent must accept the pages template as children. This is a setting in the template under "family". Creating How does it work? Select a parent where your new pages will be added as children Add as many pages as you want by clicking "add Page" Click "Create Pages" You must enter a title and choose a template. The name is optional: If left empty, Pw will generate this for you. Includes permission checking and Family template restrictions. This means in detail: The selected parent must accept children and their template The pages template must accept the parents template User needs the permission to add children to the selected parents template User needs the permission to create Pages for the chosen Template Batch-creating tips The chosen template and the statuses are always cloned from the last row. So if you need to add 30 pages with the same template, define it first and the click "add Page" - it'll make your life easier ;-) You can drag & drop the table rows should you want to change the order. The dragging looks ugly but it works. For the lazy dogs and keybord hackers among us, you can add a new row by pressing "ctrl+n". This works (at least in firefox) only if no input has focus. After adding a new row, the title input gets the focus. By pressing 3 times tab you arrive at the published-checkbox, here the short-cut works. Restrict Batcher for a user to only allow editing or creating Create permissions "batcher-edit" and/or "batcher-add". As soon those exists, the module checks if the current user has the permissions. If you only need batch creating, check out the following module by Soma: http://processwire.com/talk/topic/2138-process-tools-create-pages-wip/ Cheers4 points
-
Hi, I have had some (more) trouble to get started with PW :-( In my php.ini the default_charset was set to 'ISO-88591' or something similar. So, as the DB uses utf8 and the pages are delivered in utf8, php is required to use it too. If not you can run into errors when try to save strings with e.g. german umlaute: äöü ÄÖÜ Incorrect string value: '\xFCchte ...' for column 'data' at row 1 I'm not sure if this was checked with the install routine, but I have seen only green lines Maybe this could be done to avoid some hassle to users with a setup other than utf8. Or it maybe an option to add "ini_set('default_charset','utf8');" somewhere at the top of index.php, and to be very very sure (also for paranoics like me ) one can set and check it: ini_set('default_charset','utf8'); $php_use_utf8 = strtolower(trim(ini_get('default_charset')))=='utf8' ? true : false; Ok, now I can start try out that wonderful CMS2 points
-
I appreciate the kind words. I'm hoping that soon I'll be confident enough in my ProcessWire knowledge to help others on the forums like this community has helped me.2 points
-
I have nice module to share to make users list more manageable with 1000+ users. I don't remember if I have released it yet though (and on mobile now).2 points
-
1 point
-
Wanze, you are a legend, have you been reading the Wishlist/Roadmap? Will check this out hopefully tomorrow, have a great Friday evening!1 point
-
Yes, anything that you are inserting into HTML. For instance: <input type="anything" value="this needs to be entity encoded" /> <input type="anything" any-attribute="this needs to be entity encoded" /> <textarea>this needs to be entity encoded</textarea> <h3>this needs to be entity encoded</h3> (The text "this needs to be entity encoded" is the user input, not the tags) Anything in HTML like this needs to be entity encoded, unless you want the browser to interpret it as markup. Usually you don't want user input to be treated as markup by the browser, because it gives them control over the page.1 point
-
just a thought about install routine: what about a select option for the date/timezone? In the moment you have to change it manually in the /site/config.php1 point
-
his form works now on my local machine, andre you got mail with the corrected code. for those interested, after his validation he started with else, this point the script didn´t reached when pass was updated. i just added a $formerror and asked instead of else if $formerror is false.1 point
-
no solution yet only a quick tip. if (empty($input->post->username) is the same to: if(!$input->post->username) i will dive into your code in my next break.1 point
-
Mostly repeating what's already been said. But if that disclaimer page is always going to be off the root, regardless of whether on your development or production server, the I would just do this: <a href='/disclaimer/'>Disclaimer</a> If the site may move around from one subdirectory to another (like between development and production, as is the case for me), then I'd do this: <a href='<?=$config->urls->root?>disclaimer/'>Disclaimer</a> If you want to account for the possibility that the disclaimer page may move, then you'd do this (where 123 is the ID of the disclaimer page): <a href='<?=$pages->get(123)->url?>'>Disclaimer</a> Though note that you are then talking about more overhead in this last example, relative to the first two. So it's rare that I do this, unless it's a page that needs to move often (don't think I've run into that situation).1 point
-
Eventually we will support this type of OR expression in selectors. But currently you can't do this: (max_date>=$today OR max_date=0). So the current strategy of your setup does not lend itself well to pagination in ProcessWire. What I recommend doing instead is one of the following: Have a separate checkbox for "frontpage_always" or something like that. When checked, it is always used, regardless of max date setting. Rather than checkbox toggles, use page references to provide options like: "Frontpage till max date", "Frontpage always", and possibly others. Another thing to note is that you don't need to convert $today to a timestamp (though it doesn't care if you do). You can just pass in the YYYY-MM-DD string and it'll be fine with that too.1 point
-
Moin, sehr gute Idee! Thomas Fritscher, Köln, https://plus.google.com/116986246464503235258/about1 point
-
1 point
-
Or: $config->urls->assets For other runtime config urls: http://processwire.com/api/variables/config/1 point
-
Try to find czech translation as i think its the most complete regarding files. But youd have to create your own just for knwing which are there. You could also use grep or file search to search for patterns of the __() and $this->_() functions.1 point
-
A child page of the Commercial Banks page is a descendant of each parent. So there is an assignment already that you use can by leveraging a selector in a template. You would use a has_parent selector to build the pages array that met that condition in your template. You can just leverage the page tree and the structure you build.1 point
-
Well, you can do various things. When I do galleries or slide shows I sometimes like complicated overlays. So I might have a couple of text fields (one for image title and one for some text) and maybe a secondary image or using the image thumbnail module so that I can create a small, cropped thumbnail to use as a detail image. And then I wrap that whole lot up in a repeater field You can get too complicated of course .... Oh, and don't forget you can set whether a field is required or not on a template-to-template basis.1 point
-
I'm very new to Processwire and one of the first things I needed to do was install the markdown module. The installation process is simple (see the solid documentation page here) but for those like me who are new to Processwire, once you install the module, you also need to tell fields in processwire to use markdown on the content. This is pretty simple. From the admin, go to the SetUp section and then click through to Fields->body->Details and there you'll see a dropdown menu where you can select text formatters. I, personally don't care for WYSIWYG editors once markdown is implemented, and you can additionally turn off those editors on the same page by making the body field a 'textarea' instead of 'tinyMCE' in the InputFieldType section.1 point
-
Greetings, I made a profile from a version 2.2.9 site I'm developing, re-installed it as a test site, then upgraded it to 2.3. So far, have not noticed any problems. I will test a fresh installation soon. But I think if the upgrade works we must be in good shape (I assume upgrades are the more challenging scenario). I really appreciate the way this upgrade is being handled: - Paying careful attention to detail - Communicating with the community - Involving everyone in the process Looking good!!! Thanks, Matthew1 point
-
One project upgraded from 2.2.9 to 2.3dev without problems. - Apache 2.2.23 - PHP 5.4.11 - MySQL 5.5.301 point
-
Something I am doing at the moment is a very basic theming system for posts on a blog. Basically, all posts are wrapped in a nice obvious div class "posts" and there is a separate style sheet for all the markup within that div container. Then, on every post, you can select from a theme. This just adds a style sheet where you can override anything in the posts.css file. You can create a whole pile of these and create matching selectors. I might also throw a few extra things in there like reversing sidebars and so on. But at the end of the day, all the styling is in a style sheet and not inline - all the author is doing is selecting from a list determined by the developer. (Note: I am also building in a site-wide version, though having added the functionality, I have yet to work out how I will use it! )1 point
-
I just upgraded my local /wire from 2.2.9 to 2.3. Smooth sailing so far. Are my eyes cheated by some spell or am I seeing a speed BOOST?? - MySQL 5.1.67 - PHP 5.3.6 - Apache 2.2.201 point
-
Hi Crownofthorns Depending on what your experience level is, you may want to try one of these tutorials (or both!) http://wiki.processwire.com/index.php/Small_Project_Walkthrough http://wiki.processwire.com/index.php/Basic_Website_Tutorial The first is a really good introduction to the system, the second is more about getting you started.1 point
-
Ah I found the error: $name = $u->name; $pass = $u->pass; if ($session->login($name, $pass)) { $session->redirect("../"); } This cannot work because $u->pass is already encrypted by Pw. You need the Password in plain-text for the login: $pass = $input->post->pass; $message = "Congratulations! You have successfully registered and have been logged in"; echo "<h5 class='success'>$message</h5>"; This message will never appear because you do a redirect after creating the user.1 point
-
Hi onjegolders, Can you tell us what exactly doesn't work? I'm not sure but I think it should be possible Have you tried $session->redirect('./') instead of ->redirect('../'); A few suggestions to the code: <input type='text' name='first_name' value='{$input->post->first_name}'> If the user submitted a value with quotes or other html signs, this will brake your form. You should escape the post vars: $v = $sanitizer->entities($input->post->first_name); <input type='text' name='first_name' value='{$v}'> To check if a user name already exists, this might be a better way than query all the users: $username = $sanitizer->pageName($input->post->username); $u = $users->get($username); if ($u->id) $message = "Sorry, that username is already taken..."; Cheers1 point
-
Than you should use soma's solution if(!$users->get($username)){ // go ahead, add the guy } edit: but it's good that you learned the array stuff1 point
-
There was exactly same question 1 week ago... ok again http://processwire.com/talk/topic/2584-numchildren-vs-children/?hl=%2Bnumchildren+%2Bcount $page->numChildren returns ALL children count. count($page->children); //or $page->children->count(); return only viewable pages by the user, which mean NOT: unpublished, hidden or non-accessible pages.1 point
-
numChildren is returning all pages and children->count is returning only the published pages1 point
-
or if($users->get($username)){ // username found } not sure what you're doing exactly as always to give simpler solutions This would also work, foreach ($users as $u){ echo $u->name; } And if in an function scope where $users is not available: foreach (wire("users") as $u){ echo $u->name; }1 point
-
This should also output the names foreach ($users as $u) { echo $u->name; } And you can put them in an array like this $names = array(); foreach ($users as $u) { $names[] = $u->name; } print_r($names);1 point
-
There is probably a better way just using 1 selector string, but you could do two, and then sort the resulting pagearray - $my_pages = $pages->find("template=post, frontpage=1, max_date>=$today, limit=10"); $my_pages .= "|" . $pages->find("template=post, frontpage=1, max_date='', limit=10"); $my_pages->sort("-created"); (Written in browser, but should work.) ***Edited since arjen's reply below but still doesn't work. I give up1 point
-
Looks like the University of Oregon cheerleaders/dance team have made excellent use of the Blog profile: http://uodance.com/1 point
-
1 point
-
Here is the first release version of the Blog Profile! http://modules.proce...s/blog-profile/ It is now up on GitHub as well: https://github.com/r...ign/BlogProfile Below is a lot more talk about this blog profile and how it works, but if you just want to install the profile and test it, it's not necessary to read anything further unless you want to. I've simplified this a lot from where it's been. It does all the same stuff on the front-end, but the code behind the site is no longer a huge departure from the basic profile. I've rebuilt this profile 3 times trying to find the right balance between making it as flexible as possible and making it as easy to understand as possible. I think it's got a better balance now than before. It's now at a point where it does everything it always has, but the template code behind it should be a lot more accessible and easy to understand. There is no longer a separate module or API variable. Everything here just happens in /site/templates/ files. Consistent with making it simpler, I've also removed the drag-n-drop theme support. While it was cool to have, it always felt a little dirty introducing some kind of proprietary theme support that was so different from the way I'd build any other site. This thing is pretty darn simple to theme as it is (just edit a CSS file). Maybe we'll take it further in the future, but we don't have many PW site profiles out there right now (1 or 2?) and so I decided this profile needed to stay more accessible on the back-end. How the template files work In ProcessWire there are any number of ways you can use your template files. In this case, we are using our template files (in /site/templates/) to populate 3 variables ($content, $headline and $subnav) and then including an HTML file (main.inc) to output them in the right places. The $content variable represents the center (body) column, the $headline variable represents the text headline of the page, and the $subnav variable represents the navigation that appears in the left sidebar. Once one or more of these variables is populated, the template file includes the /site/templates/main.inc file. That main.inc file is just a big HTML file that outputs the $content, $headline and $subnav variables in the right places. We've made an attempt here to separate most of the logic used in the template files from the output. Most of the markup is generated from files in /site/templates/markup/. These files are included from the template files to output specific things like a blog post, comment, etc. Because a lot of output needs are similar among the various template files, we've created a file called /site/templates/blog.inc that has a few shared functions in it. If you look in any of the template files, you'll see that most of them include blog.inc as the first thing. This blog.inc file also initializes our $content, $headline and $subnav variables, mentioned earlier. Outline of /site/templates/ with this profile /site/templates/blog.inc Shared blog-specific functions included by most site templates. /site/templates/main.inc The main HTML markup file through which everything is output. /site/templates/markup/ Contains PHP files that generate markup for specific things like posts, comments, etc. This is separated from the site templates to make it simpler for you to modify the markup if you want to. This is primarily used by the blog.inc functions, but also included by a couple templates as well. /site/templates/skeleton/ This is the Skeleton CSS framework. It is identical to the one they distribute except we added a wider viewport to it. You probably wouldn't have much need to edit anything in here. /site/templates/styles/ Stylesheets used by the blog profile. The most useful one in here would probably be theme.css, which contains all the color definitions for the profile. /site/templates/scripts/ Javascript files used by the blog profile. Not much is happening in here at present.1 point
-
I think this would be pretty straightforward to do. Assuming you are recording a per-page count, then you'd want to add a integer field to the page (called 'pageviews' or something like that). Then at the bottom of your template: <?php $key = "pageview" . $page->id; if(!$session->$key) { $page->pageviews++; $page->save('pageviews'); $session->$key = 1; } You may also need to add a $page->setOutputFormatting(false) above that if PW throws an error. And you might prefer to take it a little further and use an array in your $session var. The only real problem with this method is that a portion of pageviews on any site are going to be from bots, spiders, etc. You can eliminate nearly all of those by setting up a new template/page that does nothing but record pageviews and hit it with javascript. The example assumes you set this up at /tools/pageview.js (a PW page), and you would paste this somewhere in your template that powers the pages you want to track: <script type='text/javascript'> // write the script statement with JS so that spiders don't attempt to include it document.write('<scr'+'ipt type="text/javascript" src="/tools/pageview.js?id=<?=$page->id?>"></sc'+'ript>'); </script> Then your template running /tools/pageview.js: <?php if(($id = (int) $input->get->id) > 0) { $p = $pages->get($id); if($p->id && $p->fields->has('pageviews')) { // page was found and it has a 'pageviews' field $key = "pageview" . $page->id; if($session->$key) { // pageview already recorded for this page, so skip it } else { // pageview not yet recorded for this page for this user session $p->pageviews++; $p->save('pageviews'); $session->$key = 1; } } } echo "// this JS file intentionally blank"; I assume you meant thousands not hundreds. But regardless of the number (or even if it has a couple extra zeros), it should not be a problem. You won't notice a difference in performance. And given that you are just saving one field 'pageviews', rather than the entire page, it'll be especially fast (at least in 2.1).1 point