Jump to content

adrian

PW-Moderators
  • Posts

    10,902
  • Joined

  • Last visited

  • Days Won

    349

Everything posted by adrian

  1. I think your issue is not the hook, but rather the: $form->get("reconocimientos") It is not an object. I am not really very familiar with hooking in templates, but I just tested this and it works: <?php $page->addHookBefore('Page::loaded', null, 'errorTest'); function errorTest(HookEvent $e) { error_log('testhook'); } so I think you are on the right track, but you need to sort out your form object. Are you maybe using FormBuilder? or do you have $forms defined elsewhere in your code?
  2. nghi - don't bother - just grab the lastest dev version of PW - Ryan has implement toggling of grid and list views for images - very nice
  3. Just added support for being able to return a page based on a selector, eg: //populate the results frame with the page returned by the selector. You must use $getpage as the variable! $getpage = $pages->get(selector); EDIT: Just added a code fix (in the included template file) and requirement for using $getpage as the variable to populate to avoid conflicts with normal code execution.
  4. Just updated module with support for the ACE editor module so there is now syntax highlighting if you have it installed. EDIT: Also support for populating the $out variable, rather than echo'ing out the content directly if you'd prefer (either works). You can change this to a different variable in the code_tester.php file.
  5. This module is obsolete - please use the Console Panel in Tracy: https://adrianbj.github.io/TracyDebugger/#/debug-bar?id=console Ok, this is really not very fancy, but I think it will come in quite handy - for me at least It provides an admin page where you can test code without the need to edit template files. It runs from a new item under Setup called "Code Tester" Simply enter your code, including an opening <?php and click "Run Code". Page will refresh with the code block still in editor, and with an iframe containing the results of your code below. In some cases the output may not be relevant if your code is manipulating pages etc via the API, rather than outputting content to a page. Then you can easily make code changes and run again. Github: https://github.com/adrianbj/ProcessCodeTester Installation Install as normal, then move the included file "code_tester.php" to your site's templates folder. Depending on your sites template structure, you may want to edit this file. I have set it up using the head.inc and foot.inc approach that is used in PW's default profile. There are detailed instructions in the file to make it easy to modify as needed if you prefer using a single main.inc or other approach. Install the ACE Text Editor module if you want syntax highlighting. That's It! How it works Nothing very high tech - when the module installs it creates a new template: code_tester and a new unpublished page: Code Tester. When you click "Run Code" it creates/updates this file: /site/assets/files/ID_of_Code_Tester_page/code_tester_code.php and writes your code to the file. This file is included from the code_tester.php file and the code is run and the output processed. Note that I am using ob_start(); include; $out = ob_get_clean(); so that this will work take the approach of populating variables that are output within a main/shared markup file like main.inc If you want to use a variable other than $out in your test code, you will need to edit the code_tester.php file accordingly. Things you can do It may not be immediately obvious as to some of the things that work with this, so here are some examples: echo 'test'; $out .= 'test'; //list page titles matching the selector foreach($pages->find(selector) as $p) $out .= "<li>$p->title</li>"; //populate the results frame with the page returned by the selector. You must use $getpage as the variable! $getpage = $pages->get(selector); // bulk delete pages matching the selector foreach($pages->find(selector) as $p) $p->delete(); So really it is more than a code tester - it can also be used as a way to test selectors and return the resulting page and also as a way of running admin maintenance scripts. Hopefully you guys might find it useful. Please let me know if you have any thoughts for improvements.
  6. Hey horst, I just tested Soma's code with the sorting set to none and it seems to be working fine. The new page was added to the top of the children, but I could still manually sort without any error. I am running the latest dev - maybe a couple of days old. Let me know if there is any specific scenario I can help you test.
  7. Hi Radek, Sorry - I think my reply may have come across wrong. I was not suggesting that localization support shouldn't exist at all. I think it is very important! I guess my reason for mentioning that I don't have a use for it was to emphasize how impressed I am by your efforts, even though they don't have direct benefit for me in the english speaking world. I have played around with localization a little in PW in development of some modules, which is why I pointed to that thread on distribution of module translations - I think it is important that this becomes easier and standard. Hope I didn't offend in any way.
  8. Or, if you have access to PHPMyAdmin (or similar), you can look in the pages table for the "name" of the row with an "id" of 2 PS I think you can safely change the "name" field to whatever you want which will of course change the URL.
  9. Personally I really have no need for language translations (although perhaps I should - maybe it is a typical english speaker's arrogant oversight ), but I am still amazed at the work you have put in on this. It does make me think we need to revisit this topic though: http://processwire.com/talk/topic/2583-delivering-module-translations/
  10. I haven't tested Soma's solution, so not sure about those bugs, but do you need manual sorting in the back-end after creation? If not, wouldn't Ryan's suggestion of setting the sort order to "date created" in reverse work for you? I am guessing you do want the manual sorting, but thought I'd mention it, just in case
  11. I asked Ryan about this module and he is happy with it going in the modules directory, so I have submitted it: http://modules.processwire.com/modules/process-redirect-ids/ It is fine to have it run on all your pages/templates (the default), but don't forget to check out the module config settings where you can limit this. Remember it is only called by pages that return a 404 so I don't believe there should be any overhead on normal page loads. So please feel free to start using it and let me know if you have any improvements you'd like to see.
  12. Just been thinking about joshuag's original aim and wonder if it could be tackled from a different angle. I know I often have the instinct to categorize things in the page tree to make them easier to find when editing, like in his example: /blog/ cat1/ article1 article2 cat2/ article3 article4 I usually refrain because I want the simpler URL structure on the front-end and it can be hard to know what category is really the most important when an article belongs in multiple categories, but it can make browsing through pages tedious when you have 100's or 1000's of articles. What I wondering is if there might be a way to group and sort the pages into categories in the tree view based on a chosen (and easily changeable) field value (most likely an ASM field that points to a list of selectable categories). I see this as being somewhat analogous to the way we can add tags to fields to have them appear grouped on the Setup > Fields page. Not sure the best way to implement this - maybe it could be a module - I'll think about it more soon - maybe even put together a mockup of what I think it could look like. Imagine being able to instantly group and sort the page tree by year and month, and then switch to subject, keywords, categories, or whatever other field you want. Any thoughts?
  13. I have made a few minor tweaks / cleanup, but mostly improved the documentation in the Github readme and also in the first post in this thread, along with some new screenshots showing all the functionality in use. Will need a bigger chunk of time to deal with the major enhancements etc, but hopefully now you can get a better idea of what it does and it will be a little more user-friendly to test out. Send me feedback!
  14. Hey horst - did you see this thread: http://processwire.com/talk/topic/3327-new-page-on-top/ EDIT: and this: http://processwire.com/talk/topic/1428-create-new-child-as-top-sibling-rather-than-bottom/
  15. Thanks ozwim for the testing and bug reports. I'll see what I can do about getting these sorted out. I haven't tested with fieldsets at all yet. As for the error on line 734 - it is a language module related thing. I had seen that once before - should be easy enough to sort out. Good idea for adding details to the github readme on what's working etc - I have a feeling it will be an increasing list for a while, before it starts getting smaller, but I am sure we'll get there
  16. It depends on whether you want one or several dev websites set up under htdocs. You can do root, but chances are you'll want more than one, so subfolders would make sense. Also, if you haven't seen it, check out DNSMasq - it will make multiple sites a breeze - trust me and take the time to set this up! Here are some instructions for MAMP setup that might be handy: http://eddmann.com/posts/the-ultimate-mamp-setup-hands-down/ There shouldn't be a processwire directory - htaccess will take care of redirecting something like localhost/processwire to the admin panel, assuming you left the admin as "processwire" Regarding the rewrite base - make sure you only uncomment one at a time, not all. I would assume the first would work if you installed processwire in htdocs.
  17. Hey Martijn, I have made some substantial changes and pushed to github: Images are no longer deleted and repopulated by default - makes saving the page when there are no changes to the videos much faster as this module doesn't have to do much. Any images that are from videos that have been removed from the page are now deleted on a per video basis (ie if the URL is now gone) I have removed the option to disable image renaming - renaming proved essential to make the above two options work properly. I don't think this should be a problem. Renaming is handled slightly differently nowif you choose "First Available" for Which Images, it will name the image like so: videoID.jpg (eg: pmqzchx-mtc.jpg) if you choose "All Available" images it will append the name to the videoID: videoID-imageName.jpg (eg: pmqzchx-mtc-maxresdefault.jpg) I think this change will make it even easier to call the image from the API as you can directly match the image name to the video ID without knowing which one was grabbed. You just need to do a strtolower on the video ID as image names in PW must be lowercase. I think that's it, but definitely open to additions if you have ideas / code. EDIT: v0.1.3 limits module to page edit process only - prevents php notices on other admin pages.
  18. Hi applab and welcome to PW! Maybe check out this module: http://modules.processwire.com/modules/page-edit-field-permission/ and see if that can do what you need.
  19. Given that PW installed properly, I assume you managed to change htaccess.txt to .htaccess? It might not be visible now though. Does entering the following in your terminal help: defaults write com.apple.Finder AppleShowAllFiles YES Once you can edit the .htaccess file at the root of your site, try uncommenting some of the rewrite base options - probably the first one will do the trick.
  20. Is it possible that error is still there as a result of previous issues? I am wondering if the image is still in the field_images DB table, but not on the filesystem. I would try removing it from the database and see if that resets things.
  21. I think you want deleteAll() rather than removeAll() which works on WireArray, not on files/images. Let us know if that solves your problem.
  22. Just pushed a new update that supports multiple videos in multiple fields on a page, so this should now work seamlessly with the VideoEmbed module. Also, you can now select the fields to search and the images field to populate using dropdown selects, rather than manually entering. The list of fields is limited to appropriate field types. Thumbnails in first post have been updated to show new functionality.
  23. Just a quick on - and maybe this is something for Soma to fix in the modules manager, rather than in your theme (I haven't checked where the problem is), but see the button offset in the attached screenshot.
  24. No need to hack anything. Check out Image Interceptor: http://modules.processwire.com/modules/textformatter-image-interceptor/ That will take care of the resizing and can also add a class to the image that can be used to trigger a call to your lightbox script.
  25. Make sure you have debug mode on so you can see any errors that are thrown. It might be as simple as needing this before the save line: wire('page')->of(false); http://wiki.processwire.com/index.php/Text_Formatters http://cheatsheet.processwire.com/?filter=of(true
×
×
  • Create New...