Different Panel for each Level of a hirarchical Taxonomy

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
humanoid's picture

Hi,

For a hiking-community offering free maps, I want to create 3 different Panels for the 3 hirarchical taxonomy levels I use to categorize the maps.
- one Panel for the first level taxonomy displaying a specific node (grafical map) for each term, block with child terms, block with node list of promoted maps
- one Panel for the second level taxonomy displaying a specific node (Text for this hiking region) for each term, block with child terms, block with node list of promoted maps
- one Panel for the third level taxonomy displaying a list with all nodes (maps) of this category, block with node list of promoted maps

I played along some time now with views and panels 2 and I love this - yeah, great modules! I created a taxonomy/term/% override panel which lists a view of matching nodes and a block of child taxonomy. But what I can't figure out is: Is it possible to create different panels with views for each hirarchi level of my taxonomy?

For any push in the right dirction I would be very thankful!

best regards
Jürgen Brocke

Comments

Hi, I feel what you want. I

Summitnl's picture

Hi,
I feel what you want. I asked a somewhat same feature request: http://drupal.org/node/231911
after getting to know panels 2 better, it would be great to have the possibility to have different panels-"templates" related to depth, exactly as is now possible with different vocabularies, when you use as argument the taxonomy term.

greetings,
Martijn

wow, thanks. You're right.

humanoid's picture

wow, thanks. You're right. We have the same request.
But using different vocabularies will not play together with a hirarchical term navigation block, I guess. I build a navigation block with taxonomy context module which is really nice together with panels & views.

greetings

Jürgen Brocke

brocke.de integrale kommunikation

Jürgen Brocke

"The 'Killer-Apps' of tomorrow's mobile infocom industry won't be hardware devices or software programs but social practices."
(Howard Rheingold)

same request here ...

najibx's picture

I am still seeking a solution everywhere ...http://drupal.org/node/237033
Martijn at http://drupal.org/node/231911, is looking for the same. I now realize this is not easily be done eihh.
Not a direct functionality from panel2, but probably from templating ?

-najibx -
<a href="http://www.successideaweb.com>Drupal in Malaysia

-najibx -
<a href="http://www.successideaweb.com>Drupal web developer | designer in Malaysia

Hi, I did not found a

humanoid's picture

Hi,

I did not found a solution, but a "workaround" which is fine for me. I used Panels and taxonomy context module for an automatic navigation-block of hirarchical taxonomy. In my taxonmy/term-panel I use a pane displaying the term description, so I'm able to show content depending on each term. You can see a full example here: http://www.egotrek.de/wanderregionen/nordrhein-westfalen (click to subterm "eifel" which hase full example content).

Jürgen Brocke

brocke.de integrale kommunikation

Jürgen Brocke

"The 'Killer-Apps' of tomorrow's mobile infocom industry won't be hardware devices or software programs but social practices."
(Howard Rheingold)

Jurgen, Nice site! Could

Doktor.Science's picture

Jurgen,

Nice site! Could you explain a little more about how you built your site using Panels and the other modules you chose?

Hey there, of course I can

humanoid's picture

Hey there, of course I can give some more details:

I use a taxonomy with 3 levels:

Province
-Touristic-Area
--Hiking Area

To select taxonomy from anode, I use the module hierarchical_select.

I use Panels 2 and created one Panel which overrides taxonomy/term view. As context I use the Term-ID.
The Panel has 3 rows and a sidebar.
1st row contains the taxonomy term description of the actual term
2nd row contains a view of the highlighted (promote to frontpage) of the actual term (highlight-view)
3rd row contains a list of all nodes of the actual term (Node-list)

Views:
1) highlight-view is a list-view of the node-titles and Intro-text (which is a separated cck-field of the node) and VotingAPI percent vote result (FiveStar-Stars as Handler).
2) Node-list is a standard table view (taxonomy/term) of the node-titles and the filed VotingAPI percent vote result (FiveStar-Stars as Handler).

The term navigation block is provided by taxonomy_context module. I used this patch to show only terms which have nodes assigned to

The detail page of a hiking side contains various CCK-Fields for pasting source-code like the extern interactive map and also the downloads because they are tracked by a extern system
Modules I use to create the detail view of a hiking side:
CCK with CCK Fieldgroup Tabs to group content to tabs
FiveStar Rating

For product (maps and software) purchase by downloads, I use Ubercard shop with paypal-payment.
Node Reference to reference from an ubercard-article back to the node

If some people are interested, I can create a screen cast, showing the different settings.

Best regards
Jürgen

Jürgen Brocke

"The 'Killer-Apps' of tomorrow's mobile infocom industry won't be hardware devices or software programs but social practices."
(Howard Rheingold)

Thanks! A screencast would

Doktor.Science's picture

Thanks! A screencast would be great!

