Results 1 to 6 of 6

Thread: Module position

  1. #1

    Default Module position

    Lets assume I have a module (navigation)

    Is there any way, I can find where in which section this module is placed, whether it is placed in #header or #footer ?

    I wanted to change $this->cssID within my custom module on the fly depending on its locations.
    Last edited by tsarma; 10/27/2015 at 12:56.
    OM MANI PEME HUNG! how many has to die for freedom and dignity. Save this world

  2. #2
    User Andreas's Avatar
    Join Date
    07-11-09.
    Location
    Mönchengladbach
    Posts
    499

    Default

    Don't use an ID if you want to place the module multiple times.

    You can reach the modules in it's location by analyzing the selector.

    e.g. #header .my_navigation, #footer .my_navigation

    You can try to check the layout container in your template with $this->showTemplateVars() or var_dump($this) but I think this is not necessary.
    Last edited by Andreas; 10/28/2015 at 13:10.
    Web-Development, Freelancer, Burgtech, XHTML, HTML5, CSS, PHP, Javascript, MooTools, MySQL and more
    Amazon wishlist

  3. #3

    Default

    Quote Originally Posted by Andreas View Post
    Don't use an ID if you want to place the module multiple times.

    Yout can reach the modules in it's location by analyzing the selector.

    e.g. #header .my_navigation, #footer .my_navigation

    You can try to check the layout container in your template with $this->showTemplateVars() or var_dump($this) but I think this is not necessary.
    Thank you for your answer, your approach is only applicable to the rendered output in frontend with CSS or Javascript.

    What I wanted is something more before that, in the template rendering time, I wanted to add/remove html snippet depending on the location of my module.
    For example my Navigation module when it is placed inside #header, it should have some extra html, but the same module when placed inside #footer should not have that extra html and $this->cssID should change to $this->cssID + "_footer". This I think can be done easily only when we can programatically know the location.
    OM MANI PEME HUNG! how many has to die for freedom and dignity. Save this world

  4. #4
    User Andreas's Avatar
    Join Date
    07-11-09.
    Location
    Mönchengladbach
    Posts
    499

    Default

    So check if your template offers the variable of layout section. If not, you simply can set up 2 modules.
    Web-Development, Freelancer, Burgtech, XHTML, HTML5, CSS, PHP, Javascript, MooTools, MySQL and more
    Amazon wishlist

  5. #5

    Default

    Quote Originally Posted by Andreas View Post
    So check if your template offers the variable of layout section. If not, you simply can set up 2 modules.
    As far as my understanding, I don't get information/variable about layout section in template. Presently I am doing as you have suggested with 2 modules (In my case, I have 2 custom navigation module with same links). The whole thing I am doing this is to avoid having to setup 2 modules :-).
    OM MANI PEME HUNG! how many has to die for freedom and dignity. Save this world

  6. #6
    User Andreas's Avatar
    Join Date
    07-11-09.
    Location
    Mönchengladbach
    Posts
    499

    Default

    Ok, somewhere I saw the variable of layout section, maybe it was in a mod_article template.

    I'm an absolute minimalist, but I think I also would go with 2 modules. Maybe there will come another difference with this two navigations later and you're glad you have two ones.
    Web-Development, Freelancer, Burgtech, XHTML, HTML5, CSS, PHP, Javascript, MooTools, MySQL and more
    Amazon wishlist

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •