Author Topic: $lang['votes'] in functions.php ausgeben.  (Read 13654 times)

0 Members and 1 Guest are viewing this topic.

Offline Sunny C.

  • Addicted member
  • ******
  • Posts: 1.806
  • I ♥ 4I
    • View Profile
$lang['votes'] in functions.php ausgeben.
« on: January 27, 2010, 07:13:40 PM »
Hallo zusammen,

wie kann ich aus der language Datei etwas in der functions.php ausgeben?

z.B "$lang['votes']" ?

mit ".$lang['votes']." klappt das nicht!? .
« Last Edit: February 06, 2010, 05:46:57 PM by Sumale.nin »

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: $lang['votes'] in functions.php ausgeben
« Reply #1 on: January 28, 2010, 02:17:50 AM »
you need
  global $lang;
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline Sunny C.

  • Addicted member
  • ******
  • Posts: 1.806
  • I ♥ 4I
    • View Profile
Re: $lang['votes'] in functions.php ausgeben
« Reply #2 on: January 28, 2010, 02:04:39 PM »
??  8O :?
Wo genau muss das gesetzt werden?

Rembrandt

  • Guest
Re: $lang['votes'] in functions.php ausgeben
« Reply #3 on: January 28, 2010, 02:33:13 PM »
??  8O :?
Wo genau muss das gesetzt werden?
naja in der function die du aufrufst:

z.b.

function wasweisich(blub,$blah){
 global 
$lang;
.
.
...
".$lang['votes']." ....;
}

Offline Sunny C.

  • Addicted member
  • ******
  • Posts: 1.806
  • I ♥ 4I
    • View Profile
Re: $lang['votes'] in functions.php ausgeben
« Reply #4 on: January 28, 2010, 07:40:32 PM »
Ahh super :D COOL! Danke!

Klappt soweit mit den Language Dateien bzw. Befehlen sehr gut:
function get_thumbnail_code($media_file_name$thumb_file_name ""$image_id$cat_id$image_name ""$mode ""$show_link 1$open_window 0) {
  global 
$site_template$lang$site_sess$config;

  if (!
check_media_type($media_file_name)) {
    
$thumb "<img src=\"".ICON_PATH."/404.gif\" border=\"0\" alt=\"\" />";
  }
  else {
    if (!
get_file_path($thumb_file_name"thumb"$cat_id00)) {
      
$file_src ICON_PATH."/".get_file_extension($media_file_name).".gif";
      
$image_info = @getimagesize($file_src);
      
$width_height = (!empty($image_info[3])) ? " ".$image_info[3] : "";
      
$thumb "<img src=\"".$file_src."\" border=\"0\"".$width_height." alt=\"".format_text($image_name2)."\" />";
    }
    else {
      
$file_src get_file_path($thumb_file_name"thumb"$cat_id01);
      
$image_info = @getimagesize($file_src);
      
$width_height = (!empty($image_info[3])) ? " ".$image_info[3] : "";
      
$thumb "<img src=\"".$file_src."\" border=\"".$config['image_border']."\" width=\"80\" height=\"80\" alt=\"".$lang['votes']." ".format_text($image_name2)."\" title=\"".$lang['alttitle_produkt_one']." -".format_text($image_name2)."- ".$lang['alttitle_produkt_two']." ".$image_row['image_rating']." ".$lang['votes']." ".$lang['alttitle_produkt_three']."\" />";
    }
  }

  if (
$show_link) {
    if (
$open_window) {
      
$thumb "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id.((!empty($mode)) ? "&amp;mode=".$mode ""))."\" onclick=\"opendetailwindow()\" target=\"detailwindow\">".$thumb."</a>";
    }
    else {
      
$thumb "<a class=\"group\" href=\"#produkt-".format_text($image_name2)."\">".$thumb."</a>";
	
  
    }
  }
  return 
$thumb;
}


Aber eines macht Probleme und zwar will ich im Title die aktuelle Bewertung ausgeben, aber das bekomme ich nicht hin!

Folgendes habe ich erweitert:
  global $site_template$lang$site_sess$config;

Und darum geht es:
      $thumb "<img src=\"".$file_src."\" border=\"".$config['image_border']."\" width=\"80\" height=\"80\" alt=\"".$lang['votes']." ".format_text($image_name2)."\" title=\"".$lang['alttitle_produkt_one']." -".format_text($image_name2)."- ".$lang['alttitle_produkt_two']." ".$image_row['image_rating']." ".$lang['votes']." ".$lang['alttitle_produkt_three']."\" />";

Und das klappt nicht:
".$image_row['image_rating']."

Kann mir da nochmal jemand auf die Sprünge helfen?


Edit://

cat_name würde ich auch gerne dort ausgeben können, aber wie geht das?
« Last Edit: February 06, 2010, 09:17:16 PM by Sumale.nin »

Offline Sunny C.

  • Addicted member
  • ******
  • Posts: 1.806
  • I ♥ 4I
    • View Profile
Re: $lang['votes'] in functions.php ausgeben.
« Reply #5 on: February 07, 2010, 10:27:55 AM »
Keine eine Idee?

Rembrandt

  • Guest
Re: $lang['votes'] in functions.php ausgeben.
« Reply #6 on: February 07, 2010, 11:56:29 AM »
du hast doch die anwort schon hier bekommen: http://www.4homepages.de/forum/index.php?topic=26721.msg144984#msg144984

global image_row;

Offline Sunny C.

  • Addicted member
  • ******
  • Posts: 1.806
  • I ♥ 4I
    • View Profile
