|
|
|
|
|
для: Тень&
(08.02.2010 в 17:48)
| | Спасибо! Сделал так:
<?php
//..
$Array = Array
(
"stylesheet", "icon", "charset", "language", "description",
"keywords", "script", "title", "text_body", "text_body_bottom",
"text_body_left", "text_body_right", "text_body_top", "text_body_sub",
"text_body_sub_bottom", "text_body_sub_left", "text_body_sub_right",
"text_body_sub_top", "text_menu", "text_menu_bottom", "text_menu_left",
"text_menu_right", "text_menu_top", "text_menu_sub", "text_menu_sub_bottom",
"text_menu_sub_left", "text_menu_sub_right", "text_menu_sub_top", "jpg",
"jpg_static", "jpg_static_bottom", "jpg_static_left", "jpg_static_right",
"jpg_static_top", "jpg_dynamic", "jpg_dynamic_bottom", "jpg_dynamic_left",
"jpg_dynamic_right", "jpg_dynamic_top"
);
foreach($Array as $A)
{
$htm = str_replace("<!--".$A."-->", $$A, $htm);
}
//..
?>
|
[поправлено модератором] | |
|
|
|
|
|
|
|
для: freeing
(08.02.2010 в 17:45)
| | [поправлено модератором] | |
|
|
|
|
|
|
|
для: Тень&
(08.02.2010 в 17:41)
| | [поправлено модератором] | |
|
|
|
|
|
|
|
для: freeing
(08.02.2010 в 17:35)
| | > возможно ли упростить такой кусок кода?
Да | |
|
|
|
|
|
|
| возможно ли упростить такой кусок кода?
<?php
//..
if(!empty($htm) && is_string($htm))
{
$htm = str_replace("<!--stylesheet-->", $stylesheet, $htm);
$htm = str_replace("<!--icon-->", $icon, $htm);
$htm = str_replace("<!--charset-->", $charset, $htm);
$htm = str_replace("<!--language-->", $language, $htm);
$htm = str_replace("<!--description-->", $description, $htm);
$htm = str_replace("<!--keywords-->", $keywords, $htm);
$htm = str_replace("<!--script-->", $script, $htm);
$htm = str_replace("<!--title-->", $title, $htm);
$htm = str_replace("<!--text_body-->", $text_body, $htm);
$htm = str_replace("<!--text_body_bottom-->", $text_body_bottom, $htm);
$htm = str_replace("<!--text_body_left-->", $text_body_left, $htm);
$htm = str_replace("<!--text_body_right-->", $text_body_right, $htm);
$htm = str_replace("<!--text_body_top-->", $text_body_top, $htm);
$htm = str_replace("<!--text_body_sub-->", $text_body_sub, $htm);
$htm = str_replace("<!--text_body_sub_bottom-->", $text_body_sub_bottom, $htm);
$htm = str_replace("<!--text_body_sub_left-->", $text_body_sub_left, $htm);
$htm = str_replace("<!--text_body_sub_right-->", $text_body_sub_right, $htm);
$htm = str_replace("<!--text_body_sub_top-->", $text_body_sub_top, $htm);
$htm = str_replace("<!--text_menu-->", $text_menu, $htm);
$htm = str_replace("<!--text_menu_bottom-->", $text_menu_bottom, $htm);
$htm = str_replace("<!--text_menu_left-->", $text_menu_left, $htm);
$htm = str_replace("<!--text_menu_right-->", $text_menu_right, $htm);
$htm = str_replace("<!--text_menu_top-->", $text_menu_top, $htm);
$htm = str_replace("<!--text_menu_sub-->", $text_menu_sub, $htm);
$htm = str_replace("<!--text_menu_sub_bottom-->", $text_menu_sub_bottom, $htm);
$htm = str_replace("<!--text_menu_sub_left-->", $text_menu_sub_left, $htm);
$htm = str_replace("<!--text_menu_sub_right-->", $text_menu_sub_right, $htm);
$htm = str_replace("<!--text_menu_sub_top-->", $text_menu_sub_top, $htm);
$htm = str_replace("<!--jpg-->", $jpg, $htm);
$htm = str_replace("<!--jpg_static-->", $jpg_static, $htm);
$htm = str_replace("<!--jpg_static_bottom-->", $jpg_static_bottom, $htm);
$htm = str_replace("<!--jpg_static_left-->", $jpg_static_left, $htm);
$htm = str_replace("<!--jpg_static_right-->", $jpg_static_right, $htm);
$htm = str_replace("<!--jpg_static_top-->", $jpg_static_top, $htm);
$htm = str_replace("<!--jpg_dynamic-->", $jpg_dynamic, $htm);
$htm = str_replace("<!--jpg_dynamic_bottom-->", $jpg_dynamic_bottom, $htm);
$htm = str_replace("<!--jpg_dynamic_left-->", $jpg_dynamic_left, $htm);
$htm = str_replace("<!--jpg_dynamic_right-->", $jpg_dynamic_right, $htm);
$htm = str_replace("<!--jpg_dynamic_top-->", $jpg_dynamic_top, $htm);
}
//..
?>
|
| |
|
|
| |
|