Jump to content

Soma

Moderators
  • Posts

    6,808
  • Joined

  • Last visited

  • Days Won

    159

Everything posted by Soma

  1. Wel Welcome sosoba! This would be possible by making a hook to any of the the form building methods in ProcessPageEdit.module. All methods with three underscores are hookable. All about hooks. Take the HelloWorld.module and add this hook to the init() $this->addHookAfter('ProcessPageEdit::buildFormSettings', $this, 'buildFormSettings'); And then add this function to the class. public function buildFormSettings(HookEvent $event){ $fieldset = $event->return; // get the fieldwrapper returned $field = $fieldset->get("_pw_page_name"); // get the name field $field->collapsed = Inputfield::collapsedYes; }
  2. It's not possible to help without seeing your code. $event depends on what you hook. Theres a comprehensive new docu by Ryan on the API section.
  3. This modules isn't aware of those setting as it uses it's own process to get and render out the pages. I know it can be implemented and where, but it's not that simple as I'm also not aware of all settings and effects this would have... I would consider using the new LanguagePageNames, which for sure will work in those cases. It's still in beta, but so is this module and not sure we're going to further maintain this module because it's now in core what this module implements.
  4. The $page var in the custom PHP field is "broken" in 2.3 as it doesn't return the page edited anymore but the process page edit. I just got a problem with this yesterday when updating a website to latest PW. I fixed it by using $_GET['id'] to get the id of the page being edited. $p = $pages->get($_GET['id']);
  5. Maybe Ryan was doing something, or it's again the caching from github page. Ryan setup a PW installation I've done to manage the cheatsheet in future. It's available here http://cheatsheet.processwire.com/ Or on github page http://somatonic.github.io/ProcessWireCheatsheet/
  6. Some interesting reads for those interested in security: Well it should be mandatory for every webdev to know these thing or at least care about. Hack yourself first - how to go on the offence before online attackers do http://www.troyhunt.com/2013/05/hack-yourself-first-how-to-go-on.html Feel free to discuss or post other articles about the subject.
  7. Yeah it's not (yet) on the Cheatsheet. No it does grab the pages by id as the name indicated ProcessWire never does grab the "whole" pages unless you need it or a field is autojoin. It's kinda lazy loading.
  8. Well that doesn't really come through until now... So what now? If all of the "list" are in the PageArray (but also some others), or if the PageArray is the list 1:1... ? Now I'm curious why you want or need that? I would do that if you want to test if all of the list pages are in the PageArray: $result = $pages->find("template=basic-page"); $list = $pages->getById('1001,1002'); if(count($result->filter("id=$list")) == count($list)){ echo "all found"; }
  9. Soma

    ProcessWire on the web

    A german presentation about ProcessWire: Video: (second half is PW) https://bambuser.com/v/3588985 Slides: http://wdcmdresden.github.io/treffen/24-knockout-und-processwire/processwire/#/
  10. That's what I assume he wants... If you want to know which is in the page array use filter. $found = $pageArray->filter("id=1001|1003|1005"); echo $found; // 1001|1003
  11. All you can do in the site/config.php is something like you can get from PHP: $config->debug = false; if(isset($_GET['debug'])) $config->debug = true; So you could add /?debug to a url and have debug mode on. Or you could add this to the top in admin.php template in site/templates/ folder if($user->name == 'admin') $config->debug = true; And have debug mode only for admin only in admin.
  12. It's not possible or doesn't do anything in a template because PW needs the config to be loaded at the very start, and at the time a template is rendered it's maybe already too late. Also it won't enable it in the backend, which you probably want. Why not directly in the config.php.? Well, you also can't use $user in the config.php itself, since it's too early and $user isn't yet there when loaded by PW index.php. So the best option (if I'm not missing something) would be a autoload module and put that code in the init function. public function init() { if($this->user->hasRole('superuser')){ $this->config->debug = maybe; } else { $this->config->debug = false; } } If you put that in HelloWorld.module's init it will work fine and load at the beginning when the API becomes available. Edit: somewhere along these lines if not completely mistaken.
  13. Just $pageArray-> has("id=1001|1003") will do it.
  14. Welcome! Im sure youll get millions of answers within shortly. (Love it)
  15. Aaaand you also need to enable Page Number setting on the template you use this code.
  16. There's an example on that page you linked... Let's look, to have PW pagination module work you need to use some search $pages->find() ..children() ..siblings() with a limit selector as explained above. But this alone isn't going to cut it. You'll also need to render the pager. This, you do by using the result you get from the find() and add a renderPager() to it. So the above code is missing that. Let's add the missing part. <?php if($page->numChildren) { $result = $page->children("limit=2"); // render the pager echo $result->renderPager(); // render the children echo "<ul class='nav'>"; foreach($result as $child) { echo "<li><a href='{$child->url}'>{$child->title}</a></li>"; } echo "</ul>"; // render pager again? ok echo $result->renderPager(); } Wasn't that easy?
  17. Yeah its an input(field). Sorry to confuz you. ;-) Theres even an FieldtypePageName and InputfieldPageName. (A db field isnt also a field?)
  18. Only mandatory field is name. Title can be removed. Hint globall settings.
  19. I have this installed recently on a latest PW, and it doesn't do anything after saving. Also the remember setting doesn't do remember. Any ideas?
  20. It's "not possible". http://processwire.com/talk/topic/651-set-created-by-creating-a-page-via-api/ Some technique would be to import to a date field you add to templates and use that, or copy that date later via SQL to the pages table 'created' field.
  21. The fix would be easy to add this before line #62 if(!$this->input->get('id')) return;
  22. Ah sorry missed the change temple part... now it's more obvious a bug
  23. Nothing wrong there, this is bitwise operator http://www.php.net/manual/en/language.operators.bitwise.php Ther error says $this->editedPage is not an object... so maybe even the line before fails for you for unknown reasons $this->editedPage = wire('pages')->get((int)$this->input->get('id')); can you try replace #62 with echo wire('pages')->get((int)$this->input->get('id')); exit; And refresh page and see what output?
  24. Works just like a charm here.
  25. http://processwire.com/about/news/introducing-processwire-2.3/#newfunctions Some of those link to the repository are broken, since you changed the class file names.
×
×
  • Create New...