Print výsledek z "Skype Status" do user-profile.tpl.php
Marně zkoušim zobrazit výsledek modulu Skype Status v user-profile.tpl.php
Pomocí print_r dostanu
… [#type] ⇒ user_profile_item [#printed] ⇒ 1 ) [#required] ⇒ [#tree] ⇒ [#attributes] ⇒ Array ( ) [#parents] ⇒ Array ( ) [#description] ⇒ [#type] ⇒ user_profile_category [profile_skype] ⇒ Array ( [#required] ⇒ [#tree] ⇒ [#parents] ⇒ Array ( ) [#description] ⇒ [#attributes] ⇒ Array ( [class] ⇒ profile-profile_skype ) [#title] ⇒ Skype [#value] ⇒ [#weight] ⇒ 0 [#type] ⇒ user_profile_item [#printed] ⇒ 1 ) [#title] ⇒ Profil [#children] =>…
Dostal sem radu, že nejlepší bude bude podívat se do zdrojáku, jak to modul dělá v hook_user, op=view ale dvakrát moudrej z toho nejsem, hook_user sem v kodu nenašel. Už s tim nechci wojthu otravovat po IRC, proto píšu sem.
Odpovím možná trochu mimo,
Odpovím možná trochu mimo, ale já jsem modul Skype Status zvažovala (a nepoužila, protože nepoužívám modul Profile, což je podmínkou)… a vypisuju skype status jako ikonku v šabloně (v tomto případě v šabloně pole view) takto:
views-view-field–field-profile-skype-value.tpl.php:
V tomto případě $output pole ve view je skype adresa zadaná jako plain text – pole v typu obsahu „profile“.
kod funguje, ani nepotřebuju
kod funguje, ani nepotřebuju modul skype status
<?php if($account->profile_skype) print ‚‘; else print '
'; ?> děkuju za pomoc. Ale stejně by mě zajímalo jak to pole z modulu vytisknoutco zkusit: <?php print
co zkusit: <?php print $account->content[$category][$skype_field][‚#value‘] ?> ?
modul nainstalovany nemam, koukam do cvs
ale je fakt, ze modul na
ale je fakt, ze modul na takovou vec bych asi vubec nepouzival :)
Nakonec pomohl tenhle kod
Nakonec pomohl tenhle kod (plus ten modul): <?php
if ($account->profile_skype) { print ' ‚.$output.‘ '; } ?>$skype_field = variable_get(‚skype_status_profile_field‘, '');
foreach ($account->content as $cat ⇒ $field) {
foreach ($field as $key ⇒ $val) {
if ($key == $skype_field) $category = $cat;
}
}
if (!empty($account->$skype_field) && $account->uid !== 0) {
$buttonstyle = variable_get(‚skype_status_buttonstyle‘, ‚bigclassic‘);
$status = skype_status_getstatus(rawurlencode($account->$skype_field));
$output = theme(‚skype_status‘, $account->$skype_field, $buttonstyle, $status);
$account->content[$category][$skype_field][‚#value‘] = $output;
if (variable_get(‚skype_status_show_title‘, 1) === 0) unset($account->content[$category][$skype_field][‚#title‘]);
}
huh, to mi prijde jako az
huh, to mi prijde jako az prilis nemas v $skype_field nahodou key? aby ses obesel bez tech foreach? a imo, tohle vsechno se musi generovat uz driv, asi to budu muset nainstalovat :)
nevim co znamená key a
nevim co znamená key a foreach, ani imo O:-)
Poslat nový komentář