Jump to content

Wanze

PW-Moderators
  • Posts

    1,116
  • Joined

  • Last visited

  • Days Won

    10

Everything posted by Wanze

  1. Having different languages and a multilang field's value is empty, the value of the default language is returned. http://processwire.com/api/multi-language-support/multi-language-fields/#multi-language-field-values Can we change this behaviour? Is there any method to prevent this already at Db-Level? For example: I don't want to return pages that have an empty title in language xy. This doesn't work: <?php //Default Language set $pages->find("title!=''"); //Works!! //Any other language $pages->find("title!=''"); //Doesn't work, throws exception: Exception: Table 'db.field_title1' doesn't exist I know I can set of = false and then get the unformatted language value, but would be cool to exclude those pages in a search query.
  2. This was maybe already mentioned somewhere before, I haven't read all the posts. In my opinion, a Template Enginge makes sense in a MVC environment where the view is clearly separated from the logic in the controller and does not accept PHP. Usually it works like this: <?php //In Controller $showNav = true; $pages = query("SELECT * FROM....*"); $view->assign('pages', $pages); $view->assign('showNav', true); //In View {if $showNav} //.... {foreach $pages as $page} //... {/foreach} {/if} ?> In ProcessWire, you have the freedom: a Template can be just the controller and fetch another template for the output – or it can directly output Markup. Or you can mix those things up and leave the sometimes-overrated MVC-stuff. I think for most projects it's fine to find a way between. Personally, I wouldn't use Smarty in ProcessWire because when the Pw-Template is actually a Smarty-Template, where to put the PHP stuff? Where can I use the awesome Pw-API to search my content? Of course you can write smarty functions and assign variables in smarty, but this makes it again complicated. That said, I used smarty a lot and think it's great, especially the template inheriting stuff! But not in ProcessWire
  3. "The password system has recently been updated. Please change your password to complete the update for your account." When changing the password but using the same as before, this message still appears after login. Don't know if this is the intended behaviour. Edit: When changing to another and then again using the first, it's gone
  4. Martijn, In the moment I'm my own boss so this is possible Go ask yours, just mention that you have the best ideas while drinking beer! What did he say?
  5. There are some new config options in site/config.php that don't make it into the config when updating from older installs. Shouldn't those settings be present in wire/config.php? $config->imageSizerOptions = array( 'upscaling' => true, 'cropping' => true, 'quality' => 90, ); $config->pagefileSecure = true;
  6. Just updated Pw from 2.2.2 > 2.2.13. No problems, no errors, everything works as expected. Point 6: Having a beer now, cheers
  7. Hi ryan, I could not reprocude this problem on another installation. Everything works fine on the server of my hosting, first on a 2.2.2 installation then also on 2.2.13. One thing i noticed: If there's no "number of decimal digits to round to" set, the float value get's rounded to an integer, and this is also the value stored in the Database. Maybe there should be a default value in this field, for example 2? Empty or zero makes no sense, because no float gets stored.
  8. This is a good exercice to getting know the ProcessWire API A good overview how you can find pages and output content of fields: http://processwire.com/api/variables/pages/ And here's one solution among others, how you would do your menu: <ul class="blue nav" id="css3-menu"> <li class="dropdown"> <a class="dropdown-toggle_" data-toggle="dropdown" href="<?php echo $pages->get('/services/')->url; ?>">Services</a> <ul class="dropdown-menu"> <?php //We need to loop over the children of Services and output their links $children = $pages->get('/services/')->children(); foreach ($children as $child) { echo "<li><a href='{$child->url}'>{$child->title}</a></li>"; } ?> </ul> </li> </ul>
  9. Thanks guys, let me know what you think and how I could improve the module. Some possible actions to add: - Change User - Change Created-date @SiNNut To be honest, I knew that modx had a Tool called Batcher. I was thinking some time of a good name and finally decided to name it Batcher too, not very creative I know Batchman was another idea, based on Anti's Trashman. My concern is that if someone sees the modules title or searches for it, the current name is more suitable than badger? But I'm open for every suggestion, so maybe we can collect some ideas and make a poll?
  10. I agree with Pete. In my opinion, the "Designer" or "Front-end-guy" should do his stuff in plain HTML/CSS/Js. Then the dev copy paste this into a Pw-Template and makes it work there. A Pw template does not only output static html, most of the time you combine this with your fields assigned or you need to display data from any Pages anywhere on your site. This again is a task for the developper, maybe you must create new fields or queries before. Then you can mix this with the code from the designer. Using a Template language, you have the same problem: If the designer messes up the tags, ther Parser will throw an error and your template isn't displayed. That said, I don't know this workflow because where I worked, I received a .psd and had to do the front- and backend coding myself.
  11. Hi joss, Not sure if this is the error, but I think this code is not correct: $thisCategory = wire("page")->title; $posts = wire("pages")->find("post_category_select=$thisCategory, post_featured_category=1"); Try: $thisCategory = wire("page"); //Note: Now it's the page object and not the title $posts = wire("pages")->find("post_category_select=$thisCategory, post_featured_category=1"); Does it work?
  12. 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/ Cheers
  13. You have to click first on the title, then click on "move". Now you can drag the page somewhere else. If you want to change the parent, you have to click on the new parent first and open its children. Now you can drag a site under this parent. Also make sure that your user has the right to sort / drag children and that the parent template has no sort settings for children defined.
  14. Or: $config->urls->assets For other runtime config urls: http://processwire.com/api/variables/config/
  15. +1 for Google search as addition to the forum search. I almost never find the thread or the answers searching for with the internal search
  16. 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.
  17. 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..."; Cheers
  18. Ah now I understand... please ignore my post above, apeisa is right! Only pass those vars to the whitelist when the search form was executed.
  19. you're welcome, can you share some code snippets? I'm not sure if I understand what you are doing. If you have a search form on your site, you have set an action=xy attribute. If you are using get, then all your fields are appended to the url. Using post, this is not the case. If you don't need to paginate your search queries, I'm sure you could use post? For example: <form action="your-page" method="post"> <select name="dropdown1"> //..options </select> <select name="dropdown2"> //...options </select> </form> //In your template where the form is sended $dropdown1 = $sanitizer->selectorValue($input->post->dropdown1); $dropdown2 = $sanitizer->selectorValue($input->post->dropdown2); $results = $pages->find(""); //Use the post values to find your content But now you have a problem when you want paging the results, because when clicking on a page number the form doesn't fire anymore. This is where the get vars are appended to the /pagexy link from the pager, allowing you to paginate your custom results. This only works if you add the get vars to the whitelist oder specify them in the options.
  20. number of decimal digits to round to: Empty, but also doesn't work when entering a number numeric input type: Text Strange. I'll check out on another setup / environment
  21. This is the normal behaviour if you want search options via GET. Adding your get vars to the whitelist makes the pagination work with those vars. If you don't want to see the variables, use POST for your search form.
  22. Maybe a useful addition: $sanitizer->entities() Cheers Btw the cheatsheet is the best API overview/explanation ever seen! Thanks for making this.
  23. On windows I used pspad: http://www.pspad.com/en/pspad.htm It has built in FTP and you can edit files online, but I'm not sure if there's an option for syncing the files local -> remote on save.
  24. Having hard time debuging where my value gets rounded. The post-request ist okay, but: - InputfieldFloat::sanitizeValue already receives the rounded one. - Page::setFieldValue also already receives the rounded one Cannot dig deeper now, but is this something specific or can anyone confirm this issue? Cheers
  25. Hi ryan, Here's my setup: 1) Created a Float-Field "test_float" – no number entered under Details (rounding) 2) Insert a value in test_float, for example 3.5 3) Save 4) Reload and After saving the page, the value in the field is 4 This is also the value stored in the database, see my screenshot. The schema of "data" is correctly set to float
×
×
  • Create New...