Hi, thanks for your

humanoid's picture

Hi, thanks for your feedback! I will create a Screencast within the next week.

Best regards
Jürgen

Jürgen Brocke

"The 'Killer-Apps' of tomorrow's mobile infocom industry won't be hardware devices or software programs but social practices."
(Howard Rheingold)

…this is exactly what I

tille's picture

…this is exactly what I was looking for - for quite a while: a taxonomy override! …and especially one for an hierarchical taxonomy tree. Hurray! Almost cant wait to see it…! :]
I actually even find it a bit strange, that there seems to be not so much interest in this topic from other drupalists - no tutorials, no how-to's - and I find it actually one of the most crucial little details… - …how could one actually even think of building another website without tree-taxonomy-override-panel…? …:]

Anyways: a screencast would be a blast!! …a few hints and tipps and details would probably also already be very very useful!

I actually tried to figure out how to do this myself - first I had some difficulties figuring out how/where/what to do, then I had the feeling that I could see some light at the end of the tunnel… - …but I am still not sure if that's the rising sun or a train coming y way…
I followed this tutorial "Panels 2: Create a node override" and tried to apply your hints…
http://drupal.org/node/206185
…well - anyways.

Now I am looking forward very much to finally get to understand panels2 a bit more - and finally have an option to override taxo-layouts…:]

…well - what can I say…? …I'm quite excited - but you probably guessed that already…:]

Just let me know it there's anything I could do to help - even promoting some egotrekkings would be perfectly fine for me…:]

greetings, till…

just a workaround

humanoid's picture

Hi till,

don't expect to much. I hav'nt found a solution for panels depends on the hierarchie of the taxonomy. I just used one panel which is the taxonomy override as it is described in the tutorial http://drupal.org/node/206185
But I'm also using taxonomy context module which supplies a nice hierarchical navigation.
I will show you more details soon...
BTW, does anybody know a good screecast software fpr windows? I use Jing some time but it is limited to 5 minutes....

greetings
Jürgen

Jürgen Brocke

"The 'Killer-Apps' of tomorrow's mobile infocom industry won't be hardware devices or software programs but social practices."
(Howard Rheingold)

well - it works!

tille's picture

…after cooling down I had a closer look at all factors involved - and finally found what I did wrong: the view argument was still set to "taxonomy term" and not "taxonomy id" - so there was nothing actually wrong on the panels side - just the view didn't understand the info the panel was sending … - …great.

@Jürgen: thank you very very much! …without your beautiful hiking pages as an example that this really works I probably wouldn't even have tried this…!

greetz, t..

PS: …should somebody still write this 'taxonomy-panels-overwrite' down on a step-by-step basis for the panels tutorial page …(http://drupal.org/node/201915)…? …of course a screencast would still be probably the ultimate help for people trying this 'trick'…:]

Anyone up for a plug in?

Summitnl's picture

Hi,
Humanoid, it works, but I do not think you use different panels-pages on the different levels, right?
I have a somewhat same installation on www.trekking-world.com, but would love to be able to set a different panel-page for a different depth of taxonomy (would be awesome also to be able to set different panel-pages per vocabulary per depth..but may be to much to ask).

greetings,
martijn

Hi Martijn, yes you are

humanoid's picture

Hi Martijn,

yes you are right. I did it like you. There is no solution for using different panel pages depending on the term hierarchy I know so far.
best regards
Jürgen

Jürgen Brocke

"The 'Killer-Apps' of tomorrow's mobile infocom industry won't be hardware devices or software programs but social practices."
(Howard Rheingold)

questions arising..

tille's picture

hello again,

the past days/weeks I worked with this this 'taxonomy-panels-overwrite' - and i am very happy with it. I currently use it for my tour dates database where I basically would want to use different hierarchical vocavularies - currently I only use one 3-level-taxonomy, one 2-level-taxo and one 1-level-tax...

this is the page:
http://www.livetourdates.org/

  • "gig location" is a 3-level-taxonomy
  • "festivals" is a 2-level-taxonomy
  • "artists" is a 1-level-taxonomy

Now that everything is fine new demands arise - and I think/hope they might be interesting for others too.. First I found out, that parallel to the 1-level-panel I can use a view to list some "archive":

1) "/artists/name" is the panels-page for a specific artist
...generated from the url "taxonomy/term/tid" -> panel overwrite..
...example: http://www.livetourdates.org/artists/Madonna

2) "/artists/name/past-gigs" is a view for the same artist listing his/her past gigs..
...generated from a view with url "$arg/past-gigs" -> argument is term id
...example: http://www.livetourdates.org/artists/Madonna/past-gigs

..works phantastic..

