-
Posts
4,956 -
Joined
-
Last visited
-
Days Won
100
Everything posted by LostKobrakai
-
PageListAction Trash only for SuperUsers? Why?
LostKobrakai replied to Torsten Baldes's topic in General Support
This is intended behavior. As only superusers can use the trash (see it and restore pages) it's actually favorable to not have users accidentally click a trash action button. -
That's mostly owing the fact that the distance calculation must be done in sql syntax.
-
SELECT DISTINCT category FROM movies (with PW API)
LostKobrakai replied to EyeDentify's topic in API & Templates
That's why this is a wishlist topic. There's no pw way for that besides loading all pages to memory (kinda manually) and using unique(). -
SELECT DISTINCT category FROM movies (with PW API)
LostKobrakai replied to EyeDentify's topic in API & Templates
If you're worried about that just use the mysql snippet ryan posted with the DISTINCT selector. -
If you need to use pagination (limit=XX) for the resulted pages you'd need to resort to something like this: https://github.com/ryancramerdesign/ProcessWire/issues/556 If you're not using limit in your selector I'd suggest using sort in the $pages->find() selector if possible and fall back to runtime sorting only if needed. Edit: The difference between find() and sort() is, that find() will sort results in mysql and therefore (in conjuction with limit) will only load actually displayed pages, whereas sort() does only sort pages in php (loaded to memory), which might draw a lot of performance if done on a large set of pages.
-
SELECT DISTINCT category FROM movies (with PW API)
LostKobrakai replied to EyeDentify's topic in API & Templates
I think those might be what you're looking for: https://processwire.com/talk/topic/9730-get-pages-used-by-a-pagefield/ http://cheatsheet.processwire.com/pagearray-wirearray/getting-items/a-unique/ -
How to transfer user accounts from old system to new one ?
LostKobrakai replied to adrianmak's topic in Dev Talk
Easiest: Implement a password forgotten process and let users use this one to update/change their password on the new system Otherwise: Implement the old system's password comparison and use it to compare it to the submitted password. There are various threads about hooking into the login process of processwire. -
how could i send to different receipent on same enquiry form
LostKobrakai replied to adrianmak's topic in General Support
Just be sure to sanitize the entry or people can just pass arbitrary emails to be send to, which you don't want to happen. -
Correctly deleting fields from unknown templates
LostKobrakai replied to GuruMeditation's topic in Module/Plugin Development
I think you're missunderstanding fieldgroups. Fieldgroups hold the fields for templates. Each template does have it's own fieldgroup. You just need to remove your field from the fieldgroup. Do not delete the whole fieldgroup or the template of it won't have fields anymore. -
You can sort by runtime fields as well. You'd just need to make sure to populate it before sorting.
-
If you need partial matching you'd need to use the %= operator. It's using mysql's LIKE to get matches.
-
If you're talking about the frontend I can suggest talking a look at this: http://adamwathan.me/2016/04/06/cleaning-up-form-input-with-transpose/ In the backend you'll probably use repeaters or pagetables (FieldtypeMultiplier would work, too, for a single repeatable field).
-
how could i send to different receipent on same enquiry form
LostKobrakai replied to adrianmak's topic in General Support
That's what GET parameters are for /enquiry/?email=1234, if you've them saved in some page, or /enquiry/?email=info%40xyz.com if you just want to pass the email address. -
Correctly deleting fields from unknown templates
LostKobrakai replied to GuruMeditation's topic in Module/Plugin Development
http://cheatsheet.processwire.com/fields/field-methods/field-getfieldgroups/ This will give you all fieldgroups (aka templates) you need to remove the field from before deleting it. -
Maybe the "new" permission suggestion screen, which ryan implemented for the various optional core permissions, could also hold optional module permissions.
-
Nothing in processwire does automatically update, so what exactly do you mean?
-
$this->addHook("Pageimage::srcset", $this, "mySrcsetFunction"); The image is $event->object in the hook function. From this you could simply call your current global functions if you like.
-
note_page_id is a variable, which does need to be defined somewhere. That's the part which is missing, which could lead to an answer about why you need to include its value.
-
Firstly. Please use the code block option for all the code snippets you're posting. I've edited you posts above. This makes things a great deal more pleasing to read. About you javascript issue. From such a small snippet it's hard so say anything about it, especially as the part is missing, where you get the value of the input field and save it to your variable. Your second question is easily answered with a yes. You can do that. More info about that can be found here: http://php.net/manual/en/language.variables.variable.php
-
You can look at the returned info in the network tab of the developer tools even if it's an ajax call. But clearly this shouldn't be a php issue, because '[object HTMLInputElement]' is a string javascript does spit out when you try to cast an html node to a string. Therefore please check your javascript to ensure the correct value is actually being sent.
-
Intermediate template structure without string concatenation
LostKobrakai replied to Pete Jones's topic in API & Templates
I've recently switched more an more to a functional approach of building markup, which in my mind let's me focus much more on the data I want to display and keep the markup to a minimum in my code. If more than a handful of lines are needed i'm also using wireRenderFile like Macrura suggested. e.g. your second snippet could look like this: // Get bands and prepend all option $band1pa = $pages->find("id=1015|1016|1017"); $band1array = array_map(function($i){ return array('name' => $i->name, 'title' => $i->title); }, $band1pa->getValues()); array_unshift($band1array, array('name' => '', 'title' => 'All')); // Build markup around options $bandlinks = array_reduce($band1array, function($c, $band){ $link = "<a class='w-inline-block pr-tabs' data-group='$band[name]'>"; $link .= "<div class='pr-tabs-text green'>$band[title]</div>"; $link .= "</a>"; return $c . $link; }, ''); // add container markup $band1_content = "<div class='w-container inset-container tabs filter-options'>$bandlinks</div>";- 13 replies
-
- template
- intermediate
-
(and 1 more)
Tagged with:
-
Does copying of modules not working in PW3?
LostKobrakai replied to Juergen's topic in General Support
I'd certainly consider it a bug. I've fixed the same thing in I think 2.6 some time ago. -
Maybe it would be possible to simply require a forum account to be able to submit drafts (or in the beginning to create user accounts manually for the people wanting to help). It doesn't have to be open for everyone at anytime in my opinion.