![](http://processwire-forums.s3.us-west-2.amazonaws.com/set_resources_6/84c1e40ea0e759e3f1505eb1788ddf3c_pattern.png)
DrQuincy
Members-
Posts
280 -
Joined
-
Last visited
-
Days Won
1
Everything posted by DrQuincy
-
This is perfect. Nice and simple and just what I wanted, thanks.
-
Awesome, thanks.
-
Is there an admin plugin to test out selectors? What I mean is, you'd have a text field where you can enter a selector and it gives your details of which pages would be affected/returned. I say “would be affected” as it would be useful to test out how live data would be affected so you can be 100% sure your selector is right. I hope that makes sense. Does such a thing exist? Thanks.
-
I have tried Autojoin and it is approx. 5 x faster so that's good.
-
I have something like this: $pages = wire('pages')->find('template=foo'); // $pages->count = int(330) foreach ($pages as $page) { // Here I get 23 properites $foo1 = $page->property1; $foo2 = $page->property2; // ... $foo22 = $page->property22; $foo23 = $page->property23; } If I only get 1 property is takes about 0.02s. But if I get all 23 it goes up to ~5s on a decent Linux server. The number of properties retreived proportionately increases the execution time so there isn't any one property that is a bottleneck. Is this to be expected? 330 pages is not exactly a lot. I know the API has a $cache variable but the above pages are linked to a search form so it could prove tricky (although I could cache the initial form where no filters are applied). Is there anything I can do to increase the speed? I guess I could store all properties as JSON in an additional field and just retreive that. It just seems unreasonably slow to deal with that kind of execution time on a few hundred records. Thanks. EDIT: Just seen that the Autojoin option might do the trick.
-
Thanks, I've looked at their competition and they're prhibitively expensive for the client's size. I'll keep looking!
-
I am doing a site for a client who has a pub and a few holiday cottages and pub rooms. Does anyone know of a single system that will inexpensively let them do both and integrate via a widget or link on the website? Failing that, can you recommend an inexpensive one for rooms and another for restaurant bookings? Thanks.
-
That is super helpful, thanks. You are absolutely right there.
-
I'm don't know if I've missed something in your link but is it possible to add a path hook that runs when a page already exists in PW? This is esssential to what I want to accomplish.
-
Ah, great! You learn something great and new about PW every day! I can redirect, return a page or throw a 404 exception. Perfect!
-
How can I write a hook that happens when PW has dtermined the page is not found? I have some pages where the page name is a unique numerical ID (also stored in a hidden field) followed by a standard slug. E.g: /folder/4545-foo-bar /folder/89897-test-page If someone enters, to use an example above, enters site.com/folder/4545 PW will send a 404. However, what I want to do in the hook it search for a page that has the unique numerical ID. If it exists, redirect to that. If it doesn't, allow the default 404 behaviour to occur. I hope that makes sense. Thanks!
-
Okay, so I'm pretty sure this is a charset issue, I'm just not sure how to solve it. I have a MySQL database (non-PW) with news items in that uses utf8mb3_general_ci. I have a new PW site that uses utf8mb4_general_ci. I am using \ProcessWire\WireDatabasePDO to connect to the non-PW database and am interating through and converting them to PW pages. It seems characters such as em dashes and the Euro symbole are coming through as ?. It's happening in the titles only but they may be becuase in the HTML field, CKEDitor is using entites. How do I reconcile the charsets? I recall doing something like this years ago on a non-PW job and seem to remember SET NAMES might be the soluiton but if anyone could help me out that'd be appreicated. ? Thanks.
-
How to output to a text formatter programatically
DrQuincy replied to DrQuincy's topic in API & Templates
Ah, it's as easy as that, thank you! -
I'm sure I've seen this before but can't find it anywhere… I have the TextformatterMarkdownExtra text formatter installed. I have a field that uses TextformatterEntities but in certain instances I want to switch to markdown on the fly. How can I do this. Obviously $page->of(false) first — and then what? Thanks.
-
I have some code like this (simplified): $page = new Page(); // Set template, parent, etc here $item = $page->matrix->getNew(); // matrix is a RpeaterMatrix $item->repeater_matrix_type = 4; // HTML $item->html = '<p>Foo bar.</p>'; $item->save(); $page->matrix->add($item); $page->save(); // Saving now so I can add an image $page->image->add('foo.jpg'); $page->save(); I always thought save() was imdempotent so if you kept saving it would just overwrite the same data. But in this instance my matrix has two identical items. This works though: $page = new Page(); // Set template, parent, etc here $page->save(); $item = $page->matrix->getNew(); // matrix is a RpeaterMatrix $item->repeater_matrix_type = 4; // HTML $item->html = '<p>Foo bar.</p>'; $item->save(); $page->matrix->add($item); $page->save('matrix'); // Saving now so I can add an image $page->image->add('foo.jpg'); $page->save('image'); Just so I understand is the matrix difference to the other fields in that once added to the page when just $page->save() is called it will save a new once each time? I.e. it doesn‘t “forget” about the new matrix item on saving. In general, is it better to save by explcitily passing field names as above (once you've saved the core fields)? If so, can you pass an array of fields to save()? It doesn't appear so from the docs. I've been using PW for a while now and have always used saved and not yet come across this. ? Thanks!
-
Is this to meet Google's new standards for ads? You need to use a Google-approved Cookie management system (CMS) so it's done independently of ProcessWire. It seems unfair you have to use commercial options but there isn't an oen source version that I am aware of. You can see the list here: https://support.google.com/admanager/answer/13554116?hl=en#zippy=%2Cgoogle-certified-cmps I've used CookieYes for a few clients. Looks decent enough and quick to set up. It's free up until 25k page views per month (I think). A few clients are paying ~$10 a month as they get more traffic than that.
-
FieldtypeMapMarker default address not working
DrQuincy replied to DrQuincy's topic in Modules/Plugins
Ah, thanks for checking! I'll keep an eye out for the new version. -
I have set a default address for the module and when I save it it correctly geocodes the address. However, when it loads in a new page the Latitude and Longitude are both 0. Any ideas why? Thanks.
-
Brilliant, thanks. Looks like they added X is the last update. ? https://github.com/NikolayRys/Likely/releases/tag/v3.2.0