Jump to content

kongondo

PW-Moderators
  • Posts

    7,480
  • Joined

  • Last visited

  • Days Won

    146

Everything posted by kongondo

  1. Thx to @Pete, I've managed to restore the content of this post (about complex menu structures) that got lost during the upgrade.
  2. Yes...Devs tend to use VARCHAR or Blob. I use VARCHAR. Note that as of MySQL 5.7, there is a native JSON data type. Here's some articles/references about the data type + advice on when/if you should use it. https://dev.mysql.com/doc/refman/5.7/en/json.html http://lornajane.net/posts/2016/mysql-5-7-json-features https://www.sitepoint.com/use-json-data-fields-mysql-databases/ http://stackoverflow.com/questions/5544749/what-column-type-should-be-used-to-store-serialized-data-in-a-mysql-db http://stackoverflow.com/questions/33660866/native-json-support-in-mysql-5-7-what-is-the-pros-and-cons-of-json-data-type https://benjaminlistwon.com/working-with-json-data-in-mysql-part-1-of-3
  3. Thanks Soma. I have been doing it the 'hidden-admin-page-way'...as you suggested way back in this thread . Good to know there's other ways too.
  4. Unfortunately there's not enough docs at the moment. Isn't that why you are writing docs? . Joking aside... 3 Tips Due to the paucity in documentation most (all?) of us learned by looking at other modules. Simpler core modules, custom modules such as Batcher, Trashman, etc. The module Blog creates fields on the fly during installation. Have a look at the code here. Also have a look at ProcessBlog phpMyAdmin: have a look at the table fields. You will see a list of all the installed fields. Look at the column 'data'. All field settings are stored in there as JSON as key=>value pairs. Why is this important you ask? All (?) the keys in the strings correspond to the field properties that can be set...e.g. $field->description, $field->derefAsPage, etc. Also have a look at the column 'label'. The trick here is to open a field for editing and add and remove settings and save while keeping an eye of the field's 'data' column to observe changes. In respect of templates, same trick can be used on the table 'templates' http://kongondo.github.io/ProcessWireAPIGen/dev/class-Field.html
  5. @benbyf Mod Note: Please post such questions in the module development sub-forum. The main module forum is only for support of released modules Thanks.
  6. Thanks Benjamin. That's how I am doing it at the moment but was worried I could affect other fields in that short instance I do the check..before reverting back. I was probably being paranoid...
  7. In a module-context, as we know, stuff like single file or image fields return 'arrays', i.e. become iterable. This means that directly using WireArray::Iterable() to check whether a field is iterable can be misleading. Other than to temporarily set a page's output formatting to true (still within a module context), checking iterability of a field on the page, then reverting the page's output formatting to false after the check, is there another/a better way to achieve the same feat? Thanks.
  8. Hi @Soma. Could you please elaborate on how to do this? I don't quite follow what is being sent where . Thanks..
  9. @all, @johnteaksf. I just noticed that the forum upgrade seems to have cannibalised some of the content in my post about the new getMenuItems() method which allows for building of complex menus. I have contacted @Pete to see if I could get the content restored from an old backup. Part of the missing content addressed the advantages of returning menu object items rather than array items...
  10. @SoccerGuy3, I'm not sure you've seen this, in the Tab Settings, right under 'Pages selectable in menu'? There's also a note on line #486 to the same effect. The normal practice is not to directly edit modules. Your 150 will get overwritten next time you upgrade Menu Builder and all will not be well . What you want to do is to use Page Auto Complete or Asm Select and add limit=150 to the setting above ('Pages selectable in menu')
  11. Hi @johnteaksf, Welcome to the forums. Currently, it is not possible and I see no easy way of doing it within the module. My suggestion is that you try (and adapt to your needs), the approach outlined on page 7 of this support board, specifically this post or this gist See the example array of the $key => $value pairs you'd be working with here. The important things to remember are that Custom Links will not have a 'pages_id' $key. So, that's one way to identify such links in your loop You will have to code the inclusion of the children yourself
  12. It would be good to also work on some Modules that do not 'autoload' Thanks for your efforts....
  13. Same here @adrian, unfortunately Tracy has always led to very slow page loads for me. I also don't use the sessionhandler module. I only switch Tracy on when I need to debug a specific error then switch it off again. I am only mentioning this to confirm the reported behaviour but have no further info to help you debug the issue, sorry .
  14. This might also be of interest...ProcessWire 2.8! https://processwire.com/blog/posts/processwire-3.0.21-and-2.8.21/
  15. @cmscritic Hey Mike, The fact that you can drop in and share with us so much about your reasons for the move says a lot about you. I like that; I respect that. As others have said, we've also gained a lot as a community from your collaboration with Ryan: Hanna Code, the awesome CMS Critic development write-up, and who knows how many people have found ProcessWire because of your site . So, thanks for the ride... Best wishes for the future.
  16. If all you want is to save the page IDs, then maybe it is easiest just to just use a page field, the only difference being your Inputfield. So, you would create an inputfield that renders InputfieldSelector from which pages can searched for and selected. Like @LostKobrakai mentioned, all you would need is to make sure on hit save your selected pages are sent. PW will handle the rest. So, something like class InputfieldYourModuleName extends InputfieldSelectMultiple implements InputfieldHasArrayValue { } In there your would have ___render()// here render your inputfieldselector + your multiple selects (i.e. list or show and/or store selected IDs) ___processInput()// for processing sent values...basically looping through an array and sending those to PW for saving... @edit: thrice my code disappeared! New forum, grrr! I'm not typing again, sorry...Have a look at some custom Inputfields
  17. Short answer: you can't. Fields that save to the db each come with a defined database schema. In your case that would be FieldtypePage. As you can see, its db schema only saves integers , i.e. the ID of the pages selected in the page field and only has the one db column in the table it creates. Your best bet is probably to extend FieldtypePage and create your own schema. There's an example here by @Raymond Geerts. Have a look at the method getDatabaseSchema(). Of course in your case your db type will be something else, maybe varchar(255) or text... Welcome to the forums btw..
  18. Update: Version 010 Changelog Following up on the last commit, made message to show if no base image found configurable.
  19. Update: Version 009 Changelog Changed behaviour if no base image found; display friendly message instead of field error. Thx @Macrura for request.
  20. Makes sense. I have updated the module to: Show a field error (a) if base image field NOT specified, (b) if specified base image field is of WRONG type or (c) does NOT exist; Render a friendly message in the output of the inputfield itself about 'a base image not found, please upload one and save page to use the field blah blah'. Please update to version 009 and let me know if it works for you, thanks.
  21. So, it's a PW 3.xx issue. Once we have an official stable release of PW 3.xx I'll test all my modules to ensure they are version 3.xx-compatible.
  22. I see you are using PW 3.x. Could you please try in a multilingual PW 2.7xx and let me know if it works?
  23. Have a look at this example for one way to do it. Create a third argument for your function, maybe called first. Use that to determine when to append 'Home'.
  24. No there isn't currently but I am not getting what your use case is. Why add it to a template if you are not going to use it? Maybe elaborate more. Btw, the recommendation is to use a file field to hold the image and not an image field since you'll have an image rendered twice when editing a page using the template...once in the image field and once more in ImageMarker..
  25. Saw that once in a multilingual setup, IIRC.....What's your setup? PW version, etc...
×
×
  • Create New...