Jump to content

kixe

Members
  • Posts

    802
  • Joined

  • Last visited

  • Days Won

    10

Everything posted by kixe

  1. @Petra Welcome to the forums. In such cases you have 2 handy friends in ProcessWire. https://modules.processwire.com/modules/process-jumplinks/ https://modules.processwire.com/modules/process-redirects/
  2. The nifty code: $base = wire('config')->urls; $cssUrl = $base->InputfieldPassword."InputfieldPassword.css"; echo '<link rel="stylesheet" href="'.$cssUrl.'">'; $jsUrls = array(); $jsUrls[] = $base->InputfieldPassword."complexify/jquery.complexify.min.js"; $jsUrls[] = $base->InputfieldPassword."complexify/jquery.complexify.banlist.js"; $jsUrls[] = $base->JqueryCore."xregexp.min.js"; $jsUrls[] = $base->InputfieldPassword."InputfieldPassword.min.js"; foreach ($jsUrls as $jsUrl) { echo "<script src='$jsUrl'></script>"; }
  3. How to disable/ enable specified languages in language fields for specified pages. 1.) Put this in your config.php and define pages and related languages via IDs /** * enable specified languages for specified pages in the page edit interface * use keys (IDs) for the pages and arrays of language->ids which you want to enable for this page * */ $config->editablePageLanguages = array( 1 => array(1072), // only one other language beside default 1634 => array() // only default ); 2.) Add this hook to your ready.php $this->addHookBefore('ProcessPageEdit::execute', function($e) { // get id of page beeing edited $pid = (int) $this->input->get('id'); if (!$pid) return; $configPageLanguages = $this->wire('config')->editablePageLanguages; if (!array_key_exists($pid, $configPageLanguages)) return; foreach ($this->wire('languages') as $lang) { if ($lang->isDefault() || in_array($lang->id, $configPageLanguages[$pid])) continue; $lang = $this->wire('languages')->get($lang->id); $lang->status = 1024; } $this->wire('languages')->reloadLanguages(); }); With a few changes within the foreach loop, you can change from whitelisting to blacklisting if this is more appropriate to your needs.
  4. Normally there cannot be a duplication of the sort index for the same pages_id. Before an Imagefield is stored all page related entries (pages_id == $page->id) are deleted first from the database before the new sorted images are stored (@see /wire/core/FieldtypeMulti.php) .Try to clear manually all related entries from the database and try again.
  5. @derdogan In PW >= 3.0.39 you have the option to modify sql_mode via $config->dbSqlModes too. Have a look here: https://github.com/processwire/processwire/blob/master/wire/config.php#L879 Thanks @ryan to point this out.
  6. Both is possible since InputfieldWrapper::get() calls InputfieldWrapper::getChildByName() /** * assuming $form is a member of InputfieldWrapper class * the return of the following api calls are similar * if the field exists the return value is an instance of Inputfield otherwise NULL */ $form->tags; $form->get('tags'); $form->getChildByName('tags');
  7. @adrianmak I didn't say you should put something inside another function. Did I? You can remove all the other stuff from the file, because it is not needed. What did you try to put inside your field? Please post here! The setting allows you to use exactly what I described. Nothing else! For example <i class="fa fa-awesome"></i> // allowed <i class="fa fa-awesome">nobreakspace-or-whatever</i> // NOT allowed
  8. I agree, thats a bit tricky. There is a default setting in CKEditor which overrides the <i> tag with <em>. Luckily CKEditor is highly configurable, even in ProcessWire. If you don't want to disable ACF (Allowed Content Filtering) generally there is this specified solution: Create a config file: /site/modules/InputfieldCKEditor/config.js (if its not already there) with the following content to allow empty <i> tags as used for font-awesome icons CKEDITOR.config.protectedSource.push(/<i[a-z0-9\=\'\"_\- ]*><\/i>/g);
  9. cool video 1000 words vs. 7 minutes video watching One picture says more than 1000 words Have a nice weekend
  10. @elabx Thanks for interest. Have a look here: https://processwire.com/talk/topic/1025-multisite/?do=findComment&comment=144509 https://github.com/kixe/Multisite/tree/kixe Need some thumbs up here https://github.com/processwire/processwire-requests/issues/94
  11. I had similar problems after updating MYSQL via homebrew and importing a Backup made by ProcessDatabaseBackups. I could fix it by adding a few lines to my .sql file. Could you give some information about MYSQL version and your global settings (my.cnf) especially sql_mode? Try the following to solve # --- check sql mode SELECT @@sql_mode; +-------------------------------------------------------------------------------------------------------------------------------------------+ | @@sql_mode | +-------------------------------------------------------------------------------------------------------------------------------------------+ | ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION | +-------------------------------------------------------------------------------------------------------------------------------------------+ # --- you could add this on top in the .sql file # --- remove values STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE from the returned values and overwrite sql mode. Looks like SET @@session.sql_mode ="ONLY_FULL_GROUP_BYERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"; # --- should also work SET @@session.sql_mode ="ALLOW_INVALID_DATES"; # --- or SET @@session.sql_mode ="";
  12. The hook doesn't create a page. The hook is called if a page is created. If you add a page with a repeater field in its template the hook is called twice, because 2 pages have been created. If you have 2 repeater fields Pages::added will be triggered 3 times and so on. This is not a bug.
  13. Unfortunately full language support doesn't works properly since the core function LanguageSupportPageNames::getPagePath() isn't hookable, whereas Page::path() is. I posted a request to change this. Support welcome. Thanks in advance. https://github.com/processwire/processwire-requests/issues/94
  14. Forked this module a few days ago and ended up in a complete rewrite. Still under development and testing but working properly here. What is different? Do not worry about page naming. The root page is defined via ID. Full multilanguage support * take in account $template->slashUrl settings take in account LanguageSupportPagenames::useHomeSegment settings Fallback to default 404 page if custom 404 is not set Throws exception in case of misconfiguration Access of pages residing in a MultisitePageTree for other domains other than the corresponding root page is disallowed except for superuser Pages inside a MultisitePageTree accessible only via the modified url if called from the corresponding domain (throws 404 instead of unexpected redirects) Page paths are set via hook in Page::path() instead of modifying the return of Page::render() Crosslink support via the RTE (CK Editor) Link plugin Page view links in admin with correctly modified urls * under conditions: see next post! Feedback welcome. Have a try: https://github.com/kixe/Multisite/tree/kixe
  15. @Kiwi Chris Welcome! Could this module be a solution for you? AdminRestrictBranch last update 12.04.2017, stable
  16. put this in your ready.php wire()->addHookBefore('Page::addable', null, function ($e) { if ($e->object->parents->count > 1) $e->object->template->noChildren = 1; });
  17. @adrian I am working on a multisite project using single database. I forked multisite.module by Antti and another fork by Soma and started to adapt it for my needs. Luckily I found your module. I tried it out and it fits 90% to my needs and already saved a lot of work. Thanks for this great module. To get it working properly I need to make some changes. I think these changes could also be an enhancement of your module and you maybe want to take it. First of all I need an option to set branchRootParentId via hook which is currently not possible since the related function isn't hookable and private too. It would be nice if you could change the visibility of the function getBranchRootParentId() to protected and make it hookable. As far I can see there is no reason (security) to refrain from this. Furthermore there are 2 unexpected behaviours or potential issues: In Processwire the breadcrumb 'Pages' is prepended to breadcrumbs in the PageEdit area of the root page only. @see ProcessPageEdit::setupBreadcrumbs() This behaviour is different in your module. The breadcrumb is prepended in any Editor not only for the branchRootParent since $this->wire('breadcrumbs')->count() returns always 0. Is this wanted like that? I would prefer the default behavior here. I found a working solution. If you like I could post an issue on github. The BranchRootParent is not prepended to the Pagetree under PagesTab. ProcessPageList::executeNavJSON() doesn't prepend branchRootParent here. This couldn't be solved inside your module. I can see a PW issue here. ProcessPageList::executeNavJSON() should use $config->rootPageID instead of hardcoded 1 Possible Solution // in ProcessPageList::executeNavJSON // Line 489 from if(!$parentID) $parentID = 1; // to if(!$parentID) $parentID = $config->rootPageID; // Line 494 from if($parentID === 1 && $parentViewable) $items->prepend($parent); // to if($parentID === $config->rootPageID && $parentViewable) $items->prepend($parent); // Line 523 from $numChildren = $id > 1 ? $page->numChildren : 0; // to $numChildren = $id != $config->rootPageID ? $page->numChildren : 0; // Line 551 from if($page->id > 1 && $page->numChildren) { // to if($page->id != $config->rootPageID && $page->numChildren) { //in your module public function ready() { $this->wire('config')->rootPageID = $this->branchRootParentId; // ... }
  18. @PWaddict Thanks. I could reproduce. I will try to fix this.
  19. @PWaddict Just to be sure. You are talking about modules version 2.0.7 I pushed this morning? Note The strings you have posted doesn't work at all for me. I had to change from utf8 to utf-8 to get it work. But this depends on the environment and if you get the right output of your datetime field in the frontend it should work in the module too.
  20. It works for me, since I didn't use comma separated multiple values. With latest version it should work for your settings too.
  21. @PWaddict Module works as expected. No failures here. Thanks, but I have no need for your suggestions. Feel free to fork it and adapt it for your needs.
  22. It depends on your server settings. You should play around a bit with LanguageSupport:: _('C') translation strings. In my local environment I am getting the following results in a test template: setlocale(LC_TIME , 'de_DE'); echo $page->mydatetimefield; // getting Mai-27-2017 setlocale(LC_TIME , 'en_EN'); echo $page->mydatetimefield; // getting Mai-27-2017, expecting May-27-2017 setlocale(LC_TIME , 'en_US'); echo $page->mydatetimefield; // getting May-27-2017 As you can see I am not able to solve this via the module. Have also a look here http://stackoverflow.com/questions/10909911/php-setlocale-has-no-effect
  23. Sorry for the trouble. I tested with translations 'en_EN' for default and 'de_DE' for german and it works. If I set german as default it doesn't work. I will have a deeper look asap.
  24. @PWaddict Thanks for pointing on LanguageSupport::_('C'). I pushed an update 2.0.5 which is aware of this.
×
×
  • Create New...