2008-06-19, 04:05 PM
2008-06-19, 06:40 PM
whene you create a new variable in the php files, let's say the variable name is $var
you will need to add it like that {$var} in the templates..
but you must be sure that the variable is in a function that runs the pre_output_page hook
you will need to add it like that {$var} in the templates..
but you must be sure that the variable is in a function that runs the pre_output_page hook
2008-06-19, 06:49 PM
U got the question wrong
I mean when editing the language from the admin panel how does it make very variable into textareas?
I mean when editing the language from the admin panel how does it make very variable into textareas?
2008-06-19, 07:07 PM
in admin/languages.php
$plugins->run_hooks("admin_languages_edit_edit");
// Start output
cpheader();
startform("languages.php", "edit", "do_edit");
// Check if file is writable, before allowing submission
if(!is_writable($editfile))
{
$lang->update_button = '';
makewarning($lang->note_cannot_write);
}
starttable();
if($editwithfile)
{
// Editing with another file
$lang->editing_file_in_set_with = sprintf($lang->editing_file_in_set_with, $file, $languages[$editlang], $languages[$editwith]);
tableheader($lang->editing_file_in_set_with, "", 1);
//tablesubheader(array($lang->variable, $languages[$editlang], $languages[$editwith]));
if(count($editvars) == 0)
{
makelabelcode("<div align=\"center\">".$lang->no_variables."</div>", "", 1);
}
else
{
// Make each editing row
foreach($editvars as $key => $value)
{
if(strtolower($langinfo['charset']) == "utf-8")
{
$withvars[$key] = preg_replace("#%u([0-9A-F]{1,4})#ie", "dec_to_utf8(hexdec('$1'));", $withvars[$key]);
$value = preg_replace("#%u([0-9A-F]{1,4})#ie", "dec_to_utf8(hexdec('$1'));", $value);
}
else
{
$withvars[$key] = preg_replace("#%u([0-9A-F]{1,4})#ie", "dec_to_utf8(hexdec('$1'));", $withvars[$key]);
$value = preg_replace("#%u([0-9A-F]{1,4})#ie", "'&#'.hexdec('$1').';'", $value);
}
tablesubheader($key, "", 1);
echo "<tr>\n";
echo "<td class=\"altbg1\"><strong>".$languages[$editwith]."</strong><br /><textarea style=\"width: 98%; padding: 4px;\" rows=\"2\" disabled=\"disabled\">".htmlspecialchars($withvars[$key])."</textarea></td>\n";
echo "</tr>";
echo "<tr>\n";
echo "<td class=\"altbg1\"><strong>".$languages[$editlang]."</strong><br /><textarea style=\"width: 98%; padding: 4px;\" rows=\"2\" name=\"edit[$key]\">".htmlspecialchars($value)."</textarea></td>\n";
echo "</tr>";
}
}
}
else
{
// Editing individually
$lang->editing_file_in_set = sprintf($lang->editing_file_in_set, $file, $languages[$editlang]);
tableheader($lang->editing_file_in_set, "", 1);
if(count($editvars) == 0)
{
makelabelcode("<div align=\"center\">".$lang->no_variables."</div>", "", 1);
}
else
{
// Make each editing row
foreach($editvars as $key => $value)
{
if(strtolower($langinfo['charset']) == "utf-8")
{
$value = preg_replace("#%u([0-9A-F]{1,4})#ie", "dec_to_utf8(hexdec('$1'));", $value);
}
else
{
$value = preg_replace("#%u([0-9A-F]{1,4})#ie", "'&#'.hexdec('$1').';'", $value);
}
tablesubheader($key, "", 1);
echo "<tr>\n";
echo "<td class=\"altbg1\"><textarea style=\"width: 98%; padding: 4px;\" rows=\"2\" name=\"edit[$key]\">".htmlspecialchars($value)."</textarea></td>\n";
echo "</tr>";
}
}
2008-06-19, 08:32 PM
I see.
Thank you!
Thank you!