-
Posts
372 -
Joined
Everything posted by hellomoto
-
$wire->addHookAfter('Pageimage::url', function(HookEvent $event) { static $n = 0; $image = $event->object; if(++$n === 1 && in_array($image->ext, [ 'jpeg', 'jpg', 'png' ])) { $event->return = $image->webp()->url(); } $n--; }); [https://processwire.com/blog/posts/webp-images-on-an-existing-site/] This works great unless shown by $page->images->getRandom(); ?
-
I was thinking to utilize URL segments for pages via external API, however I don't know how those would be indexed by search engines reliably/conveniently? I'm guessing a script could be written to ask for them to be crawled? but I'm not sure whether that's worth it. Does anyone here do this? for fairly complex articles of data? I think I've seen on here before people mentioning synchronizing real estate databases, for example, to native PW and/or vice-versa... That would be the way to go, then? to enable PW-independence? Otherwise maybe have a module for managing the external database (like crud) within the PW admin and integrating the API, where for each external record, a page exists (is created/deleted/unpublished accordingly) with its name = id in db. With just the corresponding ID to the record, probably views and SEO at least could be dynamically generated... Any drawbacks or concerns that come to mind
-
Thanks. I had known about that module and was going to maybe modify it to suit the use case but quit the project.
-
Is there a built-in way to handle incoming email?
-
This is compatible with PW 3. Is there any reason you would not use it in production? I tried hCaptcha but that's more laborous for users.
-
Like to replace maybe the form elements as being output in a list as divs instead, etc. ? I know I've come across it before... Can't make it out looking at the core module... Thanks
-
CMS Critic Powered by ProcessWire (again) + Case Study
hellomoto replied to ryan's topic in News & Announcements
@Jonathan Lahijani how did you go about incorporating the Advertising Package subscriptions? Are they each stored in a repeater field per user? or child pages? or other? & how are payments processed? thanks for all the information you provide already -
I had not. It works fine now, thank you.
-
How to disallow parallel sessions by role?
hellomoto replied to hellomoto's topic in API & Templates
It restricts that functionality of the module to a specified role, which is about as far as I'm taking it. -
ImportPagesCSV add repeater field support? (got FieldtypePage)
hellomoto replied to hellomoto's topic in API & Templates
Maybe for the repeater field value specify a separate CSV file with fields & values to be imported. -
I just found the Session Handler DB setting to Disallow parallel sessions after already starting this thread... so in SessionHandlerDB.module function HookLoginSuccess: if(!$user->hasRole('roll')) return; (etc.)
-
It's enabled, that's why I'm confused. (curl is also enabled)
-
I installed this on the latest dev PW version and didn't touch any CSS for it; enabled it for a CKEditor field (and plain textarea without CKEditor); tried YouTube, Vimeo, and SoundCloud URLs and they all just output the URLs wrapped in plain <p/> tag(s). What am I missing?
-
function customPageSaver(HookEvent $hook) { $page = $hook->arguments(0); if ($page->template->name == 'event_instance' && $page->id !== 0) { $page->setOutputFormatting(false); $page->name = wire()->sanitizer->pageName(wireDate('Y-m-d', $page->date)); if ($page->time_end < $page->time_start) { $hook->message('End AFTER starting.'); $page->time_end = ''; } } } $this->addHookAfter('Pages::saveReady(template=event_instance)', null, 'customPageSaver'); -- site/ready.php Can I set the $page->time_end to its previous value, rather than ''? I think I've done that before but forget how.
-
On the frontend template I have this in an edit form: $field = $modules->get("InputfieldCheckbox"); $field->label = "Discard"; $field->attr('id+name', 'prop_discard'); if($page->discard == 1) $field->attr("checked"); $proform->append($field); Because $field->value = $page->discard does not work, nor does anything else I've tried. How do I get the checkbox to reflect if it is checked? Right now on save if it was checked it needs to be re-checked every time.
-
How to access other PW site data in a multisite multi-DB install?
hellomoto replied to hellomoto's topic in API & Templates
Thanks -
DDEV is another Docker-based open-source platform. I've worked on Mac with AMPPS, but when my computer crashed and I got another one and installed it would download strange image files (mostly [faux?] logos) to my computer until I turned off the wifi... Valet+ Valet fork has PHP version switching & extensions, toggle Xdebug, optimized MySQL (?), Redis, & Elasticsearch. You can set up a simple development VM but Homestead is already all belled and whistled. It runs PW perfectly out of the box via nginx (or Apache but I had to install it). Scotch Box is a less extensive Vagrant box. By the way: Running Vagrant + VirtualBox from an External Drive Also v.je: Arch-based minimal 75mb Vagrant box for web dev. well configured, no provisioning, stripped of Pacman.
-
I know you can include the API for a PW install elsewhere by including its index.php file, but what about when you have a PW /site and then a /site-something directory with another one where you want to query pages from the /site ? I guess REST would be one way but is there any way to bootstrap the other site's data directly via the PW API, like its $wire or $pages assigned to some variable?
-
Where do you update the database username and password?
hellomoto replied to shogun's topic in Getting Started
I never knew, but I prefer my way: I keep config.php and then will have a config.dev.php and/or config.www.php and require whichever is appropriate via a switch conditional in config.php depending on the hostname. So in config.dev.php debug is true, and both have their respective DB credentials, and any other variations can be specified/distributed very easily and cleanly this way without repetition. -
Routing I have in mind like it's done in Laravel; that seems like it would be simple to even convert to, again maybe just via a module so people could just work with the original way it's been done; then every template (e.g., in said hypothetical module) could be a "model". Maybe templates on templates is too far-reaching... could basically be done with showIf etc. and the demand probably is not nearly high enough for such a feature. So that's off-topic for now.
-
Hey! No I think we're thinking of models the same; I didn't mean to imply that they would be tied to their routes, as the templates (basically) are in PW. I do mean models entirely separate from routing, thereby allowing for routes to be specified as needed and totally custom. The ways you mention with parent pages and URL segments I've tried, but still don't prefer totally overall, all the time... Yes, define routes abstracted. For example for a car sales website... which could totally be done in PW as-is, but for one thing I would not really want the listings to even be in the tree view in the admin... Maybe it could just be a module that would allow for creating templates and admin views of pages (?) outside of the page tree that then can be controlled and moved around (?) more easily (?) in views for those within the tree. That's probably just fine. Sorry this is a really rough idea. I don't believe I'm making it any clearer. Apologies.