Jump to content

DrQuincy

Members
  • Posts

    248
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by DrQuincy

  1. I've got a repeater of product options within a single product page template. So template=product has a template file and has a field called options, which is a repeater with title and price. I want to store the repeater IDs in a session for the shopping basket and then read them. E.g. if ID 1255 is in the array, this gets me the repeater item: $item = $this->wire('pages')->get('template=product, options.id=1255')->options->get('id=1255'); Is there a way to access the repeater directly? It just seems a bit clunky and inefficient to have to get the page and then the repeater by expressing the ID twice, when the ID should be able to get me to the repeater item with one call. I can run $pages->get(123) with a top-level page and it gets the page but when using get() from a repeater item I have to do get('id=123') — any reason for this? It doesn't really matter, I just wondered. Is it possible to have a Page Reference field that references a repeater for that page only? So, say I have options in a repeater as above: (Small, £10), (Large, £15), could I have a Page Reference field that let's me pick Small, Large, etc? The use case is specifying product bundles. Thanks!
  2. I'm using Pro fields table (support has expired but will renew it if needed). How do you mean a column field required in the settings (not the overall required setting — but individual columns in the table)? I've tried: required=1 required=true required But you can still leave it blank. Any ideas? Thanks.
  3. This is great, thanks! In my settings I am allowing spans with classes. Do you know how I might adapt your code to allow this? If I have HTML with <span class="foo">bar</span> but no empty spans or style assets, <span class="foo">bar</span> stays. But if I add in <span>foo</span>, <span>foo</span> changes to just foo (great!) but <span class="foo">bar</span> also change to bar. Also, by default, CKEditor seems to allow style="margin: " I assume this is related to indentation. Any idea how you can disable this? Extraneous spans are annoying but harmless. However, the margin styles mess the formatting up. I do not even have the indentation buttons visible in the toolbar. Thanks!
  4. Thanks for the explanation, Jan. And, yes, that makes sense as to the difference between roles and permissions. I have created the permission tasks-list-access and assigned it to the role content-manager. I have then added 'permission' => 'tasks-list-access' to my Process class but it hasn't made a difference. Am I missing something? I refreshed the module and it worked. Hoorah! Thanks very much for your help. ?
  5. Thanks, does role not come into it then? I.e. can content-manager get at it without being given permission to view the admin template?
  6. Thanks, but sorry to have mislead you, I actually want to restrict by role, not permission. ?
  7. Ah sorry, I was using “permission” and “role” interchangeably. You're right, I want users with the role content-manager to be able to view an admin page that has a custom Process class I wrote. Is this possible without making them a superuser?
  8. I have a simple Process installed that displays some dynamic HTML that I want to allow a logged in person to view who doesn't have the superuser role. Is this possible? I am assuming because a class that extends Process is used by the admin template this doesn't happen by default. How do I did it? I have tried adding 'permission' => 'content-manager' to getModuleinfo() by when I access the page as a content-manager user it just redirects to the site tree. Thanks. ?
  9. Thanks, that looks ideal as it does look fairly simple.
  10. That looks very comprehensive, thanks! I will take some time to read through it at some point but that looks like it will make things a lot clearer! Thank you!
  11. I'm trying to find an existing PW field that is simple enough for me to duplicate and adjust to suit my needs. All I'm after is the ability to create some custom HTML with a hidden field — and then hidden field is used as the database value. There is no fancy validation needed other than the value can not be empty. I have bought an icon pack for a client that is stored in a folder for the website and I simple want to be able to show the icons in a grid and when clicked the name of the icon goes into the hidden field. I've looked through some of the core modules and it's a bit overwhelming. I'm sure if I had a simple example I'd be fine with it. Thanks.
  12. I searched the forum for this and couldn't find anything. Is there a module/fieldtype that doesn't store anything for the actual page in the database. It just allows you to insert any HTML you want at a given point in the template/form. Is there such a thing? Thanks.
  13. Thanks for your suggestion! In this case it's for something that runs on cron in the night and syncs a website property listing with third-party listing software. It takes a long time to run as it needs to copy images over HTTP and then resize some of them so when the website is accessed during the day it's a lot faster. Thanks for your suggestion though. I must admit I have never thought of doing it that way — it's a neat solution. If you run curl and then redirect via a session as you have done, does curl honour the redirect? I can't say I've never tried that but from when I have used curl in the command line I'm sure it just returns redirect headers, location, etc. I just thought maybe there was a way with the API and get a page's rendered HTML as opposed to as an object to force ProcessWire to run the task as it would if you visited it via a browser. I don't know, I thought maybe there'd be something like $pages->get('/path/to/page/')->render() that returns the page HTML. If so, from my command line script I could simply map the arguments to $_GET and also pass a path.
  14. Ah, yes, thanks for that. I'll have a think about how to implement it.
  15. Thanks, I've seen that. I just wondered if there was a way to — rather then get a page through the API which I could do per your link — get PW to actually process it as though it were a front-end request. If I do wire('page')->get(123) it will retrieve all the data but what I want is to trigger something that is the same as accessing the page through HTTP. Is there a built-in function for this?
  16. My hosting environment does not allow for PHP to run for more than 120 seconds when it is a web request. However, there is no limit via command line PHP. Is it possible take a ProcessWire URL such as http://domain.com/foo/bar/?bar=foo and run it as a PHP command line? Something like: php /path/to/pw/site/index.php route=/foo/bar/ bar=foo Is such a thing possible? Thanks.
  17. Ah, thanks, yes, that explains it. I always assumed $page->url was the full URL but that is actually httpUrl; var_dump(wire('pages')->get('/sitemap.xml/')->path); // "/sitemap.xml/" var_dump(wire('pages')->get('/sitemap.xml/')->url); // "/sitemap.xml" var_dump(wire('pages')->get('/sitemap.xml/')->httpUrl); // "http://site.local/sitemap.xml" Thanks, I will use ->url in future. ?
  18. I'm not sure if I'm missing something glaringly obvious here but if you set URLs (not segments) to not have trailing slashes you will still get one at the end when accessing $page->path. So $page->path for my sitemap.xml file is /sitemap.xml/. Yes if you visit /sitemap.xml/ it redirects to /sitemap.xml — but why doesn't it just return /sitemap.xml? This will end up adding an awful lot of unnecessary requests. Is this intended behaviour? I have also noticed the API only seems to work with forward slashes too (e.g. parent=/foo/bar/, not parent=/foo/bar) — but I get that as a design decision since the the trailing slash setting is effectively abstract from that.
  19. Thanks, they are the same settings. When I get the chance I will try on a browser with everything cleared and if that doesn't work I'll try disabling some modules. I do have the forgotten password and email new user modules installed so maybe it's them. I'll post if I find a fix!
  20. Hi, I am doing a site that does a fair bit of number crunching and decided to try PHP 8 as I read it was a fair bit faster. The front-end works fine but when I log in to /processwire/ I get: When switching back to PHP 7.4 it works as expected. I did also try it on a computer that had never accessed the back-end before and got the same error (though in hindsight I wonder if I should've cleared the cookies first). Does PW definitely work on PHP 8? I am using 3.0.184. If so, I wonder if it is a module that's the problem — or maybe the CSRF token needed clearing. I know you can disable CSRF but I am reluctant to do that. I have session fingerprinting disabled also. I just thought I'd check first to see if the core is fine to run on PHP 8. Searching the forums you find threads of people saying don't use v8 yet — but they're all about a year old. Thanks.
×
×
  • Create New...