Jump to content

Recommended Posts

Hi Guys,

New to php! I have a title attribute applied to a textarea but in the below code the title attribute just displays the first word of the associated sentence, if $translation is "The cat is on the mat" the title attribute on mouseover of the textarea only shows "The". Weird eh? Any ideas what the fix would be. Same in IE, Chrome and FF. How could I tweak this ".$translation." (highlighted in red in code below off to the right) in the context of the below code? It aint my code by the way :) By the way ".$translation." highlighted in green does show the full sentence eg "The cat is on the mat"

I need the title attribute as a tooltip on a big matrix of textareas.

Thanks

 

		foreach ($translation_matrix[$this->ext->settings['base_language']] as $phrase_key => $translation)
	{
		$class = ($i % 2) ? "tableCellOne" : "tableCellTwo";
		$r .= "<tr>";
		$r .= "<td class='".$class." phrase-key'>".$phrase_key."</td>";
		$r .= "<td class='".$class."'>[color=green]".$translation."[/color]</td>";
foreach ($matched_langs as $lang_key => $language)
		{

			$r .="<td class='".$class."'> ".$language."<textarea class='textarea' name='translations[".$lang_key."][".$phrase_key."]' title=[color=red]".$translation."[/color]>".((isset($translation_matrix[$lang_key][$phrase_key]) === TRUE) ? $translation_matrix[$lang_key][$phrase_key] : "")."</textarea></td>";
		}
		$r .= "</tr>\n";
		$i++;
	}
	$r .= "</tbody></table><input type='submit' value='".$LANG->line("submit")."' />";

	$r .= "</form>";

	$this->_render_layout('index', $r);
}

In view source $translation in the table cell shows the full sentence yet in the title attribute it shows just the first word.

If the sentence is:

"A house is big" the title attribute will only render "A" on the screen and in the source- Space between words breaks it but if &translation is called in a table cell you see the full sentence.

One last question please

 

$r .="<td class='".$class."'> ".$language."<textarea class='textarea

 

how do i apply a line break \n (i think) so that the output from $language is above the textbox

 

I need e.g the word "English" on top of the textbox and not on the left of it in the table cell (Only an issue in IE7)

 

correct:

English

[textbox]

 

incorrect:

English[textbox]

 

...just unsure of the \n syntax.

<br /> or <br> didn't work for me.

Thanks

<br> *should* work for that, but you may be better off setting it as a caption, and using CSS to position it.

 

You really don't need all that string concatenation, BTW. All it does is add confusion and lead to typos, IMO.

 

$r .="<td class=\"$class\">$language<textarea class=\"textarea\">, etc.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.