(solved) category-specific module template?  Bottom

  • I found that it is possible to define a specific page layout depending on module, function and category. I would like to do this only for a module, so that I have the general list template and one that is used only for a specific category.

    I could not find any docs for this, and from what I know so far, templates are bound to certain functions by their names, but would there be a way to achieve this? In the old days in Pagesetter this was easy with different document types, but now I need to do this in Content, where there is no such distinction.

    So, is it possible to override standard module templates depending on categories?

    --
    And out of the chaos sounded a voice and spoke: "Be happy and smile, for it could have come worse."
    And I was happy and smiled - and it came worse...
  • I've wrote a Wiki page (but in the BlankTheme's one) talking about it:

    Specific page templates in Zikula

    hope it helps icon_wink

    --
    - Mateo T. -
    Mis principios... son mis fines
  • Ah, that's the one I meant at the beginning of my first posting. Problem is, this seems to allow to define a special page template for a certain category. If I understand correctly, I could use a different page layout then, but within that page, a certain module would still use the same template for the same function.

    What I like to achieve is to override a module template depending on a certain category. Everything else may stay the same, only that module should use a different template if a specific category is listed. I suppose that (if this is possible at all) it will need to be defined in such a special page layout, but I don't know how (if at all) to achieve the module template override within that page.

    --
    And out of the chaos sounded a voice and spoke: "Be happy and smile, for it could have come worse."
    And I was happy and smiled - and it came worse...
  • Issue solved?
    As it's a requirement in the context of the module, this can be solved in the module templates better,
    from the theme you can add a special class to the main container for specific categories, but that will let you to control the CSS only (that's a lot, but depends if you handle specific information per category)... so
    i guess you probably solved it in the view template of the module
    with a conditional checking which Category (if any) is being displayed...

    For this kind of stuff <--[pndebug]--> is the better friend icon_wink
    Greetings!

    --
    - Mateo T. -
    Mis principios... son mis fines
  • nestormateo

    Issue solved?

    Not yet. I did not see any different response (use of the template I set), no matter what settings I used, so currently I try to use a workaround for the workaround. I guess I need to go back to square one and start with the News example you gave to make sure the procedure itself is correct.

    Edit: It's good the semester is over... icon_razz After going through all config files again I found mistakes, and now at least it works with the Content document PID. With categories however still no success. But now I know the procedure is correct, so it is just one issue that's left...



    edited by: dl7und, Jul 03, 2009 - 11:15 PM

    --
    And out of the chaos sounded a voice and spoke: "Be happy and smile, for it could have come worse."
    And I was happy and smiled - and it came worse...
  • Aaarrrrghhhh, I think I found the problem - and if it is, then there's probably no hope. The page you wrote says the theme engine parses any arguments added to the URL, and the News example has both "view" function and category ID. I just checked: Yes, News allows to view by category, that shows the intro text.

    Content however does not allow that, it needs a document ID for the view function. Categories only work with the list function. Just tried, with list it works, even for secondary categories - but for list I don't need it... icon_frown

    So, it doesn't solve my problem, but the procedure itself works...

    --
    And out of the chaos sounded a voice and spoke: "Be happy and smile, for it could have come worse."
    And I was happy and smiled - and it came worse...
  • I got it, finally. The key was to go the other way... My situation: I have a number of Content documents belonging to one category. If one of them is viewed, I want to display a certain menu block. For all other Content documents and also all other content, other blocks should be displayed.

    Fortunately, the "other" Content documents are few, so my solution was this: In pageconfiguration.ini, I define rules for the "other" documents, followed by a rule for the Content module in general. It seems that each document requires its own rule:

    Code

    [Content/user/view/pid=1]
    file = master.ini

    [Content/user/view/pid=4]
    file = master.ini

    [Content/user/view]
    file = special.ini


    I am using a two-col theme, with the "regular" blocks assigned to left blocks, and the special menu to right blocks. For reasons unknown to me the right block would show up on top of the center block in "regular" page templates, so I modified both home.htm and master.htm to include this:

    Code

    [blockpositions]
    right = empty.htm


    The file "empty.htm is, as the name implies, empty. Finally I copied home.htm to special.htm and modified one line:

    Code

    <!--[blockposition name=left]-->

    I simply replaced "left" with "right". I also do not need to assign empty.htm to left blocks, they don't show up. Finally it works.

    Thanks for the docs, Mateo!

    --
    And out of the chaos sounded a voice and spoke: "Be happy and smile, for it could have come worse."
    And I was happy and smiled - and it came worse...
  • 0 users

This list is based on users active over the last 60 minutes.