Re: $lang['votes'] in functions.php ausgeben.
« Reply #7 on: February 07, 2010, 03:01:23 PM »
Aber das geht trotzdem nicht!
Und cat_name auch nicht! Es wird nichts angezeigt!

global $site_template$lang$image_row$site_sess$config;

Rembrandt

  • Guest
Re: $lang['votes'] in functions.php ausgeben.
« Reply #8 on: February 07, 2010, 05:40:40 PM »
funktioniert astrein, warum auch nicht.
du weist aber schon das du den "title" nur im quellcode siehst, oder?

Offline Sunny C.

  • Addicted member
  • ******
  • Posts: 1.806
  • I ♥ 4I
    • View Profile
Re: $lang['votes'] in functions.php ausgeben.
« Reply #9 on: February 07, 2010, 06:33:19 PM »
Generell wird der bei mir aber nagezeigt !? Die Language Dateien bzw. Befehle gibt er mir auch im Titel aus. Das ALT ist nur im Quelltext

Rembrandt

  • Guest
Re: $lang['votes'] in functions.php ausgeben.
« Reply #10 on: February 07, 2010, 07:20:19 PM »
wo willst du eigentlich das ganze angezeigt haben?
 title="blabla"  im <img> tag wird verwendet um tooltips  anzuzeigen.

Offline Sunny C.

  • Addicted member
  • ******
  • Posts: 1.806
  • I ♥ 4I
    • View Profile
Re: $lang['votes'] in functions.php ausgeben.
« Reply #11 on: February 08, 2010, 12:39:53 PM »
im TITLE vom IMG-TAG

Das hier funktioniert nicht:
function get_thumbnail_code($media_file_name$thumb_file_name ""$image_id$cat_id$image_name ""$mode ""$show_link 1$open_window 0) {
  global 
$site_template$lang$site_sess$image_row$config;

  if (!
check_media_type($media_file_name)) {
    
$thumb "<img src=\"".ICON_PATH."/404.gif\" border=\"0\" alt=\"\" />";
  }
  else {
    if (!
get_file_path($thumb_file_name"thumb"$cat_id00)) {
      
$file_src ICON_PATH."/".get_file_extension($media_file_name).".gif";
      
$image_info = @getimagesize($file_src);
      
$width_height = (!empty($image_info[3])) ? " ".$image_info[3] : "";
      
$thumb "<img src=\"".$file_src."\" border=\"0\"".$width_height." alt=\"".format_text($image_name2)."\" />";
    }
    else {
      
$file_src get_file_path($thumb_file_name"thumb"$cat_id01);
      
$image_info = @getimagesize($file_src);
      
$width_height = (!empty($image_info[3])) ? " ".$image_info[3] : "";
      
$thumb "<img src=\"".$file_src."\" border=\"".$config['image_border']."\" width=\"80\" height=\"80\" alt=\"".$lang['votes']." ".format_text($image_name2)."\" title=\"".format_text($cat_cache[$subcat_id]['cat_name'], 2)."\" />";
    }
  }

  if (
$show_link) {
    if (
$open_window) {
      
$thumb "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id.((!empty($mode)) ? "&amp;mode=".$mode ""))."\" onclick=\"opendetailwindow()\" target=\"detailwindow\">".$thumb."</a>";
    }
    else {
      
$thumb "<a class=\"group\" href=\"#produkt-".format_text($image_name2)."\">".$thumb."</a>";
	
  
    }
  }
  return 
$thumb;
}



So klappt es nicht:
".format_text($cat_cache[$subcat_id]['cat_name'], 2)."
So auch nicht:
".$cat_name."
So ebenfalls nicht:
".format_text($cat_name, 2)."

Rembrandt

  • Guest
Re: $lang['votes'] in functions.php ausgeben.
« Reply #12 on: February 08, 2010, 06:56:48 PM »
 :?: ich habe dir das geschrieben:
....
global image_row;

und jetzt postet du, das das hier nicht funktioniert:
...So klappt es nicht:
".format_text($cat_cache[$subcat_id]['cat_name'], 2)."
So auch nicht:
".$cat_name."
So ebenfalls nicht:
".format_text($cat_name, 2)."

wenn du diese variable schon registrierst, dann solltest du sie auch so verwenden.

Code: [Select]
title=\"".$image_row['cat_name']."\"oder:
Code: [Select]
title=\"".$image_row['cat_id']."\"oder:
Code: [Select]
title=\"".$image_row['image_name']."\"
u.s.w.

auf meiner demoseite habe ich mal testhalber den cat_namen im title tag eingefügt, wenn du mit der maus über die thumbnails fährst siehst du den cat namen.

zur erklärung:  der alt tag ist dazu da, als ersatz wenn ein bild nicht angezeigt werden kann.
der title tag ist dazu gedacht, um eine barrierefreie webseite zu gestalten etwa wenn blinde eine nachriten seite lesen damit sie wissen das da ein bild ist z.b.:

ein auto <img ...... title= "grünes Auto">  für gegen diesen LKW <img .... title="großer roter LKW">

es gibt software die die webseite im quellcode denjenigen vorlesen, durch den title tag weis die software das da ein bild mit einem grünen auto und ein großer roter LKW ist.
« Last Edit: February 08, 2010, 07:09:54 PM by Rembrandt »

Offline Sunny C.

  • Addicted member
  • ******
  • Posts: 1.806
  • I ♥ 4I
    • View Profile
Re: $lang['votes'] in functions.php ausgeben.
« Reply #13 on: February 22, 2010, 01:47:16 PM »
Ruhig Blut großer.
Was ein alt und ein title Tag ist weis ich und ich habe von Anfang an von einem Title-Tag gesprochen gehabt.
Dennoch Danke für die wunderbare Hilfe!