Přeskočit přímo na text


<span> v menu po milionte

Kategorie: Jak na to?
Týká se verze:

Ani v jednom topicu jsem se nedozvedel presnou odpoved tak se ptam jeste jednou:

jak dostanu span DOVNITR odkazu v menu?

phptemplate_menu_links a vsechny podobny funkce ten odkaz zabali do spanu a ja to potrebuju naopak, tak jako je to tady.

 

No stale je to o theme

No stale je to o theme funkciach – funkcia theme_links() a v nej funkcia l() ktora generuje odkaz. Tato funkcia ma parameter ktory jej povie ze v texte odkazu sa nachadza html – cize napriklad <span>Odkaz</span>.

jaj,

to jsem pochopil, ale kam v te funkci l() to mam dat?

Funkcia

Funkcia s paramatrami:

l($text, $path, $attributes = array(), $query = NULL, $fragment = NULL, $absolute = FALSE, $html = FALSE);

Konkretne v theme_links() je:

if (isset($link['href'])) {
  $output .= l($link['title'], $link['href'], $link['attributes'], $link['query'], $link['fragment'], FALSE, $html);
}

Treba to upravit na:

if (isset($link['href'])) {
  $output .= l('<span>'.$link['title'].'</span>', $link['href'], $link['attributes'], $link['query'], $link['fragment'], FALSE, TRUE);
}

diky!!!

a jeste doplnim kompletni funkci kdyby to nekdo zase hledal at se s tim nemusi rvat(chybela tam implementace do menu_links)

function JMENOTEMATU_menu_links($links) {
  if (!count($links)) {
    return '';
  }
  $level_tmp = explode('-', key($links));
  $level = $level_tmp[0];
  $output = "<ul class=\"links-$level\">\n";
  foreach ($links as $index => $link) {
    $output .= '<li';
    if (stristr($index, 'active')) {
      $output .= ' class="active"';
    }

  if (isset($link['href'])) {
  $output .= '>' . l('<span>'.$link['title'].'</span>', $link['href'], $link['attributes'], $link['query'], $link['fragment'], FALSE, TRUE) . "</li>\n";
}

  }
  $output .= '</ul>';

  return $output;
}

(dat do template.php)

mirne jsem upravil

mirne jsem upravil (JMENOTEMATU) a „pridat do template.php“, aby to nesvadelo, ze lidi budou editovat primo phptemplate engine

toto je jen

pro primary links a secondary links, potreboval bych takto upravit jakekoliv menu ve forme bloku. zkusil jsem

function theme_menu_item_link($item, $link_item) {
return l($item[‚title‘], $link_item[‚path‘], !empty($item[‚description‘]) ? array(‚title‘ ⇒ $item[‚description‘]) : array(), isset($item[‚query‘]) ? $item[‚query‘] : NULL); }

zmenit na

function theme_menu_item_link($item, $link_item) {
return l(‚< span >‘.$item[‚title‘].‚</ span >‘, $link_item[‚path‘], !empty($item[‚description‘]) ? array(‚title‘ ⇒ $item[‚description‘]) : array(), isset($item[‚query‘]) ? $item[‚query‘] : NULL); }

ale to mi na vystupu vylezlo & lt;span& gt;O FIRMĚ& lt;/span& gt;

OT: cim udelam aby se to naformatovalo jako ty prispevky nahore?

Skus si na api.drupal.org

Skus si na api.drupal.org pozriet parametry funkcie l(). Myslim ze jeden z poslednych je ci ma brat text linku ako html alebo ako text (a tym padom zrusit html znacky).

Nakoniec pozeram a ved tuto kusok vyssie som to pisal aj s konkretnym prikladom: http://www.drupal.cz/…-po-milionte#…

Já to vyřešila takto (zen

Já to vyřešila takto (zen theme): http://www.drupal.cz/…ovanych-menu

Poslat nový komentář

Obsah tohoto pole je soukromý a nebude veřejně zobrazen.
  • You can use Texy! to format and alter entered content.
  • Povolené HTML značky: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <p> <br> <b> <i> <h2> <img> <pre> <sup> <sub> <pre class="php"> <span class="php-keyword1"> <span class="php-var"> <span class="php-num"> <img class="screenshot"> <p class="beginner"> <a class="greybox"> <h3> <h4>

Více informací o možnostech formátování

Type the characters you see in this picture. (verify using audio)
Type the characters you see in the picture above; if you can't read them, submit the form and a new image will be generated. Not case sensitive.

Hledat

Přihlášení

Bezpečnost Drupalu

Z hlediska bezpečnosti je Drupal na velmi vysoké úrovni, díky propracovanému systému hlášení, prověřování a řešení možných problémů.

Čtěte více a odebírejte bezpečnostní aktuality

Poslední komentáře

Kdo je online

Momentálně je online 1 uživatel a 0 hostů.

Online uživatelé