Condition for Views?

0
I totally understand that this may be a custom job - but could anyone give any insight on how difficult it would be?

There are several different 'views' which each have their own html template. The default album template is the one I would like to kind of play with.

Is there a way, that depending on the 'type' an album is given - is there a way that perhaps a different album template can be used for each 'type' ?

So for instance, I could have a type called 'Watches' - and of course, for such an item, more of an item - less of an album - you wouldn't need such fields as 'label' 'length' etc. - or even a tracklisting.

I guess by clicking on a track, the template changes for the 'song' view, so I'm sure it wouldn't be that difficult, right?

Best wishes!

Greg
Responses (3)
  • Accepted Answer

    Monday, December 03 2012, 07:52 PM - #Permalink
    0
    it's not that difficult
    if you're a bit of a coder... ;)
    1. just go to the view.html.php file and "retrieve" the TYPE.
    2. create a new layout (for instance, copy default.php into "new.php" or whatever)
    3. in the view.html file, depening on the type, assing the new template
    how? there's a method in the JView class to do that. I don't remember exaclty what is it called but you can look on Joomla developer's documentation. it must be something like "setLayout()" or somethign lke that!

    Germi
    The reply is currently minimized Show
  • Accepted Answer

    Wednesday, December 05 2012, 02:08 PM - #Permalink
    0
    That sounds brilliant. I don't mind being a bit of a coder!

    I had a look, what do you mean by 'retrieve' the type?

    Also, from what I can see - is the JView class only for Joomla 1.5/1.6? I can't see nothing on 2.5.

    Best!

    Greg
    The reply is currently minimized Show
  • Accepted Answer

    Wednesday, December 05 2012, 06:24 PM - #Permalink
    0
    the JView class is for all joomla versions.

    byt retrieve the type I mean that you probably want to look what's the type associated with the album in order to select one layout or the other, don't you?
    you'll find it in $album->types I guess (or similar variable name)
    The reply is currently minimized Show
Your Reply