Jump to content

Soma

Moderators
  • Posts

    6,798
  • Joined

  • Last visited

  • Days Won

    158

Everything posted by Soma

  1. The field is not an object but a string. Turn off output formatting.
  2. I think problem is that with fulltext ~ and * mysql doesn't index words with hyphens, I think it splits it and since it's left with "1" it doesn't index 1 or words with less than 4 chars. So if you use ~=sport it will find your sport-1 cause it's only indexing "sport". http://stackoverflow.com/questions/5192499/how-to-allow-fulltext-searching-with-hyphens-in-the-search-query http://bugs.mysql.com/bug.php?id=2095 Using % will work but also search phrases so sport-1 would also find sport-12 For now maybe don't use hyphens. After all Tags should be words not "word-word" see?
  3. I'm not seeing any problem with %=sport-1 as horst suggested. It finds all iamge that has the tag "sport-1"
  4. I'm not sure really, but maybe there's no cache created on first open. Can you see a ModuleManager.cache n the site/assets/cache folder?
  5. Thanks. But this script isn't used, so it's kinda leftover.
  6. RT @processwire: New blog post: More new core comments upgrades… Admin comment approval by email, user notifications, and more– https://t.c…

  7. It comes from htaccess $_GET['it']
  8. Go to root page anand enter names/prefix there.
  9. It works. You might haven't configured all correct. This in the init() method public function init() { if($this->config->ajax && $this->input->it == "webservice/"){ if(!$this->input->action) return; $out = array( "it" => $this->input->it, "action" => $this->input->action, "pageid" => $this->input->pageid, ); header('Content-type: application/json'); echo json_encode($out); exit(); } } and then this jquery ajax call work just fine <script> $(function(){ $.ajax({url:'/webservice/', data: {action: 'getPage', pageid: 1001}, method: 'post'}).success(function(data){ console.log("page", data); }); }); Nothing wrong with the PageNotFound as far as I can tell I'm using both approaches
  10. 500 server error hints at htaccess. should have plenty of threads about 500 and htaccess.
  11. And is there a hidden form-builder page in the site tree?
  12. Is there a form-builder.php in site/templates folder?
  13. You don't really have to hook page not found... just check for ajax and a POST var in the init() of a autload module as I wrote before ... public function init(){ if(!$this->config->ajax) return; if($this->input->webservice){ $id = $this->input->id; echo json_encode(array("status" => "ok", "data" => $id)); exit; } } and you would call a url like your root http://domain.com/?mywebservice&id=10 or using post works with same code
  14. Thanks Oliver for sharing, just I can't really try it out for various reasons. I'm really digging people share their "MVC" approaches, but with this one more, it would be around 5 different ones now around. I'm not sure what to think about the impact on PW new and old users, support etc as it will split and create burdens for one to help someone using x-mvc approach. I have nothing against many ways to setup PW projects and while that's a strength it may even more is a weakness at the same time with its consequences. Really not against you and your approach, it just turns out by chance that I write this here. I'm not sure its worth of discussion. Wouldn't it be better to settle on one "MVC" ish setup that PW maybe even supports, it could help to keep focus on it and maybe even have official docs for it. Often it doesn't help telling a dev hey look there's this this and this but you can also use this and this, but that is not for PW 2.5 while that is only for php 5.5 and the other you can't use if you use multisite and those are not multilanguageable. Hard for me to explain well but I think one get the idea where I'm heading.
  15. minor update 2.1.5 added external links, if available, below description to project (github), direct download and forum support thread.
  16. Yeah if there was a 48hour day I already started some months ago trying owzim bash script, but didn't finish. The idea was that each new version will give a new sheet. If someone wants to contribute and have time just let us know.
  17. Do we really need two version of the same module?
  18. You can with a autoload module in the init() method, use the wire("config")->ajax and maybe check for post values etc and return output then exit() if(wire("config")->ajax){ if(wire("input")->post->something){ echo "hello"; exit; } }
  19. @ivan not sure I follow $allDescendantsOfEvents = $pages->get('/events/')->find(""); Too many code examples in this thread that makes no sense. You don't want to return ALL descendants to then filter them again by parent etc. In my cases this could return 100k pages it then filters 100 pages from that...
  20. The function seems a little overkill, but why not. After all to get the grandchildren you only need something like $grandchildren = $pages->find("parent=$page->children, sort=-modified, limit=20"); That's already a function right there. One can of course wrap it into a function and play around with it.
  21. Version two would then be <?php class SaveShortUrl extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'Rewrite field after save', 'version' => 2, 'summary' => 'An example module used for demonstration purposes. See the /site/modules/Helloworld.module file for details.', 'href' => 'http://www.processwire.com', 'singular' => true, 'autoload' => 'template=admin', 'icon' => 'smile-o', ); } public function init() { /** * Hook called just before a page is saved * * May be preferable to a before(save) hook because you know for sure a save will * be executed immediately after this is called. Whereas you don't necessarily know * that when before(save) is called, as an error may prevent it. */ $this->pages->addHookAfter('saveReady', $this, 'hookPageSave'); } /** * Save domain info to another field * No need to call page->save() when changing a value * as it will get saved just after this call. * * Make sure there's something in source_url and it has actually changed * with $page->isChanged(what) */ public function hookPageSave(HookEvent $event) { $page = $event->arguments("page"); if($page->template != "basic-page") return; if(!$page->source_url) return; if(!$page->isChanged("source_url")) return; $page->domain = parse_url($page->source_url, PHP_URL_HOST); if($page->domain) $this->message("Saved the domain: {$page->domain}."); } } now you have already a module in the "modules" table in your DB, go to phpmyadmin and remove the entry for "saveShortUrl" Come back and refresh modules, and install the new one.
  22. Had to correct some code after posting, sorry.
×
×
  • Create New...