Aktív menüpont beállítása views által létrehozott oldalakon

  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • The spam filter installed on this site is currently unavailable. Per site policy, we are unable to accept new submissions until that problem is resolved. Please try resubmitting the form in a couple of minutes.
Kategória: 
Snippet

Mai néhány órás kínszenvedésem jegyzete, avagy miként állítsunk be aktív menüpontot olyan page típusú nézethez, amit nem fűztünk fel aktív menüútvonalra. Normál esetben ugye, ha csinálunk egy nézetet nezet1 útvonalra, egy másikat nezet1/nezet2 útvonalra, az active-trail szépen végigszalad az útvonalakon.

De mi van akkor, ha argumentumot használunk, netán olyan menüelem kell aktívnak, aminek semmi köze az adott útvonalhoz?

Az én esetemben konkrétan ez volt: Van egy og csoport, aminek vannak fórumtémái. Ezeknek a listáját kellett megjelentetni a csoport node oldalán fülön. Ebben nincsen semmi bonyolult, a page-nek kell node/%/forum útvonal, validálni az argumentumot, 'asztcsókolom.

Naja, de hogy lesz ebből aktív a csoportok útvonalon elhelyezkedő Csoportok főmenüpont az elsődleges linkek között?

Van egy modul, a menutrails, ami hasonlót csinál, ám ott csak tartalomtípusokra lehet ezeket ráhúzni. Elvileg contex-tel is meg lehet csinálni, viszont a menutrails mellett custom_breadcrumbs modul is elég dúvad módon túrja azokat a hookat, amikkel ezeket lehet babrálni, szóval nálam ez sem működött.

Végül szétkaptam a menutrails, és összeszedtem, hogy hogyan is lesz. Annyi a lényeg, hogy kell egy hook, amiben ezt meg tudjuk csinálni. Az én esetemben a hook_views_pre_render(&$view) volt a nyerő, hiszen nézethez kell kapcsolni a duhajkodásunkat.

  1. Kell egy $item = menu_get_item().
  2. Az $item tömbön kell a href értéket módosítani, vagyis $item['href'] = 'menüelem útvonala, amit aktívnak akarsz látni'.
  3. A végén ennyi kell: menu_set_item(NULL, $item);

És voila.

Nézzük az én kódomat, nekem az kellett, hogyha a node/%/tökmindegymi útvonalon vagyunk, akkor bizonyos tartalomtípusok esetében bizonyos menüelem legyen aktív:

[geshifilter-drupal6]/** * Implements hook_views_pre_render(). */ function custom_hooks_views_pre_render(&$view) { if (strstr($view->current_display, 'page')) { if (arg(0) == 'node' && is_numeric(arg(1)) && arg(2)) { $item = menu_get_item(); //itt biza be kell tölteni a node ojjektumot, mert az az ilyen oldalakon nincsen. $node = node_load(arg(1)); switch ($node->type) { case 'group' : $item['href'] = 'csoportok'; menu_set_item(NULL, $item); } } } }[/geshifilter-drupal6]

Edit: Mivel közben nem csak view oldalon kellett használnom a trükköt, megtaláltam a pörfikthúkot, ami nem más, mint a hook_init, ez ugyanis minden oldalgeneráláskor lefut. Ebben nyugodtan lehet játszadozni.

Hozzászólások

Truly helpful....look forward

Truly helpful....look forward to coming back.

Keep up the outstanding work

Keep up the outstanding work !! Lovin' it!

How goes it, very good

How goes it, very good internet site you have got right now.

Greetings, nice web-site you

Greetings, nice web-site you have at this time there.

Incredibly user pleasant

Incredibly user pleasant site. Immense information offered on few clicks.

Wow because this is excellent

Wow because this is excellent job! Congrats and keep it up.

Many thanks extremely

Many thanks extremely valuable. Will share site with my friends.

Incredible such a valuable

Incredible such a valuable web page.

Thanks pertaining to

Thanks pertaining to delivering these kinds of good details.

say thanks to a lot for your

say thanks to a lot for your internet site it aids a whole lot.

Unbelievably individual

Unbelievably individual friendly website. Immense information offered on few clicks on.

48guq5 maglie del calcio

48guq5 maglie del calcio s2uja5l t6qulcvi1o billiga fotbollströjor 3v9grsq6 dvlm8oh1i5 billige fodboldtrøjer a0w85pg794 qhrjn158bl fotballdrakter fh7e9a

Much thanks! It is an

Much thanks! It is an astounding web page!

I like this site - its so

I like this site - its so usefull and helpfull.

Very interesting look

Very interesting look frontward to returning.

fotbollströjor barn

fotbollströjor fodboldtrøjer

meijiyuan. mireene. ysiaq.

passionforchrome. steerhome.

Rather informative....look

Rather informative....look onward to returning.

Wow, beautiful site. Thnx ...

Wow, beautiful site. Thnx ...

promolistic. zfssolution.

Very revealing....look forth

Very revealing....look forth to coming back again.

webhostingworld. mohaaaa.

borsalino-verbier.

Hello, i think that i saw you

Hello, i think that i saw you visited my site so i came to “return the favor”.I'm attempting to find things to enhance
my website!I suppose its ok to use some of your ideas!!

I like it whenever people get

I like it whenever people get together and share opinions.

Great blog, continue the good work!

I needed to thank you for

I needed to thank you for this good read!!
I definitely enjoyed every little bit of it. I have got you book-marked
to look at new stuff you post…

This blog was... how do you

This blog was... how do you say it? Relevant!! Finally I've found something that helped me.
Cheers!

Greetings, I do think your

Greetings, I do think your blog may be having browser compatibility issues.
Whenever I look at your web site in Safari, it looks fine however, if
opening in I.E., it has some overlapping issues.
I just wanted to provide you with a quick heads up!
Aside from that, wonderful blog!

You've made some decent

You've made some decent points there. I looked on the internet to find out more about the issue and found most people will go along
with your views on this site.

Hi everybody, here every

Hi everybody, here every person is sharing these familiarity, therefore it's
good to read this blog, and I used to visit this webpage every day.

I've been surfing online more

I've been surfing online more than 3 hours lately, yet
I never found any interesting article like yours.
It is pretty value enough for me. In my opinion, if all webmasters and bloggers made good content as you did, the
internet will likely be a lot more helpful than ever before.

Hozzászólás

A mező tartalma nem nyilvános.
  • Internal paths in double quotes, written as "internal:node/99", for example, are replaced with the appropriate absolute URL or relative path.
  • Engedélyezett HTML elemek: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <del> <img>
  • A webcímek és email címek automatikusan linkekké alakulnak.
  • A sorokat és bekezdéseket a rendszer automatikusan felismeri.
  • Engedélyezett HTML elemek: <a> <blockquote> <br> <cite> <code> <dd> <del> <div> <dl> <dt> <em> <li> <ol> <p> <span> <strong> <ul>
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <bash>, <c>, <cpp>, <drupal5>, <drupal6>, <java>, <javascript>, <mysql>, <php>, <python>, <ruby>, <sql>. The supported tag styles are: <foo>, [foo].
  • Minden email cím át lesz alakítva ember által olvasható módon, vagy (ha a JavaScript engedélyezett) ki lesz cserélve kattintható, de biztonságos hivatkozásra.