Jump to content

kixe

Members
  • Posts

    803
  • Joined

  • Last visited

  • Days Won

    10

Everything posted by kixe

  1. $page is always the current page if ($page->has('slider')) echo '<script src="path"></script>';
  2. //doesn't work should work if called in a child page //works even if called from the page you are looking for
  3. genious! and $page->closest("parent={$page->rootParent}") will work in bar1 and bar2 too. If you are using the same template. PW API is a creative one.
  4. @Jan Romero $page->parents("parent=$foo") //or $page->parentsUntil("parent=$foo") will return a pageArray. $page->closest("parent=$foo") will include foo too. $page->parent("parent=$foo") yes thats the best solution. Never used this as a method. Thanks! @matjazp You should use Jan Romeros Solution like: $page->parent("parent=/foo/") // searching for the name of parent $page->parent("parent=1022") // searching for the id of parent
  5. $page->rootParent returns Home of course. this should work $p = $page; while($p->parentID != 1) { $p = $p->parent; } Edit: better: Jan Romeros solution (Thanks) $page->parent("parent=/foo/")
  6. @Marty Walker Thanks for your debugging help. Everything fixed.
  7. @BernhardB & Marty You can install the module via Soma's Modules Manager or download it manually and put it in the modules folder. This should work. I will try to fix installation with the 'Download and Install' option in PW. 1 hour later: I could fix it. Should work now. Thank you for reporting.
  8. Have a look in the core module LanguageTranslator and in my module LanguageTranslatorPlus. You will find functions there to find translatable files and also something to extract translatable strings and also something to create jason-files. Make a new function to use bing Api and something to save. If you put this together nicely it would be a useful module for everybody.
  9. @macrura Ahh, thats what you are talking about For everybody: If you want to use this feature you have to create a new field of fieldtype PageTable. 'Automatic Page Name Format' could be set under the 'Input' Tab. I tried it out again and I have to correct myself again. Not good, because you will get an mysql error if you do it more than one time $page = new Page(); $page->parent = 'parentname'; $page->template = 'templatename'; $page->name = 'foo'; $page->save(); Better, because name will be autogenerated unique. $page = new Page(); $page->parent = 'parentname'; $page->template = 'templatename'; $page->title = 'foo'; $page->save(); // or $page = new Page(); $page->parent = 'parentname'; $page->template = 'templatename'; $page->save();
  10. @Macrura This is not processwires new automatic page name feature. It is a php function which generates a hex converted string of microtime(). Since it is quite unlikely that the same page name is generated your example will work, but it is not a clean solution. Edit: Forget about the preceding line If you want to generate a page by processwires api with a unique page name, you have to could use the add() method. No need to instantiate a page object in your template. $parent = 'parentname'; $template = 'templatename'; $name = 'foo'; $pages->add($template,$parent,$name); With this function you get pages with the title 'foo' and the name 'foo-[n]'. [n] is a counter which makes the name unique. You could add a fourth parameter to set other page properties like status or so. The fourth parameter has to be an array. $pages->add($template,$parent,$name,array('status'=>1)); Even if you leave out $page->name = uniqid(); in your example the page will be generated unique. In both cases the counter doesn't work properly since it counts all siblings and not only those with the same name.
  11. kixe

    How is this made?

    A cute devil in pub turns out to drop a clanger. Never get involved with the devil. I need more Smileys here - in the pub, like glass of beer or so. Back to serious discussion ...
  12. No, just create an imagefield assign it to the template where you want it. Create your foto page and select multiple image files to upload in one step. Done! 1000? It will take a while ... Cannot read anymore ... Maybe this is your friend: http://modules.processwire.com/modules/process-batcher/
  13. Yes, its not the biggest problem I have. But there should be a way to solve this. ProcessLogin.module (v101) gives an error notice if an index.php file from an older pw-version is found in the root directory. I played with this one too. I got 6 entries in errors.txt with the same message by one click. Two is ok, but six is too much for the best CMS in the world, isn't it?
  14. @Nico yes you are right, otherwise it is nonsense. Pretty sure I will never use it ...
  15. I triggered it by installing and uninstalling. This way of log writing (outside a try catch handler) is very rare in core. I found it here: FieldtypeComments.module -> after creating a field of type Comments. ProcessPageSort.module -> after a page has been moved or after sort settings has been changed under tab 'children'. Could you please try out this and tell me if you get duplicated entries in messages.txt? Thanks.
  16. I don't know how the module works. But 'name' is a reserved word for the pagename, which is stored in database table 'pages'. It is not a field like 'title', which is assigned to the page. Try another word than 'name'. some other reserved words, which cannot be used for field names: created modified status sort
  17. Consider that users, templates, permissions roles etc. are in fact also pages. Not a good idea to give editors the possibiliy to mess up this. Follow Somas recommendation and build some additional custom datetime fields. If you need the original values as initial value, you could do this in your template $page->of(false); $page->set('CustomFieldModified', $page->modified); $page->set('CustomFieldCreated', $page->created); $page->save(); echo $page->CustomFieldCreated;
  18. During module development I've recognized a strange behaviour. Logfile entries in errors.txt and messages.txt are always created twice. This happened on different servers in different environments with different modules. I tested it with this small module: <?php class Debug extends WireData implements Module { public function init() { $this->message(microtime(),Notice::logOnly); // same with $this->error() } } /*log file entries: * 2014-11-07 05:52:14 admin [...]/admin/module/ 0.43575100 1415335934 * 2014-11-07 05:52:14 admin [...]/admin/module/ 0.43575100 1415335934 */ whereas only a simple entry is generated when I provoke an error an catch it to log with exception handling. <?php class Debug extends WireData implements Module { public function init() { try { foo($bar); } catch(Exception $e) { $this->error($e->getMessage(), Notice::log); } } } /*log file entry: * 2014-11-07 12:45:19 admin [...]/admin/module/ Error: Call to undefined function foo() (line 16 of [...]/site/modules/Debug.module) */ Happened this before anywhere? Any Experiences with that? Any Ideas? Couldn't find out the reason for that!
  19. ... got lost in crone Here is another one ... cronjob for database backup. All Informations here: github: https://github.com/kixe/CronjobDatabaseBackup PW Modules: http://modules.processwire.com/modules/cronjob-database-backup/
  20. Since I recognized a remarkable overflow of my trash bin I made a small module which auto delete pages sustainably from the trash after a period which can be set in module settings. PW modules: http://modules.processwire.com/modules/cronjob-empty-trash/ Github: https://github.com/kixe/CronjobEmptyTrash
  21. @sforsman I think he doesn't want, but the module and/or system does it! @mr-fan Did you try exactly 3 digits? or also more than 3? Hey guys, while playing around with it I get the following results: 40,558 => 40558 // comma thousands separator 40,5587 => 40.56 // comma as decimal separator 40.558 => 40.56 // dot as decimal separator 40,558.89 => 40558.89 // comma as thousand separator, dot as decimal separator 40.558,89 => 40558.89 // the other way round
  22. Looks like a thousands separator. Check it with: $locale_info = localeconv(); print_r($locale_info); /* output maybe? * * * Array * ( * [thousands_sep] => . * * //other stuff * ) */ You could change local settings with setlocale() to handle thousands and decimal separators or add the following line to the module $value = str_replace(".",",",$value); // there is already something like this. Just uncomment and switch search and replacement string. Would be nice to have an option in the module which sanitize the input depending on local settings. Or a config field in the module settings?
  23. Neige en novembre, Noël en décembre

  24. Added module which will do the job until it will be implemented in core. http://modules.processwire.com/modules/process-module-license/
×
×
  • Create New...