The 'problem' this ONLY seems to work for 1-level-taxonomies. I tried to achieve the same effect with the other taxos/panels but could not get one 'archive' page working.. I also tried to use the same overwrite with a second panel using the url "taxonomy/term/%/past-gigs" - which in my opinion would be the 'cleanest' way to do such things - but that also does not work.

example:
this is what I would want:
"/country/city/venue/past-gigs"

Now my question: does anybody here know a way to generate such 'sub-views' or 'sub-panels' for an existing panel..? ..I think the example above is already quite a 'typical' one - and I could easily think of dozends if not hundrets of other uses where it would make sense to 'expand' a panel with such 'sub-views' or 'sub-panels'..

well - lookind forward for any thoughts and/or pointers..:]

greetz, tille..

PS: the archive-view actually currently also 'affects' the 3-level-txo - but only like this:

"/country/past-gigs"
"/city/past-gigs"
"/venue/past-gigs"

here's the links to the 'real' example pages:

http://www.livetourdates.org/Norway/past-gigs
http://www.livetourdates.org/Trondheim/past-gigs
http://www.livetourdates.org/Marinen/past-gigs

and instead I would love to see this:
http://www.livetourdates.org/Norway/Trondheim/Marinen/past-gigs

...hmmm...

updated 07.09.2008
just for those wondering why at the above address there actually now is a working 'archive page' - I now actually can use the desired path for that purpose
http://www.livetourdates.org/Norway/Trondheim/Marinen/past-gigs
but it's a rather dirty workaround: I 'simply' add a new page for the venue (in this case "Marinen") and for the archive listing I then use a view-in-the-page-snippet.. this does actually give me the desired archive page, but only if I manually add a new page for every venue that resides in the database. currently there is almost 1000 venues - so that road probably won't get me there - but for now it works..:]

stuck again

tille's picture

Well - here we go again..

..until now the dirty workaround I mentioned above worked fine - but now I wanted to take the whole thing to a higher level and - voilà - got stuck: I 'only' wanted to compile a list of all City-Pages. The problem: even though I only want to display the City's name drupal still seems to preload everything before displaying anything - which in my case means that for every City the whole list of past-gigs is loaded - which completely freezes my server (90sec loading time). In the end I do see a rather short list of City names - but that is hardly worth the waiting time..

Originally I was still dreaming of compiling additional dynamic lists of Cities and Venues - but now it seems that I either have to give up this idea, or at least rethink the whole concept of doing everything with nicely structured URLs.. or so..

..well - of course I would be delighted about any pointers/tipps/suggestions whatsoever..:]

greetings, till..

Hi Humanoid, Great you are

Summit's picture

Hi Humanoid,

Great you are working with this. Still think you are building a work-around.

I still think it would be absolutely great to have a Panels depth context possibility.
As explained by Earl on:
http://drupal.org/node/231911#comment-762498 and
http://drupal.org/node/231911#comment-763215
he thinks it is not very hard to do, but until know I am not successfull in this.
May be we can join efforts and ask a pro-drupal to contruct it if possible?

Although great Sam says it is to early for it on:
http://drupal.org/node/231911#comment-920499 and
http://drupal.org/node/231911#comment-922211

But I would very much like to have this depth option as context, so you can build different panels-page templates on different taxonomy depth level, that would be awesome! Right?
I am wanting this so long already.. see thread starting date..

greetings,
Martijn

Yes Martijn, you are right.

humanoid's picture

Yes Martijn, you are right. My solution is only a work around. I'm following the dissussions about that Panels depth context possibility but it seems to me more difficult so I don't expect a solution within short time. I'm also to busy at the very moment to really get into that.
But I will be back soon with some more details because I have to develop some more views with my solution and I will get more expierence with that till end of the month.

Jürgen Brocke

brocke.de integrale kommunikation

Jürgen Brocke

"The 'Killer-Apps' of tomorrow's mobile infocom industry won't be hardware devices or software programs but social practices."
(Howard Rheingold)

great topic

robertgarrigos's picture

I'm looking for something similar, so I'm just subscribing for now.


Robert Garrigós
Professional site: garrigos.cat


Robert Garrigós
Professional site: garrigos.cat

Hi Guys,May be this snippet

Summitnl's picture

Hi Guys,

May be this snippet is usefull.
What I would like is to have this snippet changed, so on different term-depth different "templates" are possible, as in the snippet the "tag" template should be possible.
Source snippet: http://drupal.org/node/72601

