Jump to content

heldercervantes

Members
  • Posts

    396
  • Joined

  • Last visited

  • Days Won

    15

Everything posted by heldercervantes

  1. I found this: https://github.com/TomS-/processwire-fieldtype-assisted-url Almost there, but it doesn't handle languages ?
  2. Is there anything as a field that allows the user to either select a page OR enter a URL? With what's available, it seems I can either give my editors a page field that doesn't allow them to point to outside URLs, or I give them a multi-language text field where they have to type the link in each individual language. This sucks. On some occations I've given both options. Page select and a multilanguage text field that overrides it. Not very elegant, sucks. Doesn't validate the URL, sucks. What would be awesome? A single field where the user either selects a page from the tree or inputs a URL with multi-language option. Also on the API, a boolean property that would easily tell if it's a page or manually entered URL that I could use to make it open in a new tab. ?⭐ Perfection!! Yeah, I know, been here long enough to know that by now I should be able to whip up a module like that. Alas, I suck.
  3. Thanks for the input guys. Sounds like a page per report is the most reasonable option. It all depends on the budget of course. There are a couple of issues that may carry a lot of complexity. First is how the clients (companies) are handled. I can either have a company be a user and then relate a report to that user for simplicity, or I can have the company as a page, a master user that's able to create sub-users for their staff. I'll need to build a UI to handle all that, which sounds lovely. Then there's the UI for uploading. Doing it one by one is not reasonable. Even uploading 50 reports and then being presented with a list where you select a company for each report sounds like something that's bound to cause errors (not sure if basing it on file naming convention would be much better though). I'll see that when I get there. Can't be sure of the best solution without seeing how those are produced.
  4. Hey guys, gals and everyone else. So, I'm sketching out a solution for a client, a platform where they deliver weekly reports to their clients, with a UI where clients log in to view their reports history. Each report is a PDF file Around 120 clients, meaning about the same number of PDFs submitted weekly Each client sees only their own reports, oc. What I'm unsure about is how to store all this. I'm thinking of making an interface where a zip file is uploaded, each PDF inside follows a rule like starting with the client's id or reference so it can be properly assigned to the client. What do you think is better? Store all this in a files field? Store each report as a page? Sounds weird to me to have hundreds of files in a field, but then again it also sounds much to have 120 new pages added every week. And of course this has to be organised, searchable by dates and whatnot.
  5. Damn, what a noob. That was it. How does one make a full project, publish it, test it, and never see a broken pages or a piece of red text anywhere saying Hey, where's your <body> tag? A mistery. Thank you sir, beer's on me ?
  6. @wbmnfktr The script tag is embedded but the cookie is not there. https://maisliberdade.pt/biblioteca/riqueza-das-nacoes-vol-i/ No errors on the console too. Checked again, cookieless tracking is off.
  7. Weird, this is not tracking anything for me. Is it supposed to update in real-time? Right now I have it assigned to 3 different templates, I see the phits field is there, but it always stays at zero. Templates are assigned on both auto-tracking and api tracking, tried cookieless tracking on and off, disabled the bot filter and IP validation. Nothing seems to work.
  8. @wbmnfktr Switching them around does the same thing @Robin S Adding namespace makes it worse, with that even the workaround doesn't work ? Well at least for now I managed to get it working. I'm just afraid that the whole thing crumbles and I have to setup everything in the cms from scratch. I've never backed up my DB so frequently as I'm doing now ?
  9. @wbmnfktr It gets weirder ? So here, $b->blockType is a php file name. In that file, the first line is echoing a __() string. I'd really love to understand why it works in the first include and not in the second. It's right up there among the weirdest things in the history of weirdness. Anyways, I'm just glad I have a workaround. Thanks for your time ?
  10. @wbmnfktr Strange. If I do that on a template file directly, it works fine. But if I put it in a file that's included, it breaks. WTH? ? Also, I just tested on another site that I'm working on and it works there. Both projects were setup the same way, in fact, the one that has this issue started from the other (basic setup with a docker-compose that sets up a container running the PW installer). Environment is exactly the same and the only difference I can see is that in the other one I selected the languages profile on install.
  11. Hello guys and gals. First time I've done this, took a site that started from the blank template and added language support. Everything's working except when I try to add translatable strings to my templates. I'm getting a `Call to undefined function __()`. No idea what I need to do. Can someone help? Thanks in advance. H
  12. First time I ran into it in some 7 or 8 years making stuff in PW ?
  13. Hey guys. First time I'm having this issue. Started a new project, downloaded the current master 3.0.165, set it up using the languages template. First field I add is a repeater with a title and image field, add that to the home template, edit the page, put some content, save... and the title is blank. Further testing and all other fields seem to work. This is the only one that reverts to blank when I save. Being required or not makes no difference. Nothing in the log. Any idea what's going on? I'm about to give up and make a new field. SOLVED For anyone who hits this snag, it seems this happens when you have languages but only one is set up. As soon as I added a second language, this behaviour stopped.
  14. Sorry, only noticed this message now. If you're still wondering about this, go to the InputfieldSelectFile.module file and look at line 96. Should be something like this: $output.= "<select name='" . $this->name . "' id='" . $this->name . "' class='uk-select'>" . implode('', $array) . "</select>"; In your file you're probably missing this id=... part. You just need to add that.
  15. Long time no post. Here's my latest: https://maisliberdade.pt/ Mais Liberdade is a liberal think-tank in Portugal, promoting the values of liberal-democracy, individual freedom and free market economy. It's a non profit that gathers collaboration from people from multiple portuguese political parties, members of the european parliament, economists, professors, etc. During development, an announcement page was set up with a registration form for founding members. In that period of about a month, around 200 subscriptions were expected, but in the end we got over 6000 subscribers. This website features essays, events, videos and a free library that, at the time of this post is counting 400 books. The frontend was built using web components (Stencil js). Basic pages are built with a modular approach, I'm attaching a video of how they are created. The approach is a simple repeater with a custom block type selector interface. That selector is basically a modified version of FieldtypeSelectFile. I've hacked that module to expect a PNG to be available for each PHP file in the blocks folder, and modified the input field to generate a button grid after the select. This is lovely to use from the editor's perspective, but it's something to improve for the developer experience, because in the end this is a repeater, that has to contain all fields that each type of block needs, and for each of those fields I have to set it to show only if the blockType field equals X, Y or Z. With a lot of different block types this takes some planning and easily becomes hard to manage, but it's the best approach I found yet and the benefit for the editor's experience is well worth it. covered-compressed.mp4
  16. Ok this one is mindblowing, looks like a perfect upgrade from the solution I'm currently using. I'm getting by with a repeater and a modded version of FieldtypeSelectFile that basically lets you select a php from a given content blocks directory, assumes there's a png that goes with it, and renders a neat block selector. From there, it's just hiding and showing fields depending on the value of that selector. It's not the most elegant of solutions from the "setting up" perspective, but quite nice and comprehensive for the editor and the php code on the frontend super understandable. Brad seems to try to do just enough. Looks great for custom, controlled content blocks. Too much freedom and the editor usually makes a mess ?
  17. Found the solution. Thanks @teppo for your help. Your suggestion gave me the clue I needed. Here's the fixed code: $results = ** a somewhat complex search that returns a pagearray ** $perPage = 20; $start = ($input->pageNum -1) * $perPage; $results->setLimit($perPage); $results->setStart($start); if ($input->get->f) $input->whiteList('f', $input->get->f); if ($input->get->l) $input->whiteList('l', $input->get->l); if ($input->get->a) $input->whiteList('a', $input->get->a); if ($input->get->t) $input->whiteList('t', $input->get->t); $pager = $modules->get('MarkupPagerNav'); $pager->setPageNum($input->pageNum); $pagination = $pager->render($results, [ 'nextItemClass' => 'next', 'previousItemClass' => 'previous', 'currentItemClass' => 'current', 'separatorItemClass' => 'separator', 'numPageLinks' => 5 ]); foreach($results->slice($start, $perPage) as $item) { // render the thing } echo $pagination; Basically all that was missing was that setStart() call. Makes sense, as usual.
  18. No cigar. "Start" is only used on that "slice" when I'm rendering the results. Page numbers are enabled on the template and there's only one pager in the page. I also double-checked, and $input->pageNum outputs the correct value. Got to keep hacking at it ?
  19. Hi guys I'm having a weird issue with pagination. This is a not too straightforward search that in some circumstances even joins two pagearrays. The pagination renders correctly, with working links, whitelists the variables, the items list is correct as I navigate the pages but... for some reason the pagination always marks the first page as being the current one even if I go to the second, third, and so on. Here's my abbridged code: $results = ** a somewhat complex search that returns a pagearray ** $perPage = 20; $results->setLimit($perPage); if ($input->get->f) $input->whiteList('f', $input->get->f); if ($input->get->l) $input->whiteList('l', $input->get->l); if ($input->get->a) $input->whiteList('a', $input->get->a); if ($input->get->t) $input->whiteList('t', $input->get->t); $pagination = $results->renderPager([ 'nextItemClass' => 'next', 'previousItemClass' => 'previous', 'currentItemClass' => 'current', 'separatorItemClass' => 'separator', 'numPageLinks' => 5 ]); $start = ($input->pageNum-1) * $perPage; foreach($results->slice($start, $perPage) as $item) { // render the thing } echo $pagination; Any ideas? Thanks
  20. Does not passing $options produce a different result? It's weird, I've used this module a bunch of times and never had such an issue, but I usually don't specify options on resize and go with the default.
  21. Just to add a suggestion. This field can't be used as a condition for another field's visibility. It's an easy fix though, just have to add an ID to the field (matching the name) and it starts working.
  22. Found the issue. To whoever it may concern, as of this day the select file fieldtype doesn't support being a condition for other field's visibility. It's easy to hack though. On the module's file, find the render function and add the id property to the <select> element that it outputs, with $this->name as value. That will make it work
  23. I've used page field visibility according to a select options value before with good results. But can't seem to get it to work with a file select field. Here's what I'm doing: This all lives in a repeater. The file select (call it myFile) points to a folder and I can select files correctly. Then there's a (call it description) field that should be if a specific file is selected on myFile (say x.php). Editing the fields inside the repeater, `Show this field only if` is set to: myFile="x.php" I tried it with single or double quotes, with or without the `.php`, and the result is the same, the field is always hidden. In previous similar implementations, I've used select options with a validation such as `myFile=1`, now I'm hoping to improve this method, excluding the need to update the files field every time something is added, and also make it a bit less cryptic to manage the fields' visibility.
  24. I have also on occasion tweaked the styles for the markers, so that the active one is opaque and the others transparent. That helps when you have a bunch of them close together.
  25. Sorry this is going to be vague but... I've hacked it to support floats in some projects. It's not too hard. Just had to look in the module's code where the fields are defined and it's relatively easy to find the INT and change it to float. You may have to do the same in the DB as well. Takes some fiddling. I wish I could be more specific, but after formatting my machine I'd have to go through a bunch of backups to find actual code.
×
×
  • Create New...