Jump to content

kixe

Members
  • Posts

    807
  • Joined

  • Last visited

  • Days Won

    10

Everything posted by kixe

  1. Of course I missed them. Thanks for the hint.
  2. http://modules.processwire.com/modules/process-file-edit/ https://processwire.com/talk/topic/14276-file-editor/ http://modules.processwire.com/modules/template-editor/
  3. Of course the selector 'mh_bautraeger.id=mh_bautraeger.id' will give you no result since the value page id cannot be a string. It is always an integer. If I get you right you want to create a page select field providing all pages using template lstg_mainTmpl having a mh_bautraeger selected which is also selected in any (or only one?) other page using mh_mainTmpl. This is not possible via selector but you can do this via custom php code. You find a quick instruction under Input tab in your field setting. The hook should be placed in your /site/ready.php It could be helpful if you describe what the final target of your setting is. Maybe there exist a completely different approach.
  4. Thanks for input. I have been searching for something really short. I am also not sure about the modules name. Any recommendation welcome. I changed the method/ property names to moveFirst and moveLast.
  5. How to set page->sort via API The variable $page is the page you want to move // move to beginning $pages->sort($page, 0); // move to end $lastSibling = $page->siblings('include=all')->last(); $pages->insertAfter($page, $lastSibling); // move 1 step forward $pages->insertAfter($page, $page->next); // move 1 step backwards $pages->insertBefore($page, $page->prev); // move to any index position $newIndex = 0; if ($newIndex === 0) $pages->sort($page, 0); else { $futureBefore = $page->siblings('include=all')->eq($newIndex); $futureBefore = $futureBefore? $futureBefore : $page->siblings('include=all')->last(); $pages->insertAfter($page, $futureBefore); }
  6. This morning I pushed a module to github which extends the page api with moving and sorting capability. https://github.com/kixe/PageMove * CALLABLE (static & instance) * PageMove::execute($page, $parent = null, $newIndex = 0, $selector = 'all'); * $modules->get('PageMove')->execute($page, $parent = null, $newIndex = 0, $selector = 'all'); * * EXTENDED PAGE API * @method $page->move($parent, $newIndex = null, $selector = 'all') * @method $page->setIndex($newIndex, $selector = 'all') // set absolute index include=all * @method $page->getIndex($selector = '') // same as $page->index without argument @see getSelector() * * @method $page->moveFirst($parent = null) * @method $page->moveLast($parent = null) * @method $page->moveForward($steps = 1, $selector = 'all') * @method $page->moveBackwards($steps = 1, $selector = 'all') * * @property $page->moveFirst // same parent * @property $page->moveLast * @property $page->moveForward * @property $page->moveBackwards * * EXTENDED PAGES API * @method $pages->move($page, $parent = null, $newIndex = 0, $selector = 'all') * @method $pages->resortChildren($page, $selectorValue) * // same like core function $pages->sort($page, true); with capibility to change the sort condition Have a nice weekend.
  7. @horst Thanks. Didn't know about that. Will have a look inside asap.
  8. If it is not necessary to sort the pages additionally manually the last one can also be the first one if you reverse the order. Just go to the parent template settings select created in Sort settings for children and check Reverse sort direction
  9. If you do not assign a title the autogenerated ID (Inputfield) will be taken. $inputfields->attr('title', 'Weird name'); To put the Inputfields (Tabs) in the right order you could use InputfieldWrapper::insertBefore() or InputfieldWrapper::insertAfter() instead of InputfieldWrapper::add(). Unfortunately this doesn't work in case of ProcessPageEdit. To get it working you need to add another hook to ProcessPageEdit::getTabs() The following code snippet should work. Place it in your /site/ready.php wire()->addHookAfter('ProcessPageEdit::buildForm', function ($event) { $page = $event->object->getPage(); if ($page->template == "bewerbung") { $form = $event->return; $inputfields = new InputfieldWrapper(); $inputfields->attr('title', 'Weird Name'); $inputfields->attr('name+id', 'WeirdTabNameAndId'); // we need both unique ID and Name $markup = wire()->modules->get('InputfieldMarkup'); $markup->label = 'Custom Lable'; $markup->value = '<p>Just a placeholder for any custom markup</p>'; $inputfields->add($markup); $pageEditTab = $form->find('id=ProcessPageEditContent')->first(); $form->insertAfter($inputfields, $pageEditTab); // inserting in the right place is not enough to set the tab order // we need the following hook wire()->addHookAfter('ProcessPageEdit::getTabs', function ($event) { $event->return = array_merge( array_slice($event->return, 0, 1, true), array('WeirdTabNameAndId' => __('Weird Name')), // should be identical to the weird name/title above array_slice($event->return, 1, null, true) ); }); $event->return = $form; } });
  10. Not tested: http://modules.processwire.com/modules/inputfield-textarea-markup/
  11. The topic you found is about modules. If you want to add a tab to your page edit screen you should create a field of type FieldsetTabOpen. Add it to your template and place the inputfields you want to show up under this tab between the opening and closing field.
  12. Today I have been running in mysql errors using @renobird s Module MarkupActivityLog which still uses mysqli Driver. @all developers Although mysqli is still supported PDO driver is the default database driver in PW since https://processwire.com/about/news/introducing-processwire-2.4/ and its strongly recommend to all module authors to use/change-to PDO driver instead of mysqli. @renobird I have sent a pull request. A list of other affected modules not updated until now. (I try to keep them up to date. Please help) @apeisa ProcessTrashman, ProcessRedirects @netcarver ProcessDiagnostics
  13. You could use http://modules.processwire.com/modules/markup-activity-log/ http://modules.processwire.com/modules/version-control/
  14. I am quite happy with translation options included in PW. Translatable strings like $out = $this->_("Live long and prosper"); // syntax within a class (modules) $out = __("Live long and prosper!"); // syntax outside of a class (templates) are useful for modules and (rarely) in the template system. To make them accesible globally I define a page property in my _init.php file which is prepended to each template. /** * define globally used translatable strings here */ $page->__read_more = __('Read more'); $page->__submit = __('Submit'); Furthermore I use some language related functions (language specific date and time formats). These functions are placed in _func.inc which is included by the _init.php // Include shared functions include_once("_func.inc"); Everything else is content and should be stored in multilanguage fields. (text, textarea, optionselect)
  15. Database errors are always logged. You will find entry in your /site/assets/logs/errors.txt file 2017-03-18 16:05:27 ? http://example.org/?/ Error: Exception: SQLSTATE[HY000] [1049] Unknown database 'example' (in .../wire/core/ProcessWire.php line 375) Depending on your config.php settings an Email will be sent /** * Admin email address * * Optional email address to send fatal error notifications to. * * #input email * @var string * */ $config->adminEmail = ''; In case of fatal errors the following html file will be send <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html> <head> <title>500 Internal Server Error</title> </head> <body> <h1>Internal Server Error</h1> <p>The server encountered an internal error or misconfiguration and was unable to complete your request.</p> <p>{message}</p> </body> </html> You can modify it. You'll find the file (default installation) in /site/templates/errors/500.html
  16. You can set the parent, but not the rootParent. RootParent is determined on the base of the pages parent. Method rootParent() is a getter and not setter. Yes, you are able to modify the rootParent with a hook. But the hook option is not meant to change the rootParent and NOT the parent. (which would result in unexpected conflicts). Solution: change the parent.
  17. Are you looking for: $config->urls->templates $config->prependTemplateFile Checkout https://processwire.com/api/ref/config/
  18. I f you prepend an _init.php to each template this would be a good place to switch the locale. There is no need to merge setlocale and number_format. Since the output after changing the locale isn't enough for your needs I would go on with number_format. I don't know if &thinsp; for the smaller space as thousands separator is well supported by browsers (fonts). So I would try the following: $code = $pages->get(1)->localName($user->language); switch ($code) { case 'en': $number = number_format($page->prixAuMetreCarre, 2, '.', ''); break; case 'fr': $number = number_format($page->prixAuMetreCarre, 2, ',', '<span style="font-size: 0.3em;">&nbsp;</span>'); break; case 'de': $number = number_format($page->prixAuMetreCarre, 2, ',', '.'); break; default: $number = number_format($page->prixAuMetreCarre, 2, ',', '<span style="font-size: 0.3em;">&nbsp;</span>'); } echo "$number €"; There is also a php function money_format. You maybe want to use this? http://php.net/manual/en/function.money-format.php
  19. Ask @ryan about the apikey. Maybe its just an option to limit requests in the future if needed. Currently only pw300 and pw280 is valid. I didn't check if there is a different return.
  20. Yes for sure. Sorry for answering unclear. I just wanted to say that the information about the module version is pulled from the processwire modules directory by default. You could add a hook before ProcessModule::executeEdit() and change this only if the classname of the event object matches your specific module.
  21. There is a topic and a fieldtype to solve problems like this. https://processwire.com/talk/topic/7542-development-fieldtypefloat-fieldtypedecimal/ http://modules.processwire.com/modules/fieldtype-decimal/ or $code = $pages->get(1)->localName($user->language); switch ($code) { case 'en': setlocale(LC_ALL, 'en_GB.UTF-8'); break; default: setlocale(LC_ALL, 'fr_FR.UTF-8'); }
  22. Read this http://modules.processwire.com/export-json/ You have the option to change the following in your config.php $config->moduleServiceURL = 'http://modules.processwire.com/export-json/'; $config->moduleServiceKey = (__NAMESPACE__ ? 'pw300' : 'pw280'); Example for a request http://modules.processwire.com/export-json/FieldtypeSelectExtOption/?apikey=pw300 created from moduleServiceURL, ModuleClassName, moduleServiceKey (GET Parameter)
  23. If the parent page is the adminRootPage (pageID = 2) a tab is automatically created.
  24. I am talking about the pages with template 'grille-tarifaire' (values of your page table). Check under settings tab: access, status and if second language is enabled (checked). Why did you set the page status to hidden? If you want to show the values you need to publish the page. The page is anyway not accesible directly if you don't have a template file 'grille-tarifaire' for the output.
  25. Yes. Put the following code in your /site/ready.php <?php $this->addHookBefore('YourClass::renderImage', function ($e) { $image = $e->arguments(0); $image->requiredDimensions = '100x100'; $e->arguments(0, $image); }); or wire()->addHookBefore('YourClass::renderImage', null, 'beforeRenderImage'); function beforeRenderImage($e) { $image = $e->arguments(0); $image->requiredDimensions = '100x100'; $e->arguments(0, $image); } Read docs about hooks: https://processwire.com/api/hooks/
×
×
  • Create New...