-
Posts
4,956 -
Joined
-
Last visited
-
Days Won
100
Everything posted by LostKobrakai
-
Just to add that here. The driver can be installed manually until and if the pr does get merged into valet. Just put the ProcessWireValetDriver.php of the pr into the ~/.valet/Drivers folder and start your ProcessWire project.
-
Anyone done Ajax login with bootstrap.io form validation?
LostKobrakai replied to Juergen's topic in General Support
And if you've more than a handful of fields you save yourself the hassle of writing all those if statements. <?php $needed = [ 'my-field', … ]; $addIfNeeded = function($fieldname, callable $callback) use ($form, $needed){ if(!in_array($fieldname, $needed)) return; $callback($form, $fieldname); }; $addIfNeeded('my-field', function($form, $fieldname){ $form->addText($fieldname, __('My Field')) ->setRequired(__('My field is required')); }); $addIfNeeded(…); $addIfNeeded(…); -
Anyone done Ajax login with bootstrap.io form validation?
LostKobrakai replied to Juergen's topic in General Support
Just changing the markup elements wasn't flexible enough for my usecase and manually putting all those form parts in their wrapper markup isn't a option as well, as the form is dynamically adjusted to which data the current user does need to supply (by role and such things). That's why I went with the custom renderer class. Just doing a 'echo $form' does render the complete form with markup just as I need it to be. -
Anyone done Ajax login with bootstrap.io form validation?
LostKobrakai replied to Juergen's topic in General Support
I'm using a modified version of the default js file provided by nette. Didn't know about the other one by now. For rendering I'm using a custom Renderer class, which extends the framework's own one. This keeps it clean and is way easier than e.g. modifying ProcessWire's form markup output. -
Anyone done Ajax login with bootstrap.io form validation?
LostKobrakai replied to Juergen's topic in General Support
It's probably not as feature rich, but I really like nette forms, where I can define validation rules for both client side and server side at once. The library is so nice to include a simple js file, to handle client side validation, which is additionally quite easy to enhance / change to ones specific needs. -
Error 500 with repeater with more than 51 items
LostKobrakai replied to didhavn's topic in General Support
Depending on the number of fields in that repeater you might run into the max_post_vars setting of php. -
If you're using that file with prepend/appendTemplateFile and you're rendering multiple pages in a single request (e.g. by using $page->render()), then this is expected behavior. At least since the introduction of init.php/ready.php using prepend/appendTemplateFile is not the correct place for any class instantiations or global variable invocations. Do this in init/ready.php and leave prepend/appendTemplateFile for anything that's part of your page rendering process, e.g. wrapping the body markup in the html skeleton or alike.
-
True, this might be a good addition to the docs. And I'd think it's probably a good thing that ajax calls are not distinguishable by default from other request, as both are simply requests for a web resource. Any differentiation should be triggered by the specific request and not by the method of triggering it.
-
Select specific files for download from array
LostKobrakai replied to electricarts's topic in API & Templates
eq() is exactly the things to use in this kind of situation. I'm not sure why it's not working for you. -
How to convert to ProcessWire 3.0 namespaces?
LostKobrakai replied to thetuningspoon's topic in API & Templates
Just do nothing and everything should work fine in 2.x as well as 3.x. One has only to care about namespaces if it's explicitly wanted/needed. -
Probably the best example out there: https://gist.github.com/somatonic/5233338
-
You shouldn't use the assets path of the page as upload destination. Create a temp. folder with wireTempDir() to upload files to. They'll be automatically moved to the correct location when being added to the page's file field.
-
The cache file is regenerated on each pageview, where the file is no found. E.g. when installing the module or if you remove the file manually, where the last one is not a good solution for resetting, as it's removing all timestamps, therefore all hooks would automatically run on the next request. Also LazyCron does not care for specific hooks. It just runs the everyDay function if it's due no matter how many things might be hooked into it.
-
As I said it depends on the timestamp in the LazyCron.cache file. This does determine when the everyDay hook is triggered (e.g. all everyDay hooks at once). If you're using a cron anyways I'd rather suggest not using LazyCron at all in that case. It's nice if you just want to ensure LazyCron to run, but if you want it to run at the cron execution just let it run 'php /some/path/cron.php' with this: <?php // cron.php include 'index.php'; //Trigger anything needed
-
The modules does save timestamps of the last execution for each of it's hookable timeframes (site/assets/cache/LazyCron.cache). For each page-request it checks each timestamp if it's bygone by more than the corresponding timeframe and if so it triggers the function and updates the timeframe. Therefore the hook will always run if the last execution was anytime longer ago than the timeframe's timespan itself. As this does depend on actual page views this cannot be timed to a specific time of the day or alike, e.g. everyDay could be: 24h gap, 26h gap, 25,5h gap, 24h gap, 48h gap (nobody visited the second day).
-
AFAIK this header was only popularized by jquery and never part of any standard, therefore there are a lot of javascript tools out there, which do not automatically set this header.
-
I've just added a pull request for a ProcessWire driver to laravel valet: https://github.com/laravel/valet/pull/55/files For anyone wanting to have a quick local dev environment (on a mac) you should certainly take a look. https://laravel.com/docs/master/valet
- 32 replies
-
- 13
-
Allow only one exclusive session for guest user
LostKobrakai replied to gebeer's topic in API & Templates
Does it really have to be the "guest" user? As each new user is automatically a guest I think it'll be hard to prevent anyone being a guest. I'd simply create another generic user account, where you log in your "privileged" guest with forceLogin() and then you can at least differ between them. For getting active sessions you'd need to build any querying logic custom for your job. But the mysql query for the session db module can probably be copied from the module itself.- 1 reply
-
- 1
-
- session
- guest user
-
(and 1 more)
Tagged with:
-
The id at the end of the field name is only used in the admin backend to have unique field names for each repeater otherwise they would overwrite each other on save.
-
foreach($product->image as $image) { $page->images->append($image->url); $page->images->last()->tags = "tag1 tag2"; }
-
There shouldn't be any difference as both are essentially the same. find() does internally create a new PageArray anyways.
-
Or just copy the code from MarkupSEO, which does all this field copying already.
-
Short answer: There isn't. But it's been discussed multiple times, the latest one here: https://processwire.com/talk/topic/13021-wishlist-group-field-for-grouping-fields/#entry118225
-
That's not possible in a single selector. Sort order can only be 'hierarchical' for the whole result set and not different for just a subset.