-
Posts
2,007 -
Joined
-
Last visited
-
Days Won
21
Everything posted by dragan
-
I don't understand that sentence... Anyway, there's quite a few things you can do: Use caching (.htaccess) Use gzip compression (.htaccess) Use a Service Worker and the Cache API to store font-files in the user's cache (JS) Look for an alternative on Google Fonts. Perhaps they have the exact same font there, or a font that looks very similar. Use Google's servers (CDN) instead of your own resources.
-
I'm not sure I understand the question, but I guess by "folder" you mean "a URL structure that doesn't exist neither as physical folder on disk nor in the PW page-tree". If that's what you're after, you can enable URL segments in home (page id 1), and then go from there. There are plenty of forum threads with examples. It's really simple and straightforward (no need to mess around with .htaccess rewrite rules etc.) https://processwire.com/docs/front-end/how-to-use-url-segments/
-
Quick question: Is it possible to use PW's pagination for other things than PageArrays? i.e. query custom database tables and paginate the results? Has anyone ever tried it?
- 1 reply
-
- pagination
- custom mysql tables
-
(and 1 more)
Tagged with:
-
This works for me here: if ( count(page()->images) ) { echo "yay!"; } ProcessWire: 3.0.148 PHP: 7.3.13 Webserver: Apache/2.4.35 (Win64) OpenSSL/1.1.1b MySQL: 5.7.24 but you don't even need count... this works as well: if ( page()->images) { echo "yay!"; } and if you really need the number of images, this works too (always has): $imageCount = page()->images->count()
- 1 reply
-
- 1
-
Do you need this in the frontend or backend? Do you want to detect when a logged-in user switches language in the backend? Do you want to detect when a user in the frontend switches from page language A to page language version B? You could try and keep track of $user->language->title changes or something similar, with cookies/session. The code instance you linked to seems indeed to be the only instance in the entire PW core. I don't think it does anything useful right now as is, nor do I think it is really hookable.
-
@flydev ?? Thanks for that PW Bootstrap profile. I get errors with yarn build though: I don't see a build folder anywhere. Where is that supposed to be? Is that the static folder? Also, in package.json, what are these hard-coded paths?
- 39 replies
-
- 1
-
- responsive
- bootstrap
-
(and 3 more)
Tagged with:
-
Thanks for sharing. ?
-
true, but sometimes I have to use that button (especially when adding a new project, and the directory list is not up-to-date, but also elsewhere...)
-
in the upper left corner of PHPStorm's toolbar. From left to right I see: open save all floppy icon reload from disk v. 2019.3.1 btw, that topic you linked... is more than 5 years old ?
-
in the upper left corner you have a reload-icon. "reload all from disk" shows on hover. Another way is to simply restart PHPStorm. Usually the IDE is then re-scanning / looking for changes. I don't know what IDE plugins I've been installing in the last couple of months, but I'm quite happy with how PHPStorm is doing autosuggest. Far from perfect though... ideally it would only show suggestions that make sense in the context (show only applicable methods). It would be nice to have a keyboard shortcut to only show page fields or something like that.
-
Thanks @Robin S for this module! Everything works fine here (PHPStorm, Windows). However, I'm confused about the discussion about AutoTemplateStubs folder... I don't see any folder with that name anywhere (only in site/modules). @szabesz did you re-scan your project with PHPStorm?
-
I just tested it with my LG G4 (Android, Firefox) and the audio players displayed and worked fine.
-
OK, here's an update... The above code was running inside a PW template. If I create a file in the root of my PW installation and access it directly @ foo.tld/bootstrap.php, all of the following stuff will work: So I guess the main remaining question is: Can we access other PW sites from within a PW "regular" template, and let those two communicate with each other? Or do we have to build some interface between the two, so PW doesn't get confused? I guess we still have to wait for this.
-
@Harmen So finally I found some more time to investigate and try out a few things. Here's what works and what doesn't for me: My setup: Two PW sites installed locally (one of the latest PW versions from dev branch). Both are accessible locally via dummy domains instead of localhost (pw.test + pw2.test). Windows, Apache, PHP 7.3.13, Laragon. Both sites have the relevant other domains in the site/config.php $config->httpHosts whitelist array. Not sure if that is necessary. I have also temporarily switched from DB-sessions to regular sessions, because I was getting fatal PHP session errors. Googling around I only found various pointers to bugs in PHP 7.2, so I installed PHP 7.3.13. tldr: There are lots of "ifs" and strange things going on trying to make this work. I really wish the docs would be more helpful with that bootstrapping feature. And as mentioned before - I hope someone else chimes in who managed to make it all work as intended.
-
[Solved] Select options field: options won't save with custom user role
dragan replied to nurkka's topic in General Support
You should check first if this is really a permission issue or something else. Enable Tracy Debugger's user switcher, and then switch to one of those agency accounts and try to reproduce that behavior. Check the browser console for errors, and of course if Tracy is reporting anything. -
So, I tried it out today myself, and it turns out... it can indeed be tricky. In one instance I was only able to query pages that have no access restrictions whatsoever. Others gave me a Nullpage as result. Maybe somebody else who has used this in a real-life project can shed some more light on that.
-
You should re-visit the 1st link I posted. You should include the topmost index.php file of your other PW installation, not wire/core/ProcessWire.php (or any other stuff from wire/). https://processwire.com/docs/front-end/include/
-
@Harmen are you using PW namespace? + $newPW = new ProcessWire\
-
If the sites are all on the same server, you could try to bootstrap PW.
-
You probably have a text formatter activated (field definition > details tab). If this is not the case, maybe you do escaping elsewhere; I assume you deliver JSON to your web app?
-
I remember quite well. It felt like downloading the internet on a 28k baud modem back in the days ?
-
Where do I store arbitrary data like global info or settings?
dragan replied to Vigilante's topic in Getting Started
As noted, this is also part of Pro Fields, and it's been around for quite some time. On second thought, maybe that's not ideal, considering all the other options you have. I don't know why you keep repeating this. Use an _init.php that you prepend everywhere. In that file, grab those global field values from that one specific page you've set up for just that reason, and you're set. You'll be able to use these vars from anywhere. You don't even need a physical template file for such a "settings" page, since you don't need a frontend view for that. -
is advanced mode enabled?
-
Unable to login on second machine with exact same setup
dragan replied to derelektrischemoench's topic in General Support
There are already tons of advice in this thread, and you really seem to have investigated already a lot; but this note about 404 could maybe be because of an ad-blocker you have installed. Other things you could check/try: check allowed hosts in site/config.php (if possible) create a dummy domain for local instance (Laragon e.g. creates sitename.test domains for you automatically, you can use that instead of localhost or 127.0.0.1) Perhaps you have some funky stuff left in your HOSTS file Did you check also if the Apache's http.confs are identical (e.g. Apache modules) ? Did you install Tracy Debugger and set debug mode on? Last but certainly not least: Do you see anything in your Apache error logs?