Jump to content

Recently Updated Topics

Showing topics posted in for the last 7 days.

This stream auto-updates

  1. Past hour
  2. Thank you both for the replies! Little by little I'm learning which areas of ProcessWire are okay to customize, and figured it was best to check. 🙂
  3. Today
  4. Turns out the pdf file was actually broken and the code was working just fine... For anyone else who might end up here, this is the code I used (in Tracy Debugger console): // $page->files targets the field on the page with name "file". Change name with your own $directory = $directory = $config->paths->assets . "files/$page->id/"; //path to asset folder of current page $page->of(false); foreach (scandir($directory) as $file) { // loop through all files in directory if ($file !== '.' && $file !== '..') { if ($page->files->has($file)) { continue;} //skip if file is already in field $page->files->append($file); //append file to field $files->rename($directory . $file, $directory . $page->files->last()->name); //rename original file to name in field after sanitizer } } $page->save(); $page->of(true); thanks @MarkE for your assistance
  5. Hello so i managed to implement pagination to my site, i have navigation rendering done like so $out = ''; $root = $pages->get("/"); $children = $root->children("limit=150"); // $children->prepend($root); foreach($children as $child) { if($child->numChildren && $child->id !== 1) {// @note: you could do some more checks here; $out .= "<li>"; $out .= "<a class='dropdown' href='javascript:void(0);'>{$child->title}</a>"; $out .= "<ul>"; foreach($child->children as $level1) { if ($level1->hasChildren()) { $out .= "<li>"; /* if ($level1->numChildren()) { $out .= "<a href='{$level1->url}'>{$level1->title}</a>"; $out .= "<ul>"; foreach($level1->children as $level2) { $out .= "<li>"; $out .= "<a href='$level2->url'>$level2->title</a>"; $out .= "</li>"; } $out .= "</ul>"; } else { */ $out .= "<a href='{$level1->url}'>{$level1->title}</a>"; /* } */ $out .= "</li>"; } } $out .= "</ul>"; $out .= "</li>"; } else { $out .= "<li><a href='{$child->url}'>{$child->title}</a></li>"; } } echo $out; echo "<li><a href='{$root->url}'>{$root->title}</a></li>"; which works flawlessy for my page withing children any page, except when i enter pagination the whole menu entry dissapears as i click link to page2 in pagination, idk why but when my url is www.page.sk/page2/ my navigation dissapears except the last entry which is echo "<li><a href='{$root->url}'>{$root->title}</a></li>"; i tried debugging it and i found out that variable $children is just empty like why would $root->children("limit=150"); wouldn't work in url segment? is this some sort of bug ?
  6. no i wasnt aware of -> not() functinon this works fine i found out one workaround by myself i checked if field which as every page isnt empty but this is very good solution thanks $kat = $pages->find("subor_hry>1, $limiter");
  7. Hi all, is there any piece of content that impressed you for a while? If you still remember it or save it, can you please share it with everyone here?
  8. @erikvanberkum, I've merged your question from general support to the support thread of the FieldtypePDF module. You may also want to open an issue about this in the FieldtypePDF GitHub repository. Also, please make sure that you're running the latest version of the module 🙂
  9. hi, honestly, i doubt anything in the index.php file will change anything as in the case you describe you don't get the right one... instead i would try something in the htaccess file, something like <IfModule mod_headers.c> Header set Cache-Control "no-cache, no-store, must-revalidate" Header set Pragma "no-cache" Header set Expires 0 </IfModule> but even this, i'm not sure it will work for a client browser cached file as it will even not have a look at what happens server side before serving the page... have a nice day
  10. Hi, huh, this is really weird, first thing that i can say for sure, the htaccess line you quote has nothing to do with this, i have many pw websites and the 404 page works fine without touching anything in the htaccess file, even changing its slug (http404) for something a little less geeky and a little more frenchy 🙂 (and quite often with a custom template file too) the only case i can imagine in the htaccess file would be a multilingual website with multilingual slugs for this page, some containing non ascii characters, if using point 14 in the htaccess file after having changed the default slug, you may need to change it in this section too except for this really particular case, i can't see where the problem could be without having a close look at your own code, if i were you i would start with - _init.php, init.php, ready.php files if you use any of those, do you use any regex, hook, custom redirection or else that could cause an issue for pages that don't need any - header or _main.php (i'm a great fan of markup regions :)), same reasons etc, actually, any kind of code you've written, php or js, that is supposed to work on every page. if you have any, exclude the 404 page from its execution and see if it changes something hope you'll find something out... have a nice day
  11. I swear I tried that and it didn't work. But maybe I did something wrong and didn't notice. Anyway, it works now after looking at it with a fresh mind.
  12. Yesterday
  13. In most cases I expect people to use the Select Image inputfield in conjunction with the Dynamic Options fieldtype. And regarding the value of a Dynamic Options field: The Select Images input type is a bit of a special case because it can be a "multiple" or a "single" input type: And beyond that there is a config option for Dynamic Options that can be used if the values that are saved are paths or URLs to Pagefiles or Pageimages, and this could be a good option when you're using Select Images as the inputfield: When that option is enabled you could use the Pageimage sizing methods on the field value. Note that for multiple images the value is an array of Pageimage objects and not a Pageimages object. That's because these modules are intended to be flexible enough to allow selection of images from more than one PW page but a Pageimages object only supports Pageimage objects associated with a single page (see the class constructor). The readme for Select Images says: So you can have the value for each option (thumbnail) be any string you like and output that in a template file or use it in a conditional to affect the page markup in some way. But I think my most common use case will be as an "image reference" field to select URLs to Pageimages and have the formatted value be a Pageimage or array of Pageimage objects. People have suggested different use cases for an image reference field in the GitHub request linked to at the start of the readme: https://github.com/processwire/processwire-requests/issues/207 Personally I have used image references in these scenarios: To allow an editor to select a social media "share" image from among all the uploads to Images fields on a page. In cases where an editor may only select from a collection of existing images and is not allowed to upload new images. Similar to the previous example, but where the editor needs to choose images that have been prepared in advance to fit in spaces with particular aspect ratios. So for a landscape space they can only select landscape images, square space can only select square images, etc. The allowed options for a Dynamic Options field are determined at runtime according to the FieldtypeDynamicOptions::getSelectableOptions hook you are using. These allowed options are used to validate any stored value when it is accessed. So if an image that was referenced is deleted then it will no longer be in the value you get from $page->your_dynamic_options_field
  14. ProcessWire 3.0.182 is now posted on the dev branch. For a review of what's in this version, see the "Latest core updates" section of ProcessWire Weekly #374 and #375 plus this week there have been 12 additional commits with new issue resolutions, improvements and additions which can be found in the dev branch commits log. It's possible that ProcessWire Weekly #376 will also cover some of these updates when it is released too. I'd planned on even more in this version, but ended up losing a day of work yesterday as we had no electricity all day (it happens). So I worked outside in the yard instead— 3 issues were resolved, 4 improvements were made and 1 garage was organized. Focus in the coming weeks is on our next main/master version (core, not yard). If you have a chance, please take a moment to add sites you've built with ProcessWire to our sites directory. And if it's one that's already in the directory, feel free to add it again when/if it goes through a major redesign or redo. I'm really motivated by seeing the great work that all of you do and always enjoy seeing more of it. Plus, I'm thinking @teppo also likely looks at the newly submitted sites when considering the site of the week for his ProcessWire Weekly issues. If you find the existing categories on the submission form don't quite match a site you want to add, please send me a PM to let me know and I may be able to add new categories. Thanks for reading and have a great weekend.
  15. Oh, I see. I'll give it a try.. I thought this option would take away the manual sorting option. Thank you!
  16. Interesting, this is the exact same implementation that I'm using however it's not keeping the cookie. May I ask if you are using Node JS server? I believe this may be the reason it's not working as mine is apache with vanilla JavaScript. I could prefix any call I need to be authenticated with the login query, my only concern is that would require using localStorage to keep a session alive but it isn't secure to store the login password. Have you had any success using vanilla JavaScript running on Apache @dadish?
  17. Or you could use the wireIncludeFile-function of ProcessWire. I prefer this over the PHP include-function. 😉 <?php wireIncludeFile('path/to/partial', [ "foo" => $foo ]);
  18. v0.1.3 released. This version adds options to set a limit to the number of items that may be selected. When the limit is reached the supported core "multiple" inputfields become disabled. It adds an option for the formatted value to be Pagefile/Pageimage object(s) where that would be relevant. And it integrates with the newly released Select Images module to create a kind of "image reference" field. See the updated readme for more detail.
  19. omg, that's it! unpublished children don't show. (which is sensible) Big thx! yes, thank you, shows! But why? Why do old pages show without? Anyway, now not published pages show as well.
  20. Just bumped this to version 0.5.0 which adds the ability to have a sandbox server token that gets used if the site is in debug mode.
  21. Last week
  22. True, but not applicable to usage of ProcessWire itself unless something's changed 😀.
  23. Thank you very much for this another great contribution. We are allready using it in a first live-project. I have one small bug: When editing snippets it will not save for me with an exception when i uncheck "enabled". When i save it enabled and then disable it from the list view all is working fine, so there is a workaround. the exception i got: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'enabled' cannot be nullIn /site/modules/Snippets/ProcessSnippets.module.php line 319
  24. Another handy update on v1.0.19 🙂 map(column, labels) Sometimes the value stored in the DB is a key that is not as descriptive as a text label. For example it could be that the returned value of a "sex" column is f for female or m for male. One option is to replace this value via JS which could have benefits regarding performance on large datasets, but it is a little more work to make everything work as expected (eg you need to take care of formatting of the cell as well as the sort and filter values). It might be easier to map the returned value of the finder to an array of labels in such cases: $sexes = ['f'=>'Female', 'm'=>'Male']; $rockfinder->find(...) ->addColumns(["sex", ...]) ->map("sex", $sexes); The column will then show male and female instead of m and f.
  25. In your config.php $config->prependTemplateFile = '_init.php';
  26. Thank you very much for your help. it worked perfectly! Here is my final code: $zeit_a = strtotime($jahr."-12-01 00:00:00"); $zeit_b = strtotime($jahr."-12-31 23:59:59"); $terminliste=$pages->find("template=repeater_termin_repeater, include=all, sort=termin_datum, termin_datum>=$zeit_a, termin_datum<=$zeit_b"); One other thing i had to figure out after that was the use of ->getForPage() to get access to the "origin" page.
  27. Thank you for your detailed answer, I'll have a look and come back with the solution (or questions) I'll come up with !
  28. I think Roland's excellent Admin on Steroids module can help you. There is an option to display the template of pages along with the options button in the tree menu. Look for this option and turn it on; Then you should be shown the template as you hover over the items in the page tree. Here's the correct template (client_index) being shown for a page on my local site; Hope that helps!
  1. Load more activity
×
×
  • Create New...