Jump to content

alevine

Members
  • Content Count

    22
  • Joined

  • Last visited

Community Reputation

9 Neutral

About alevine

  • Rank
    Jr. Member
  1. That's got to be maddening! All I could find were comments about variables missing their $ identifier, and maybe launching apache with an -x and using truss. :/ Guess it's time to start blocking out segments of code in the new module and poor-man debug what's breaking. Keep us posted, please.
  2. :/ Perhaps another oddity between windows and other platforms when it comes to mysql? If there's anything I can provide you from my side, test case or attempts, please let me know. I'm very happy to assist in giving back -- adam
  3. I think you see the pros. As for the cons, I'm still new to PW, but the others haven't offered any comments about this being a bad thing. As for when the query is run, I honestly don't know either. I pretty much did a blind copy from the Concat field, which is also a run-time/invocation-time process. Hopefully Ryan and the others can provide some insight as to whether it should be called on all the hooks, or just some.
  4. Done and done! Thanks, Soma!
  5. Would someone mind moving this post to the Modules section? Sorry, and thank you.
  6. Hah I'm not entirely sure now what I was trying to ask (I was a mushy brain at that point). I think Ryan best answered, as my concerns were focused on visibility of tree items, and not allowing brute navigation from an end-user's side. I just need to better wrap my head around content accessibility from the admin and end views.
  7. Are you sure you tried it with a Concat field? There's no table created for Concat types, so the rename table should error out. And in the module, I see no reference to creating table data, but rather quite the opposite: public function ___deleteField(Field $field) { // deleting of field not necessary return true; } public function getDatabaseSchema(Field $field) { // no database schema necessary return array(); } public function ___createField(Field $field) { // nothing necessary to create the field return true; } Or is my install just this broken? :/ I am running mysql 5.6.7
  8. All: If you saw some of my recent postings where I was trying to solve the problem of running a query as a field, I have solved it. I started with Hanna text, but that didn't quite get me all the way. Then I tried just a Concat field, and that didn't get me all the way. I modified the Concat fieldtype for my solution. I had a need to dynamically pull Pages that were cross-referenced back: Product as a Page Photo Pages with a multi-Page Select field that referenced Product (A photo could represent 1+ Products) I wanted a ->photos field from Product that was updated dynamically according to what Photo entries were currently in place, and I didn't want copy/pasted code, and I wanted the selectors to be easily modifiable from the admin screens. Usage is faily simple: 1: Install as a normal module 2: Create a field as a PagesSelectorQuery type 3: On the field details, enter your selector string, ie: template=my_template,select_page_field=$page 4: Add your field to whichever templates. 5: Access the PageArray results like you would any other $page->field I hope you find it useful, at the very least as an exercise in my madness. Thanks again for all the help this community has provided. EDIT: Added to GitHub: https://github.com/alevinetx/processwire-modules/blob/master/FieldtypePagesSelectorQuery.module And Module's page: http://modules.processwire.com/modules/fieldtype-pages-selector-query/ FieldtypePagesSelectorQuery.module
  9. Okay, here's something. If I move the query to my page, it's picking up the additional parameter to the query $myPics = $pages->find("template=myContent,premium=0"); So, this tells me somewhere in the translation between defining the Hanna code, the field declaration, and invocation, only the first parameter (template=...) is being picked up, and everything after is being stripped. The Hanna code is only receiving "template=myContent" If I change the field value to be sent in quotes: [[pages_query pagesQuery=template=myContent,premium=0]] Hanna is getting: : template=myContent,=0 Im sure it has something to do with using the Concat fieldtype doing value substitution. Thoughts on what I need to do to amend that? EDIT: The selectors are fine. I just need to modify the Concat module to not do value substitution and all is well. Once I get my selector properly escaped, that is for including a $page reference in the query.
  10. As I showed in some of the examples, I can retrieve values from ->premium when the Pages are returned. As well, the query doesn't error if I give it nonsense for a field name as a 2nd+ selector value. Query code (as Hanna code entry): $foundPages = $pages->find($pagesQuery); echo serialize($foundPages); Field: query_pages, Type: Concat value: [[pages_query pagesQuery=template=myContent,premium=0]] The above value returns 2 pages, when it should only return one. If I look at ->premium on those 2 returns, one is 1, one is 0. I've tried putting the value for pagesQuery in single (') and double (") quotes; with either form of quotes, I get: Notice: Uninitialized string offset: 0 in C:\dev\xampp\htdocs\pwire\wire\core\Selector.php on line 49 Fatal error: Exception: Field does not exist: (in C:\dev\xampp\htdocs\pwire\wire\core\PageFinder.php line 248) #0 [internal function]: PageFinder->___getQuery(Object(Selectors)) #1 C:\dev\xampp\htdocs\pwire\wire\core\Wire.php(271): call_user_func_array(Array, Array) #2 C:\dev\xampp\htdocs\pwire\wire\core\Wire.php(229): Wire->runHooks('getQuery', Array) #3 C:\dev\xampp\htdocs\pwire\wire\core\PageFinder.php(145): Wire->__call('getQuery', Array) #4 C:\dev\xampp\htdocs\pwire\wire\core\PageFinder.php(145): PageFinder->getQuery(Object(Selectors)) #5 C:\dev\xampp\htdocs\pwire\wire\core\Pages.php(144): PageFinder->find(Object(Selectors), Array) #6 [internal function]: Pages->___find('template=myCon...') #7 C:\dev\xampp\htdocs\pwire\wire\core\Wire.php(271): call_user_func_array(Array, Array) #8 C:\dev\xampp\htdocs\pwire\wire\core\Wire.php(229): Wire->runHooks('find', Array) #9 C:\dev\xampp\htdocs\pwire\site\assets\cache\HannaCode\pages_query.php(3): Wire->__call('find', Array) #10 C:\dev\xampp\htdocs\pwire\site\assets\cache\Han in C:\dev\xampp\htdocs\pwire\index.php on line 214
  11. I feel like I'm getting super lost with all of my questions today I have a Checkbox field, "premium". This field is added to a template, myContent I have 2 pages created with the myContent template. One has premium checked, the other does not. My query is: Show me all Pages using 'myContent' as a template, and whose premium field is not selected (0): selector: template=myContent,premium=0 This query is returning 2 Pages, which is should not. When I iterate through the returned list, I can see ->premium as set 1 for one, 0 for the other. If I change "premium" in the selector to some random value that doesn't exist as a field name, the query runs and still returns 2 Pages. selector: template=myContent,feujfhejhejejhejhefje=0 I would think it should error out, but instead seems to be doing a short-circuit evaluation. Are comma-delimited selectors not "AND"ed together? If I place the premium field at the start, or even by itself selector: premium=0 I get this error: Notice: Uninitialized string offset: 0 in C:\dev\xampp\htdocs\pwire\wire\core\Selector.php on line 49 Fatal error: Exception: Field does not exist: (in C:\dev\xampp\htdocs\pwire\wire\core\PageFinder.php line 248) #0 [internal function]: PageFinder->___getQuery(Object(Selectors)) #1 C:\dev\xampp\htdocs\pwire\wire\core\Wire.php(271): call_user_func_array(Array, Array) #2 C:\dev\xampp\htdocs\pwire\wire\core\Wire.php(229): Wire->runHooks('getQuery', Array) #3 C:\dev\xampp\htdocs\pwire\wire\core\PageFinder.php(145): Wire->__call('getQuery', Array) #4 C:\dev\xampp\htdocs\pwire\wire\core\PageFinder.php(145): PageFinder->getQuery(Object(Selectors)) #5 C:\dev\xampp\htdocs\pwire\wire\core\Pages.php(144): PageFinder->find(Object(Selectors), Array) #6 [internal function]: Pages->___find('=0') #7 C:\dev\xampp\htdocs\pwire\wire\core\Wire.php(271): call_user_func_array(Array, Array) #8 C:\dev\xampp\htdocs\pwire\wire\core\Wire.php(229): Wire->runHooks('find', Array) #9 C:\dev\xampp\htdocs\pwire\site\assets\cache\HannaCode\pages_query.php(3): Wire->__call('find', Array) #10 C:\dev\xampp\htdocs\pwire\site\assets\cache\HannaCode\pages_que in C:\dev\xampp\htdocs\pwire\index.php on line 214 Please point out what I'm doing wrong! Thank you. Again!
  12. I have a Concat field whose name i just tried to change was: query_pages attempted: query_subpages After the failure shown below, the prior name still exists, and no reference to the new name I attempted. Result: ProcessField: Saved Field - query_subpages TemplateFile: Can't find file: '.\pwire\field_query_pages.frm' (errno: 2 - No such file or directory) RENAME TABLE `field_query_pages` TO `tmp_field_query_subpages` #0 C:\dev\xampp\htdocs\pwire\wire\core\Fields.php(187): Database->query('RENAME TABLE `f...')#1 [internal function]: Fields->___save(Object(Field))#2 C:\dev\xampp\htdocs\pwire\wire\core\Wire.php(271): call_user_func_array(Array, Array)#3 C:\dev\xampp\htdocs\pwire\wire\core\Wire.php(229): Wire->runHooks('save', Array)#4 C:\dev\xampp\htdocs\pwire\wire\core\Field.php(231): Wire->__call('save', Array)#5 C:\dev\xampp\htdocs\pwire\wire\core\Field.php(231): Fields->save(Object(Field))#6 C:\dev\xampp\htdocs\pwire\wire\modules\Process\ProcessField\ProcessField.module(741): Field->save()#7 [internal function]: ProcessField->___executeSave()#8 C:\dev\xampp\htdocs\pwire\wire\core\Wire.php(271): call_user_func_array(Array, Array)#9 C:\dev\xampp\htdocs\pwire\wire\core\Wire.php(229): Wire->runHooks('executeSave', Array)#10 C:\dev\xampp\htdocs\pwire\wire\core\ProcessController.php(194): Wire->__call('executeSave', Array)#11 C:\dev\xampp\htdocs\pwire\wire\core\ProcessController.php(194): ProcessField->executeSave()#12 [internal function]: ProcessController->___execute()#13 C:\dev\xampp\htdocs\pwire\wire\core\Wire.php(271): call_user_func_array(Array, Array)#14 C:\dev\xampp\htdocs\pwire\wire\core\Wire.php(229): Wire->runHooks('execute', Array)#15 C:\dev\xampp\htdocs\pwire\wire\core\admin.php(45): Wire->__call('execute', Array)#16 C:\dev\xampp\htdocs\pwire\wire\core\admin.php(45): ProcessController->execute()#17 C:\dev\xampp\htdocs\pwire\wire\templates-admin\controller.php(13): require('C:\dev\xampp\ht...')#18 C:\dev\xampp\htdocs\pwire\site\templates\admin.php(13): require('C:\dev\xampp\ht...')#19 C:\dev\xampp\htdocs\pwire\wire\core\TemplateFile.php(125): require('C:\dev\xampp\ht...')#20 [internal function]: TemplateFile->___render()#21 C:\dev\xampp\htdocs\pwire\wire\core\Wire.php(271): call_user_func_array(Array, Array)#22 C:\dev\xampp\htdocs\pwire\wire\core\Wire.php(229): Wire->runHooks('render', Array)#23 C:\dev\xampp\htdocs\pwire\wire\modules\PageRender.module(250): Wire->__call('render', Array)#24 C:\dev\xampp\htdocs\pwire\wire\modules\PageRender.module(250): TemplateFile->render()#25 [internal function]: PageRender->___renderPage(Object(HookEvent))#26 C:\dev\xampp\htdocs\pwire\wire\core\Wire.php(271): call_user_func_array(Array, Array)#27 C:\dev\xampp\htdocs\pwire\wire\core\Wire.php(229): Wire->runHooks('renderPage', Array)#28 C:\dev\xampp\htdocs\pwire\wire\core\Wire.php(293): Wire->__call('renderPage', Array)#29 C:\dev\xampp\htdocs\pwire\wire\core\Wire.php(293): PageRender->renderPage(Object(HookEvent))#30 C:\dev\xampp\htdocs\pwire\wire\core\Wire.php(229): Wire->runHooks('render', Array)#31 C:\dev\xampp\htdocs\pwire\wire\modules\Process\ProcessPageView.module(97): Wire->__call('render', Array)#32 C:\dev\xampp\htdocs\pwire\wire\modules\Process\ProcessPageView.module(97): Page->render()#33 [internal function]: ProcessPageView->___execute()#34 C:\dev\xampp\htdocs\pwire\wire\core\Wire.php(271): call_user_func_array(Array, Array)#35 C:\dev\xampp\htdocs\pwire\wire\core\Wire.php(229): Wire->runHooks('execute', Array)#36 C:\dev\xampp\htdocs\pwire\index.php(192): Wire->__call('execute', Array)#37 C:\dev\xampp\htdocs\pwire\index.php(192): ProcessPageView->execute()#38 {main}
  13. I'm looking for any advice on best practices for creating placeholders in the tree that contain things like selectors, or even assets that should be accessible by end users, but not necessarily browseable. In my tree, I have a "Selectors" placeholder, underwhich I have various categories of Pages used for selector values. Should I have this marked as hidden and/or unpublished to keep it from appearing in any brute-force url attempts? I'm pointing directly to the specific selector tree when defining my fields, but I'm not sure what ramifications the upper selector's visiblity will have. I guess the underlying question is how are those attributes inherited/passed down to children? I know in my searches I can specify to include hidden pages, but if I start my search underneath will I also need to include that? Is this behavior explicitly defined, or currently just a "that's the way it is as an artifact of the way things are designed" that may accidently change at some point? I think a follow up question to this is, how do I best test my site for vulnerabilities/leaked information that's not locked away? Thanks as always!
×
×
  • Create New...