changing the theme by view overloading

Hi everyone,

I am new to elgg and themes.I am following the tutorial for changing the theme.I made a new plugin and since i am trying to change the footer. I changed footer.php and put it in the folder /mod/myplugin/views/default/css/elements/footer.php.

Now i don't know what to write in my start.php file to trigger the action.

Looking forward to hear from you wonderful people.

Regards

neupas

  • Hi neupas,

    Glad to see you making some efforts, to completely overwrite the view there is nothing you need in your start.php.  Just having the file in the right directory structure is enough.  The footer view isn't in the right place, I don't have elgg open at the moment but I believe it's views/default/page/elements/footer.php

    Depending on what you are trying to do, it's recommended to extend a view instead of overriding it.  Extending it basically means you are appending your code either before or after the existing view.

    To do that you use

    elgg_extend_view('existing/view', 'your/view', $priority);

    in your init function in start.php

    Where $priority is a number (500 by default), lower than 500 and your view will be prepended (included first), and over 500 it will be appended (included after).

    Extending isn't always possible depending on the changes, but when it is possible it is the recommended course of action as it increases compatibility with other plugins that use that view.

  • i think you want your file in:-
          mod/myPlugin/views/default/page/elements\footer.php
    then (top of my head) start.php says :-
          elgg_extend_view('page/elements/footer', 'myPlugin/page/elements/footer');

    ... probably shud re-check that last line.

     

  • LOLZ.. Matt - we doan sleep ehh ?? abt 1 am here ;-oO

  • <?php

    /* Elgg Theme Simple Example */

    /* Initialise the theme */

    function myplugin_init(){

    }

    // Initialise log browser

    elgg_register_event_handler('init','system','myplugin_init');

    ?>

  • first of all i would like to thank Matt,dhrup and steve for prompt and precise reply on the questions i had so far. This is huge boost to confidence for newbie like me. I really appreciate your reply ,late night on monday.

    I tried overloading views by extending the footer and without extending  and it worked perfectly.

    Thank you once again for motivating me and helping me.

     

    Regards

    neupas