Jump to content

adrian

PW-Moderators
  • Posts

    10,902
  • Joined

  • Last visited

  • Days Won

    349

Everything posted by adrian

  1. Check the selector in your search.php file - chance are it doesn't include the require fields that you are storing this information in. Change the selector to include those and you should be fine.
  2. I actually mean code snippets in general, not just those that would be relevant for use with Hanna code. There are so many useful bits of code spread throughout this forum and various gist repos (especially Soma's), but finding them can be difficult. The ability to be able to search for a function and execute it or copy it for use in a template directly from within a code tester/runner or the Hanna code module would be fantastic. I could see that for snippets that perform admin type functions this could actually replace some some potential desire for smaller modules. An example might be your clean-files.php script: http://processwire.com/talk/topic/4437-delete-orphaned-filesimages-from-siteassetsfiles/?p=43687 I think it would be cool to be able to fire up the code runner and browse by category and/or search for "clean orphaned files" and see an explanation of what it does and then be able to run the script directly without the need for copying/pasting from the forum into a template and executing that. With my page tree migrator I have done something like this with the ability to import files directly from the page-list git repo from a simple dropdown, so surely we could something like this using gists, but with searching options?
  3. Here are a couple of related posts that might be worth a read: http://processwire.com/talk/topic/2989-module-that-outputs-a-static-site/ http://processwire.com/talk/topic/4327-dental-practice-web-site/
  4. This does look great horst. I think it is something I am going to have to be aware of though as my page tree migrator module gets closer to release. I can see it being an issue if migrating pages from a site that has this installed, or to one that has it installed if the other doesn't. Not sure how to handle that, but we'll see Just curious - did you test the idea of negative number indexing? Might be opening another can of worms though!
  5. If you're wanting to share data between sites, check out the web services module: http://modules.processwire.com/modules/service-pages/
  6. Sorry, I didn't think it through - the rest of your header is there, so obviously the include is working. Any chance this is a CSS issue? - probably not, but I don't have any other ideas at the moment
  7. Thanks for the details explanation - the behavior you are seeing when using ->sort("-id") is expected and working as intended. I don't really understand why the other approach is not working as it should. I am not sure how you are comparing the output titles to the IDs, so maybe just to be sure can you try: echo '<li><a href="'.$item->url.'">'.$item->title.' ('.$item->id.')</a></li>'; Just in case the your expected order is not actually based on the ID, but rather on your manually sorted order. Which is also why I suggested the -sort option. Sorry if you do have this right - sometimes it can be easy to overlook the simplest things. Maybe also try the selector in the selector test module which will output all the information about each page, including the ID.
  8. Oh I think I see - "all of the pages" means across all paginated results pages - correct? That should still work and it is strange that it is working with -title for you. What happens if you use: sort=-sort
  9. Not sure if this is the problem or not, but do you have "Allow Page Numbers" checked on the URLs tab of the template of the parent page? Are there any logged PHP errors about the include not working? Also, for easier menu creation, take a look at Soma's Navigation module
  10. Maybe I am not following what you need exactly, but I think this might work for you: $matches = $page->children("limit=5,sort=-id");
  11. Ok, well this will hopefully get you started. I haven't seen much on the forum or the docs about doing this. This code is an adaption from what I have just put together to support repeaters in the page tree migrator module. Because the migrator needs to take the IDs from existing repeaters, convert them to names, and then back to IDs, I think what I ended up having to do was probably more complicated than what should be needed in your situation. It worked perfectly for my needs and from some quick testing I think version should work for your needs, but there might be a much simpler way to do it. You will need to adjust the first three lines, and then the lines under both the //Add fields to.. comments. This code creates the repeater field, the necessary fieldgroup and template, but you would still need to add the actual repeater field to the required template, but I get the feeling you have that sorted already with the code you posted. $titlefield = wire("fields")->get("title"); $bodyfield = wire("fields")->get("body"); $repeater_name = "newrepeater"; $f = new Field(); $f->type = $this->modules->get("FieldtypeRepeater"); $f->name = $repeater_name; $repeater_fg = new Fieldgroup(); $repeater_fg->name = "repeater_$repeater_name"; //Add fields to fieldgroup - add others as necessary $repeater_fg->append($titlefield); $repeater_fg->append($bodyfield); $repeater_fg->save(); $repeater_template = new Template(); $repeater_template->name = "repeater_$repeater_name"; $repeater_template->flags = 8; $repeater_template->noChildren = 1; $repeater_template->noParents = 1; $repeater_template->noGlobal = 1; $repeater_template->slashUrls = 1; $repeater_template->fieldgroup = $repeater_fg; $repeater_template->save(); $repeater_page = "for-field-{$f->id}"; $f->parent_id = $this->pages->get("name=$repeater_page")->id; $f->template_id = $repeater_template->id; $f->repeaterReadyItems = 3; //Add fields to the repeater - add others as necessary $f->repeaterFields = $titlefield; $f->repeaterFields = $bodyfield; $f->save();
  12. Are you wanting to add an existing repeater field, or create a new one (including all it's subfields) from scratch and then add that to the module config page. I am guessing the latter, but just wanted to confirm first.
  13. That PDF uploads fine for me. I can't imagine why you could upload files of different types and larger PDFs and have some not work, but I am sure you are just as baffled by that What about the Site Indexer module? - I wonder if that might be the issue since it scans the PDF - can't remember whether it does it on upload or page save though. I wonder if somehow there is an issue with the reporting of the size of these files. Have you tried disabling the HTML5 uploader and seeing if these PDFs will work then? Might help to narrow down the problem to server vs PW
  14. Not yet, but it has been mentioned a few times - try this search term on google: site:processwire.com "markitup"
  15. Is this what you mean? Sorry if I am not understanding. Anyway, that screenshot is from the 11th Oct dev version. Ok, I am stupid - the swatches appear, but don't do anything when clicked - going to crawl back in my hole now I know you have no time, but while I think of it - is the color wheel in the bottom right corner supposed to do anything? I couldn't get anything to happen no matter what version I tested it with. Don't expect a reply here if you are busy I just took a quick look and it turns out that the ul list with the ui-widget-content class is ending up below the admin's footer div. Not sure why this is happening, but just to show that is the issue, everything works again if you replace: $(this).closest('.ui-widget-content').find('div[id^=ColorPicker_]') with: $('div[id^=ColorPicker_]') in the InputfieldColorPicker.js file. Not how it should be fixed, but just thought I'd post it as a start to the debugging!
  16. Hey Soma, Just a comment about the color picker - it is working fine here on Chrome with the dev version I checked out on the 11th of Oct (the last time Ryan mentioned here that changes were committed) and I see that you reported the issue initially on the 4th, so I wonder if there is something else in the mix causing the problem. One thing that doesn't work for me are the clicker arrows to change the RGB and HSB values, but they don't work for me on an older version (long before Ryan's new admin theme) either. Let me know if I can help test this at all.
  17. Well I officially feel a little silly. I was thinking about adding the ability to store code snippets into code tester, and so I thought I'd check out how the Hanna Code module handles this, when I discovered that it also has the ability to run code directly from the admin using the test functionality So after seeing that and how well it's implemented, I am wondering if there is a place for this module at all. The few advantages that Code Tester has over the test functionality in Hanna are: the ability to return the page from a selector query, eg: $getpage = $pages->get(selector); which I do think is very useful when these get more complicated and include chaining etc - ie things that can't be done with the Nik's selector test module. display code results in context of the site's front-end look/structure users might find this module before they find Hanna code if they are searching for a way to test their code I was thinking about linking code tester to gist or the long talked about snippet directory: http://processwire.com/talk/topic/1018-repository-of-php-scripts-for-templates/ I'd still really love to see the snippets directory happen - Ryan, can we help with that? It would be great to have the code that runs the modules directory, rather than starting from scratch. Would you be open to having Hanna code access snippets from a directory directly from the Hanna interface? Anyone have any thoughts?
  18. Macrura has a good suggestion. You could something like this: <?php $fieldtype = "FieldtypeText"; $ts = array("home", "basic-page"); $fields = "test1, Test 1, This is a first test creation test2, Test 2, This is a second test creation"; foreach(explode("\n", $fields) as $field){ $f = new Field(); $components = explode(",",trim($field)); $f->name = $components[0]; $f->type = $fieldtype; $f->label = $components[1]; $f->description = $components[2]; $f->save(); foreach($ts as $t){ $template = $templates->get($t); $template->fields->add($f); $template->fields->save(); } } You can place this is a template file, or to make life easier, you can simply paste it into the Code Tester module or the Hanna code module (using the code test functionality), which makes it super quick and easy to run the code whenever you want. All you need to do is worry about the editing the $fieldtype, $ts (templates) and $fields variables - you should leave the rest untouched. Each line in the $fields string is a new field with the components being: name, label, description This will create all the defined fields and automatically add them to all the templates you specify in the $ts array. Hope that helps - let us know if you need any help with it.
  19. Awesome idea teppo - thanks - I look forward to testing it out!
  20. Ok, I have quickly hacked together some enhancements to Wanze's Batcher module. There is now a Create Fields tab where you can enter the details (name, fieldtype, label & description) for as many fields as you want. A couple of things to keep in mind - some field types require some key config options on the Details and Input tab, so in some cases I am not really sure how much time this will really save. Because of that I have currently limited the field types that can be created to simple text based ones (text, email, url, numeric etc), and left out the more complex ones like page, repeaters, datetime etc. Of course there is the potential to add some of these settings to each item in the create field batcher, but we wouldn't want things to get overly complex. Also, I am not really sure of the etiquette here - I have modified Wanze's module and he may not want to see this functionality in his module (which would be totally fair). So what I have done for now is just include a screenshot of what I have created and I'll wait to hear from him to get his thoughts before posting the code.
  21. You could do what you describe very easily with a module. In fact, my Page field select creator takes a very similar comma separated approach, but for page creation. So you could build something along those lines, but I wonder if it might be better to extend the batcher module to handle field creation. Have a look at that and see if you think its approach to page creation would also work for field creation for you. You could potentially even select the template(s) that you want the field added to after it is created.
  22. I am wondering about the home icon/button in the breadcrumb. While I think it is great to have a link to the homepage of the actual site, I am not sure that is the place for it since the site homepage is not really at the root of the rest of the items in the breadcrumb trail. I wonder if it might be better placed at the top right next to the user icon and maybe use icon-desktop? and maybe have it open in a new window so the user won't potentially lose any unsaved changes.
  23. Love the Fields and Templates "Add New" button in the menu
  24. Hey Ryan, Nice trick with using: $this->page->filesManager()->path(); I'll make use of that instead of the pagefileSecure check I was using in one of my modules. Should this be listed in the cheatsheet? Seems pretty useful to me!
  25. Select dropdown setup taking too long? Check out: http://mods.pw/5R

×
×
  • Create New...