Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 07/03/2017 in all areas

  1. You could try one or other of include=all and check_access=0 (see https://processwire.com/api/selectors/#access_control) in your selector, which may help with debugging.
    3 points
  2. Your setup is currently a mix of two approaches. The urlSegment approach clashes with your category site structure, since urlSegments only work for sub paths that don't exist in the site tree. To match up your design with Ryan's events example, the category page wouldn't have a template that is supposed to be rendered on the website. You would assign your categories-list template to /recipes, then url segments would be active for every request for /recipes/something for which there isn't a real "something" page under /recipes. Then you could call /recipes/category/bakery and have "category" in urlSegment1 and "bakery" in urlSegment2. The /category tree would just be there to hold data, not to be rendered.
    3 points
  3. I tested and cannot reproduce. For published pages, editing and saving a page updates the modified timestamp but not the published timestamp. But for news pages I think it is more typical to add a datetime field to the template to serve as the posting date, so the user can change the date to suit. For instance, to set a future posting date and then in your news selector you exclude pages with posting date greater than today.
    3 points
  4. Agree, but are we sure the right script has been executed with the right usernames? Perhaps they don't know the right usernames and therefore it seems like it won't work. I would suggest looking up in the database. Assumptions ... @jen, where did you execute the reset script? Did you get any errors?
    2 points
  5. When all passwords won't work anymore at the same time I'm pretty sure someone changed the salt in the /site/config.php. Otherwise find a superuser in the 'pages' table in phpMyAdmin or another databasetool and try to reset it.
    2 points
  6. Welcome @Cabcom, Sure it is possible, but not a simple task. You'd be looking at something like the following: Create elements (divs or whatever) in the front-end that represent your repeater items (probably using repeater item page ID as an identifier). Use some Javascript on the elements that supports drag-and-drop sorting - I'm sure there are a number of off-the-shelf solutions for this. When a submit button is clicked, submit an array of the the repeater item IDs in the current sort order to a ProcessWire page (using a form or AJAX). In the template for that page, get the submitted array and apply the sorting to the repeater field using the API. It might be easier to remove all items from the field and then add the items back in the array order than to try and adjust the sorting of the items already in the field. If you are up for the challenge I'm sure you'll find help here in the forums if you get stuck on a step.
    2 points
  7. If you only ever have one category per recipe, putting the recipes in their category is perfectly fine. One usually uses url segments if one item can belong to multiple categories, like a bread roll recipe belonging to bakery, bread and vegetarian at the same time, and/or if you have (or are expecting to add) other filtering criteria similar to categories (ingredients, preparation time, rating, year...) on the same list page so you might end up with a query link like /recipes/category/bakery/ingredient/flour. It all depends on how complex you plan your site to get. You don't have to touch the recipe template/pages themselves, you could simply assign the categories-list template to the recipes' parent and pull in the found recipes. But, as I wrote above, you can keep with your current approach and do things the straight forward way. It would probably be best to toy around with url segment based searches a bit before you implement them in a real life project. I've always got a few "playground" sites on my dev machine for testing things like that, sites which I just delete when they get too convoluted and replace with a fresh install of PW.
    2 points
  8. @MilenKo Lets take a step back. Create a page named "test-url-segments" with home as parent and assign it a template (whichever), edit that template and enable url segments. Edit the template file for the template assigned to "test-url-segments" and echo $input->urlSegment1. Now go to domain.tld/test-url-segments/i-am-a-segment and you should see i-am-a-segment and you where you echoed $input->urlSegment1.
    2 points
  9. Restrict Repeater Matrix Allows restrictions and limits to be placed on Repeater Matrix fields. Requires ProcessWire >= v3.0.0 and FieldtypeRepeaterMatrix >= v0.0.5. For any matrix type in a Repeater Matrix field you have the option to: Disable settings for items (cannot change matrix type) Prevent drag-sorting of items Prevent cloning of items Prevent toggling of the published state of items Prevent trashing of items Limit the number of items that may be added to the inputfield. When the limit is reached the "Add new" button for the matrix type will be removed and the matrix type will not be available for selection in the "Type" dropdown of other matrix items. Hide the clone button when the limit for a matrix type has been reached. Note that in PW >= 3.0.187 this also means that the copy/paste feature will become unavailable for the matrix type. Please note that restrictions and limits are applied with CSS/JS so should not be considered tamper-proof. Usage Install the Restrict Repeater Matrix module. For each matrix type created in the Repeater Matrix field settings, a "Restrictions" fieldset is added at the bottom of the matrix type settings: For newly added matrix types, the settings must be saved first in order for the Restrictions fieldset to appear. Set restrictions for each matrix type as needed. A limit of zero means that no items of that matrix type may be added to the inputfield. Setting restrictions via a hook Besides setting restrictions in the field settings, you can also apply or modify restrictions by hooking RestrictRepeaterMatrix::checkRestrictions. This allows for more focused restrictions, for example, applying restrictions depending on the template of the page being edited or depending on the role of the user. The checkRestrictions() method receives the following arguments: $field This Repeater Matrix field $inputfield This Repeater Matrix inputfield $matrix_types An array of matrix types for this field. Each key is the matrix type name and the value is the matrix type integer. $page The page that is open in ProcessPageEdit The method returns a multi-dimensional array of matrix types and restrictions for each of those types. An example of a returned array: Example hooks Prevent the matrix type "images_block" from being added to "my_matrix_field" in a page with the "basic-page" template: $wire->addHookAfter('RestrictRepeaterMatrix::checkRestrictions', function(HookEvent $event) { $field = $event->arguments('field'); $page = $event->arguments('page'); $type_restrictions = $event->return; if($field->name === 'my_matrix_field' && $page->template->name === 'basic-page') { $type_restrictions['images_block']['limit'] = 0; } $event->return = $type_restrictions; }); Prevent non-superusers from trashing any Repeater Matrix items in "my_matrix_field": $wire->addHookAfter('RestrictRepeaterMatrix::checkRestrictions', function(HookEvent $event) { $field = $event->arguments('field'); $type_restrictions = $event->return; if($field->name === 'my_matrix_field' && !$this->user->isSuperuser()) { foreach($type_restrictions as $key => $value) { $type_restrictions[$key]['notrash'] = true; } } $event->return = $type_restrictions; }); http://modules.processwire.com/modules/restrict-repeater-matrix/ https://github.com/Toutouwai/RestrictRepeaterMatrix
    1 point
  10. All 3 issues above should be fixed in v149, thanks!
    1 point
  11. Thank you both for your reply. I tried it on a fresh installation of processwire and it worked fine as you stated. So it had to be something specific in my project. It couldn't be my templates, I never did anything with the modified and published values besides echoing them. So I had a look at my installed modules. And it turned out that some of them used those values. The module "batch child editor" had the most hits when I searched for the term "published" and after I uninstalled it and edited one of the articles, the two values were diffrent. So I assume something in that modules overwrites the published value every time I edit a page (I never edited those particular articles via that module). I either configurated it wrong (I haven't seen any option that could explain this behaviour though) or it is a bug in the module. I contacted the autor of the module, so he can check it out just in case. I will probably still add a custom date field to be more flexible, thanks for the input.
    1 point
  12. That's a bit dangerous, since not every template may have the field you're adding a search for. Also, the value passed in $selector may be a regular selector string, a page id, an array of page ids or even an instance of the Selectors class. For most of those, simple concatenation isn't an option, and I'm suspecting that the error is caused by that. Perhaps peeking at $selector with Tracy Debugger can give you a quick insight into what exactly $selector contains when the error occurs.
    1 point
  13. Hello, maybe Xampp have some problems in PHP or Apache config. try using something different like http://www.wampserver.com/en/
    1 point
  14. require "index.php"; $admin = $users->get('admin'); // or whatever your username is $admin->setAndSave('pass', 'yo123456'); $session->redirect($config->urls->admin); @jen, something else is happening that we don't know about. Do you get any error messages? 404 page? Do y'all know the admin url?
    1 point
  15. Why not use http://modules.processwire.com/modules/process-jumplinks/ ? Wouldn't that be less problematic?
    1 point
  16. Thanks, you helped me find a bug in my own code that resolved my issue
    1 point
  17. Hi, so you passed "Database Config" (see on this page too) but "Admin Panel Information" is missing from the page while "Test Database and Save Configuration is there"? Any PHP error log entries? You might have a HTTP Host name issue. Try to use 127.0.0.1 instead of localhost. Edit: added missing link to @clsource's blop post
    1 point
  18. @jploch The crux is with the transparency of the background. The original image is recognized as a transparent, animated GIF. But the stored transparency color index validates to 0,0,0 (black !) I have opened your image in photoshop and added 1 layer filled with white to the base of the other 60 layers. The animated resulting GIF is same size as yours with transparency but works with the anim module: To sum up: the anim gif module doesn't work in any case with this sort of images. The culprit is the transparency background. If you are able to add a filled background layer to those images, it will work good with resizing. (test the image above) If you also need the transparent background, you cannot use any sort of variation creation. Workaround could be to determine in template file if it is a GIF (or only if it is an animated GIF) and then use markup with a special css class for displaying those in different sizes, according to media query max-width, for example.
    1 point
  19. @szabesz Yes, I just exported the whole profile which would allow me to upgrade easily my PW to 3.0.65 or downgrade if a need be. It all worked the same way it did on the localhost but not with the urlSegments. @BitPoet What you say makes perfect sense now and explains why it would not work in my scenario. Considering the fact, that I already have a page Recipe Categories which would point to food.pw/categories/ and just need to be able to browse to a specific category showing the pages that have it selected, would you suggest another approach other than creating the categories as parents and placing the recipes as children of them? I did a profile already that way and it worked just fine, but I was trying to extend my knowledge using the present approach. Thank you guys for sharing your experience. It means a lot to me! Even though PW has been flawless so far for my needs, I am not just trying to make the profile work but have some learning curve I could use in the future to extend my knowledge and have eventually one much smarter, simpler and cleaner sollution. P.S. Reading your suggested approach, I am afraid that I already gone far in developing the recipe-inner template which is assigned for every recipe and pulls up quite a lot of frontend formatting etc. so I won't be able to assign the category-list template to my recipes and break the functionality that is already at a final stage.
    1 point
  20. Meaning you exported it and installed ProcessWire while choosing it during the install process? It should work, however, normally I just copy over all files and the database too, adjust site/config.php and .htaccess and it should work if requirements are met. In some rare cases you might also need to trucate the cache table of the db, see: urlSegments are integral part of the system, they should work if everything else works too I guess.
    1 point
  21. +1 I would not rely on system internal values for such a thing since you should let your editors decide what date to pick, and they should not change system internal values whatever they may be. BTW, I often push it a bit further and create an "Event Date" too, to signal when a particular event took place (if appropriate, of course, so such a field is optional).
    1 point
  22. @jploch I have tested this and created a new Rendering Engine, but for me, every created variation has the same (wrong) result as your example. It is something in that image that doesn't work right with the lib. I think it is a false transparency for every slide in the animation. Are there other images that behave the same? In your "working example" that result in correct variation, I belive it is the original image or simply copy of it. You use ->width(300) and the original is 300px. For me, every downscaled variation doesn't work correct.
    1 point
  23. @arjen thanks! Checked with different selector types = exactly what I need! Just minor fix - adding $selector2 needs to be done through new Selectors($selector2).
    1 point
  24. Hi @valan, you need something like this? $selector1 = "template=basic-page"; $selector2 = "status=123"; $mergedSelectors = $this->wire(new Selectors($selector1)); $mergedSelectors->add($this->wire(new Selectors($selector2))); // Updated see comment valan // to output a PageArray echo $this->wire('pages')->find($mergedSelectors); // or to output the selector as string echo $mergedSelectors->__toString(); // See: /wire/core/Selectors.php
    1 point
  25. Something (someone?) must have changed your site I guess. Loosing all passwords and at the same time you have a site that "somehow" changed? Do you have a backup? BTW, more troubleshooting tips can be found here, for example: https://processwire.com/docs/tutorials/troubleshooting-guide/page2 https://processwire.com/docs/install/troubleshooting/#general-troubleshooting-upgrade-tips
    1 point
  26. Howdy @jen, and welcome to the forums. First, you can use this RESET to gain access to the admin page. Then we can proceed from there.
    1 point
  27. This is the second site we've built for Visualization. The first launched some 5 years ago and was based on a different CMS (before we started working with PW). The site is fully responsive and features a 'quick quote system' using the FormBuilder module to manage quote requests and email both customer and site owners with the calculated quote. The prices for each part of the quote calculation are editable by the client in the CMS at any time. Every page features Meta Title and Description override option fields with tag content falling back to values based on the page's content if these are not filled in. Other than PW core v 3.0.42 additional modules are FormBuilder, ProCache and markupBlog. Any feedback welcome! http://www.avrackbuild.com/
    1 point
  28. Just for the record: I just had the problem that pages with a certain template did not save content any more. There was the green notification "Saved" but the changed fields have forgotten any changes made. The reason was that I had a fieldset in the template in the wrong order: The fieldset_END part was before the opening fieldset part. Maybe there was some inadvertent dragging of the wrong field. (tested with ProcessWire 3.34) Maybe this is useful to know for someone having the same mystery issue. Edit: This issue was solved in PW 3.35
    1 point
  29. You cannot return things from hooks via the return statement. Instead pass the return value into $event->return like I did it in my example.
    1 point
  30. I think you should be able to achieve what you want by hooking into Page::editable I think this should do what you are looking for - just edit the template you want to match. Keep in mind that in this form it will even prevent superusers from editing the page, so you might want to check that before adding the hook $this->addHookAfter('Page::editable', null, 'hookPageEditable'); function hookPageEditable($event) { $p = $event->object; // in case there is already a defined exclusion for this user's role for this page if(!$event->return) return; if($p->template->name == "basic-page" && $p->hasStatus(Page::statusUnpublished)) { $event->return = false; } else { $event->return = true; } }
    1 point
×
×
  • Create New...