Jump to content

adrian

PW-Moderators
  • Posts

    11,182
  • Joined

  • Last visited

  • Days Won

    372

Everything posted by adrian

  1. Hi Pete, Just playing with this module for the first time - looks fantastic - thank you. Just a couple of things: there are lots of undefined variable and undefined index notices on the module config page that would be nice to have cleaned up. You still have "live" in the js file. I like the approach that Wanze took with live vs on in the batcher module depending on the version of jquery. Also, the "Add another category" button seems to be missing - I am guessing this is a class issue with Ryan's new default admin theme that I am testing it with. Thanks a lot for looking into these.
  2. That's not a valid selector. You could do: $pages->find("title=asd@asd.pl"); EDIT: Wanze beat me
  3. All you need to do is use a selector to see if the email already exists. Do this inside the if($input->post->submit) { and if it exists, do an: $email->error("Sorry, this email address is already in our system"); The selector can use something like: $email_exists = $pages->find(selector); if(count($email_exists) > 0){ to determine is the email address is already in the system.
  4. Not exactly sure if this is the same issue, but I have used this script (http://benalman.com/code/projects/php-simple-proxy/examples/simple/) in several cases and it works great. Here is a direct link to your web service output: http://benalman.com/code/projects/php-simple-proxy/ba-simple-proxy.php?url=http%3A%2F%2Fbenipeixcar.indinet.es%2Fservice-pages%2F%3Fparent%3D1013&full_headers=1&full_status=1 You should probably host the proxy file yourself though.
  5. Are you in the page tree - see attached screenshot EDIT: What interrobang said
  6. It's a little hard to follow exactly how you have your site structure, but you should be able to find the answer for your problem here: http://processwire.com/api/fieldtypes/images/ The very first example shows how to iterate through all images on a page: foreach($page->images as $image) { echo "<img src='$image->url'>"; } If you need to get the images from a child page then simply get the child page first using a selector: $childpage = $page->child(selector to get specific child); Then foreach through $childpage->images
  7. I have had this happen a couple of times before (although not for a long time, so I'd be curious what version of PW you are running). I would suggest removing the module you just tried to install - first the folder in the modules directory, and then the entry from the modules database table - fire up PHPMyAdmin to do this - hopefully your host has it or something similar.
  8. Hi Peter, I have done this, but it requires some core tweaks. Here is the relevant thread: http://processwire.com/talk/topic/2867-small-change-to-inputfieldfilejs-to-facilitate-front-end-html5-uploads/ I do agree though that it would be nice to make this easier.
  9. There are likely a couple of issues with your code. If your images field has "Maximum files allowed" set to anything but "1", you would need to do: $page->image_planet->first() because the images field is an array of more than one image. Also, you need to supply the src with the url to the image, so you would need: $page->image_planet->first()->url It's all in the cheatsheet: http://cheatsheet.processwire.com/ and the images documentation: http://processwire.com/api/fieldtypes/images/
  10. Hey Ryan, Thanks so much for the ability to access the Field object - that really helps. Unfortunately I still can't figure out the Pagefile::install hook. I am definitely trying to add a new file. I can't think of anything I am missing Can you see anything in my code that could be causing the problem? Thanks for any ideas.
  11. You need to define the page to get the children from. If you have that code in an rss.php file, then $page refers to that page. You need it to refer to the page that is the parent of the items you want to get, so try something like: $news_items = $pages->get(selector to get parent)->children(); PS Welcome to the forums
  12. If you want other date/time formats, check out the PHP manual: http://php.net/manual/en/function.date.php
  13. if I understand you correctly you just need to get the page(s) in question first, so something like: $pagestobetrashed = $pages->find("publish_until < time()"); foreach($pagestobetrashed as $ptbt){ $pages->trash($ptbt); }
  14. 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.
  15. 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?
  16. 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/
  17. 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!
  18. If you're wanting to share data between sites, check out the web services module: http://modules.processwire.com/modules/service-pages/
  19. 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
  20. 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.
  21. 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
  22. 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
  23. Maybe I am not following what you need exactly, but I think this might work for you: $matches = $page->children("limit=5,sort=-id");
  24. 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();
  25. 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.
×
×
  • Create New...