<?php
function custom_url_rewrite($type, $path, $original) {
 
$newpath = $path;

 
// This path was already aliased, skip rewriting it
 
if ($path != $original) {
    return
$path;
  }

// Restore from custom url:
 
elseif ($type == 'source') {
    if (
substr($path, 0, strlen("tag/")) == "tag/") {
     
$termid = substr(strrchr($path, "."), 1);
     
$newpath = "taxonomy/term/".$termid;
    }
  }

// Rewrite to custom url:
 
elseif ($type == 'alias') {
    if (
substr($path, 0, strlen("taxonomy/term/")) == "taxonomy/term/") {
     
$termid = substr($path, strlen("taxonomy/term/"));
     
$termname = taxonomy_get_term($termid);
     
$newpath = "tag/".$termname->name.".".$termid."/";
    }
  }

// Nothing to do:
 
return $newpath;
}
?>

2 things need to be done:
1- first the url's needs to be escaped to prevent dangerous attacks. I am not enough programmer to exactly know what is meant with this?
2- the depth of terms logic to have different templates on different term-depths need to be added.
Off course this is still a work-around, while having term-depth as context like nodeID would be absolutely asume!

EDIT: I got it working with taxonomy_menu and a small altered version of above snippet with the answers of both questions found on drupal.org and thanks to Thomas Narres
Will post my findings if I have the time again.

How are you proceeding Humanoid, may be your version is better..?

greetings,
Martijn

Greetings,
Martijn

droople's picture

http://drupal.org/node/347281

After a few days searching D.O an groups, with failure to get a solution, I present my support request.

Here is my scenario.

--------------NODE TYPES----------------

I have nodes "hotel", "college" , "gym" which can be attched to a vocabulary Location

--------------VIEWS----------------

I have three views Hotels, Colleges, Gyms which show a pagenated table view of respective node types.

--------------TAXONOMY----------------

Location is Vocabulary VID 1, with hierarchy of the sort:

Country (england | Wales | Scotland | Ireland )
--County ( Oxfordshire | West Sussex )
---City/Town (London | Cardiff | Edinburgh )

--------------PANELS----------------

I would like to set up a panel page for each country, with different embedded views of nodes attached to each country

a panel page for each county with views of nodes attached to this taxonomy

another panel page for cities, with nodes attached to this city taxonomy

--------------THE REQUIRED FUNCTIONALITY----------------

So as an example: We could have England TID 1, West Sussex TID 200, Brighton TID 300

Visiting mysite/england will show 3 three views named above with nodes attached to tax ID 1

while mysite/england/westsussex will show the 3 views named above with nodes attched to TID 200

and mysite/england/westsussex/brighton will will show 3 views named above with nodes relevant to TID 300

--------------MY SUPPORT REQUEST----------------

With the current Panels 2, how would one achieve this?
What arguements or contexts should one use?
Is there any documentation for this?

--------------WHY NOT USE VIEWS TO CREATE EACH VIEW----------------

Building each and every view for each and every city can be very tedious (although can be done), using the UK example above, one would need to create more than 2500 views for each country, county and city/town. I am sure this is exhaustive on the DB.

Thank you

update

najibx's picture

wow ... i'm back here and till now still no concrete solutions.

-najibx -
<a href="http://www.successideaweb.com>Drupal web developer | designer in Malaysia

Url alias for view

sathiya's picture

If for eg:taxonomy/term/%/attractions gave as page path in view with tid as arguments(there will be lot of term id) .How shall i set the url alias for

                taxonomy/term/%/attractions---->taxonomy/term/1/attractions----->the required O/p is chennai/attractions.
                taxonomy/term/%/attractions---->taxonomy/term/2/attractions----->bangalore/attractions...................


                taxonomy/term/%/attractions---->taxonomy/term/n/attractions----->n/attractions.

Is there any way to do?

Anybody come up with a

chrism2671's picture

Anybody come up with a solution to this?

Seems like the easiest way to do this would be not use panels at all, but instead just use views.

I would suggest using this method for overriding the taxonomy pages with views:
http://mustardseedmedia.com/podcast/episode31

and use a very simple 'switch' statement in php to look at the taxonomy term level and decide what layout to serve. Should be very, very easy.

One problem with complicated panels is that sometimes they break. This is good because it avoids them, and is very lightweight compared to panels. It is also good because it is probably easier.

@chrism2671: Thanks for the link.

sbefort's picture

Much easier than using panels.

Module: Taxonomy Redirect

liberatr's picture

Back in the day while working on FieldandStream.com we had a similar problem, using Panels 2 - we ended up hacking the Taxonomy context. However, at the time, we were unsure about what we were allowed to release back to open source. I would not have the same reservations today, but I don't work for Bonnier any longer, and I don't have that source code.

We also extensively used the Taxonomy Redirect module - this actually overrides all links to taxonomy/term/% pages, and gives you a PHP hook to be able to insert complex switching. Similar the Mustard Seed video referenced above, but you can re-map them to any existing path, not just panels or views.
http://drupal.org/project/taxonomy_redirect

This is one of those edge cases, but something that could be useful. I see there are some efforts to get this code into Panels 3 above. I'm glad it came back around.

Panels

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: