[theme] Changing views path

Discussion in 'General discussions' started by Sarunas, Mar 17, 2015.

  1. Sarunas

    Sarunas New Member

    Joined:
    Feb 18, 2015
    Messages:
    21
    Likes Received:
    0
    S.E:
    Expired
    L.T:
    Regular
    L.C:
    1
    I creating new theme and I want to override module views without editing script files
    from:
    /apps/customer/views/
    to:
    /customer/themes/MyThemename/views/

    Is this possible?
     
  2. twisted1919

    twisted1919 Administrator Staff Member

    Joined:
    Dec 27, 2014
    Messages:
    10,477
    Likes Received:
    2,443
  3. Sarunas

    Sarunas New Member

    Joined:
    Feb 18, 2015
    Messages:
    21
    Likes Received:
    0
    S.E:
    Expired
    L.T:
    Regular
    L.C:
    1
    Thanks. Nice theme but this works only in frontend :)
    Maybe I can find theme for customer with custom module views from /apps/customer/views/
     
  4. twisted1919

    twisted1919 Administrator Staff Member

    Joined:
    Dec 27, 2014
    Messages:
    10,477
    Likes Received:
    2,443
    It's just an example, you can as well transform it into one for customer area, just have a look at how it is formatted, at the entry script and you'll understand how to create one for customer area as well.

    Just a hint, if you create a theme for customer, say a theme named "whatever", it must contain only:
    Code:
    --whatever (folder containing theme files)
    ----- WhateverTheme.php - the entry file, copy it from the demo theme and keep only the run() method, and empty that method
    ----- views - the folder that can contain folders to override the ones from customer/views folder
    
    Then just pack it, go to Mailwizz -> Backend -> Extend -> Themes, click on the customer tab and install it from there, then simply copy folders from apps/customer/views into the theme view folder in order to override the defaults.

    It's harder to explain, in practice it's very simple actually.
     
    Sarunas likes this.
  5. Sarunas

    Sarunas New Member

    Joined:
    Feb 18, 2015
    Messages:
    21
    Likes Received:
    0
    S.E:
    Expired
    L.T:
    Regular
    L.C:
    1
    Thank you.
    It's working :)
     
  6. Sarunas

    Sarunas New Member

    Joined:
    Feb 18, 2015
    Messages:
    21
    Likes Received:
    0
    S.E:
    Expired
    L.T:
    Regular
    L.C:
    1
    Have one more question how to change widget path?
    like:
    Code:
    <?php $this->widget('customer.components.web.widgets.LeftSideNavigationWidget');?>
     
  7. twisted1919

    twisted1919 Administrator Staff Member

    Joined:
    Dec 27, 2014
    Messages:
    10,477
    Likes Received:
    2,443
    if your theme is named "abc" and it is located in /customer/themes, you can create in abc a folder named components, in in a folder called web, in it a folder called widgets and in it a file called AbcLeftSideNavigationWidget.php. Inside this file you should have:
    PHP:
    <?php
    require_once Yii::getPathOfAlias('customer.components.web.widgets.LeftSideNavigationWidget') . '.php';
    class 
    LeftSideNavigationWidget extends LeftSideNavigationWidget {

       
    // your code here
       
    public function run() {
            
    parent::run();
       }
    }
    Now you can load your new widget anywhere by simply doing:
    Code:
    <?php $this->widget('root.customer.themes.abc.components.web.widgets.AbcLeftSideNavigationWidget');?>
    
     
    Sarunas likes this.
  8. Sarunas

    Sarunas New Member

    Joined:
    Feb 18, 2015
    Messages:
    21
    Likes Received:
    0
    S.E:
    Expired
    L.T:
    Regular
    L.C:
    1
    Thank you. Working
     
  9. Dimitris

    Dimitris New Member

    Joined:
    May 29, 2015
    Messages:
    20
    Likes Received:
    0
    S.E:
    Expired
    L.T:
    Regular
    L.C:
    1
    Hello,
    I have done everything so said and then I install it. But I can't see the theme in the list. I only get an empty list.
    Inside the function run do I have to write something?
    Thank you
     
  10. twisted1919

    twisted1919 Administrator Staff Member

    Joined:
    Dec 27, 2014
    Messages:
    10,477
    Likes Received:
    2,443
    @Dimitris - You can attach the theme class file here and we can see what you did.
     

Share This Page