Jump to content

Hari KT

Members
  • Posts

    131
  • Joined

  • Last visited

Posts posted by Hari KT

  1. One solution I got from @ryan https://github.com/processwire/processwire-issues/issues/2037#issuecomment-2643216328

    the most direct to me seems just to use a hook in `site/templates/admin.php` and apply the dir attribute with JS.

    1. 

    $wire->addHookAfter('ProcessPageEdit::execute', function(HookEvent $e) {
      $rtl = [ 'arabic', 'japanese' ];
      $js = '';
      foreach($e->wire()->languages as $l) {
        if(!in_array($l->name, $rtl)) continue;
        $js .= "$('.LanguageSupport[data-language=$l]').find('input[type=text],textarea').attr('dir', 'rtl');";
      }
      if($js) $e->return .= "<script>$js</script>";
    });
     
    If you wanted it configurable with a checkbox on each language page (in Setup > Languages). Then you'd add a new checkbox field named "rtl" to your "language" template, and then use this code instead:
     
    2. 
     
    $wire->addHookAfter('ProcessPageEdit::execute', function(HookEvent $e) {
      $js = '';
      foreach($e->wire()->languages as $l) {
        if(!$l->rtl) continue;
        $js .= "$('.LanguageSupport[data-language=$l]').find('input[type=text],textarea').attr('dir', 'rtl');";
      }
      if($js) $e->return .= "<script>$js</script>";
    });

    I have used the 2nd option. Also 

    Quote

    adding to `site/ready.php` worked. But not in `site/templates/admin.php`

    The only issue now is the ckeditor / tinymce is not rtl. I want to find a way to fix that also.

  2. I have installed https://processwire.com/download/site-profiles/#multi-language-site-profile version dev (3.0.245) and running on nginx. I have tried adding new language with name oh, but that is pointing to default language in front-end. Also tried editing existing language German de to ar Arabic. But this time the url appends 'de' and not 'ar' in the url. If we go to the About edit page , now we can see the "Oh" have no name appended. I have deleted sites/cache folder, but not reflecting the front-end . How to fix this ?

    image.thumb.png.c577f58fb1be28acbe6ffc29a0f5d3ac.png

    image.png.65a6f6b54ac38620e2cb8162e3e2ce4a.png

  3. Hi all,

    Have you guys came across http://github.com/puli/ ? I am not sure how processwire is going to make use of composer in 3.0 apart from namespace ( I didn't noticed in the newsletter or probably missed in the blog posts ) . But I believe the concept of  http://docs.puli.io/ combined with PSR-7 and composer will be a revolution in the PHP ( yet to see though ) .

    I wished if processwire in 3.0 would take some of the good concepts to make things smooth and easy.

  4. Hey Marcus, 

    Yes as dependency is a hell it is good to leave it to composer ;) . And as you know installing modules is simple as 

    composer require <vendor/packagename>

    The only thing to do is to keep a composer.json file for all the modules

    {
        "name": "vendor/package-name",
        "type": "pw-module",
        "description": "Your module what it does",
        "keywords": [ "keywords", "comma", "seprated"],
        "homepage": "https://github.com/harikt",
        "license": "BSD-2-Clause",
        "authors": [
            {
                "name": "Contributors",
                "homepage": "https://github.com/harikt"
            }
        ],
        "require": {
            "hari/pw-module": "~0.0.1"
        }
    }

    and add to packagist. The only things to note in composer.json is the 

    "type": "pw-module",

    and 

    "require": {
        "hari/pw-module": "~0.0.1"
    }
    

    We are all done. 

    Happy PhPing!

    • Like 2
  5. Hey @marcus 

    Regarding the module downloads, I am not sure if you noticed my earlier posts

    http://harikt.com/blog/2013/11/16/composer-support-for-processwire-modules/

    http://harikt.com/blog/2013/11/19/composer-support-for-processwire-part-2/

    That way we can install modules on the site/modules folder as we are doing with just composer.

    I am also missing how processwire will support composer in the future, if anyone can give some insights / links it may also help.

    EDIT : I am happy to change the vendor name and give to processwire if Ryan likes it.

    Thank you

    • Like 2
  6. @Kongondo sure. I will update here.

    Quick things : 

    * The ok() , err() methods were changed to log to PSR-3 logger.

    * All the $_POST values were changed to accept from the method. Eg dbSaveConfig($post) .

    $installer = new Installer($psr3logger);
    $installer->
    $installer->dbSaveConfig($post);
    

    As it is not using global values like `$_POST` and `$_SERVER` all values are passed to methods. Hope this helps!

    • Like 1
  7. Hi, 

    I was trying to build a command line installer for processwire . The script basically uses the install.php .

    case 0: 
        $this->initProfile(); 
        break;
    case 1: 
        $this->compatibilityCheck(); 
        break;
    case 2: 
        $this->dbConfig();  
        break;
    case 4: 
        $this->dbSaveConfig();  
        break;
    case 5: 
        require("./index.php"); 
        $this->adminAccountSave($wire); 
        break;
    

    What I am having trouble is at step 5 where it tries to create the user account. 

    It throws an exception

    Error: Exception: You do not have permission to execute this module - ProcessPageView (in /var/www/pwtest/hello/wire/core/Modules.php line 875)

    when 

    require 'index.php';
    

    is called. Is there something special to make the `index.php` throwing without an error ?

    Thank you

×
×
  • Create New...