From 4e7edbbd6219273e940c770407e0f4cae9093347 Mon Sep 17 00:00:00 2001 From: tony2001 Date: Wed, 14 Apr 2004 15:29:09 +0000 Subject: [PATCH] multiple WS & syntax fixes --- docs/ru/appendixes/bugs.xml | 12 +- docs/ru/appendixes/resources.xml | 19 +- docs/ru/appendixes/tips.xml | 320 +++++++++++++------------ docs/ru/appendixes/troubleshooting.xml | 96 ++++---- 4 files changed, 226 insertions(+), 221 deletions(-) diff --git a/docs/ru/appendixes/bugs.xml b/docs/ru/appendixes/bugs.xml index 44127673..31c56c8b 100644 --- a/docs/ru/appendixes/bugs.xml +++ b/docs/ru/appendixes/bugs.xml @@ -1,11 +1,11 @@ - + - BUGS - - Check the BUGS file that comes with the latest distribution of Smarty, or - check the website. - + Ошибки + + Смотрите файл BUGS, который поставляется вместе с + стандартной поставко Smarty или ищите список на сайте. + - Источники - - Домашняя страница Smarty: Источники + + Домашняя страница Smarty: &url.smarty; - Для подписки на новости, надо послать письмо на - &ml.general.sub;. - Архив подписки доступен на - &url.ml.archive;. - + Для подписки на новости, надо послать письмо на + &ml.general.sub;. + Архив подписки доступен на + &url.ml.archive;. + + diff --git a/docs/ru/appendixes/tips.xml b/docs/ru/appendixes/tips.xml index fb18735d..3e6181c0 100644 --- a/docs/ru/appendixes/tips.xml +++ b/docs/ru/appendixes/tips.xml @@ -1,26 +1,24 @@ - + - Уловки - - - - Обработка пустых переменных - - Иногда, например, для того чтобы фон таблицы работал корректно, - необходимо вывести вместо пустого значения переменной, значение - по умолчанию "&nbsp;". Многие бы использовали конструкцию {if}, - но есть более короткий путь в Smatry используя default - модификатор переменной. - + Советы + + Обработка пустых переменных + + Иногда, например, для того чтобы фон таблицы работал корректно, + необходимо вывести вместо пустого значения переменной, значение + по умолчанию "&nbsp;". Многие бы использовали конструкцию {if}, + но есть более короткий путь в Smatry используя default + модификатор переменной. + -Вывод &nbsp; когда переменная пуста +Вывод &nbsp;, если переменная пуста - + +{$title|default:" "} +]]> + - - - - Обработка переменных по умлочанию - - Если переменная встречается часто, то использование модификатора - default каждый раз можно избежать, используя функцию - assign. - + + + Обработка переменных по умлочанию + + Если переменная встречается часто, то использование модификатора + default каждый раз можно избежать, используя функцию + assign. + Назначение переменной шаблона значения по умолчанию + +{$title} +]]> + - - - Присвоение переменной заголовка (title) заголовку шаблона. - - Rогда большинство ваших шаблонов имеют похожие верхние части - и нижние, то имеет смысл вынести их в отдельные файлы. Но если - шапка должна иметь различные заголовки на различных страницах? - Вы можете передать заголовок в шапку, когда она присоединяеться. - + + + Присвоение переменной заголовка (title) заголовку шаблона. + + Если большинство ваших шаблонов имеют похожие верхние и нижние + части, то имеет смысл вынести их в отдельные файлы. Но если + шапка должна иметь различные заголовки на различных страницах? + Смотрите пример ниже. + Присвоение переменной заголовка (title) заголовку шаблона. - + + + {$title|default:"BC News"} + + footer.tpl ---------- -</BODY> -</HTML> + + +]]> + - - Если выводится главная страница, то заголовок будет "Main Page", - если архивы, то заголовк берется из файла конфигурации. Если - заголовок будет пустой, то выведеться значение по умолчанию "BC News". - - - - Даты - - Обычно даты в Smarty всегда передаются как timestamps, что - позволяет проектировщикам шаблона использовать + Если выводится главная страница, то заголовок будет "Main Page", + если архивы, то заголовк берется из файла конфигурации. Если + заголовок будет пустой, то выведется значение по умолчанию "BC News". + + + +Даты + + Обычно даты в Smarty всегда передаются как временные метки, что + позволяет проектировщикам шаблонов использовать date_format - для полного над форматированием даты, и также делает легким - сравнение дат если необходимо. - - - ЗАМЕЧАНИЕ: От Smarty 1.4.0 вы можете передавать даты как unix - timestamps, mysql timestamps, или любые другие даты, которые - обработаются strtotime(). - + для полного контроля над форматированием даты и также делает легким + сравнение дат там, где это необходимо. + + + ЗАМЕЧАНИЕ: Начиная с версии Smarty 1.4.0 вы можете передавать дату в виде + временной метки Unix (Unix timestamp), временной метки MySQL или в любом + другом виде, который подерживается функцией PHP strtotime(). + -использование date_format + Использование date_format - - Когда {html_select_date} используется в шаблоне, программисты обычно - хотят получить дату виде timestamp. Фот функция, которая поможет это - сделать. - + + Когда {html_select_date} используется в шаблоне, программистам может + понадобиться получить дату виде временной метки. Вот функция, которая поможет это + сделать. + -Преобразование элементов формы ввода даты назад к timestamp +Преобразование элементов формы ввода даты назад к временной метке + + } +]]> + - - - WAP/WML - - WAP/WML шаблоны требуют, чтобы PHP content-type заголовки были - переданы вместе с шаблоном. Простейший путь - написать - пользовательскую функцию, которая будет выводить заголовки. - Так как мы будем пользоваться тэгами insert то заголовки не будут - кэшироваться. Так же ничего не должно выводиться в браузер до - шаблона, иначе заголовки могут быть неправильно восприняты. - + + + WAP/WML + + WAP/WML шаблоны требуют, чтобы заголовок Content-type был + передан вместе с шаблоном. Простейший путь - написать + пользовательскую функцию, которая будет выводить заголовки. + Так как мы будем пользоваться тэгами insert, то заголовки не будут + кэшироваться. Так же ничего не должно выводиться в браузер до + шаблона, иначе заголовки могут быть неправильно восприняты. + -Bспользование insert для записи WML Content-Type заголовков + Использование insert для записи WML Content-Type заголовков -// Apache должен быть сконфигурирован с .wml расширением! + + -<!-- begin new wml deck --> -<wml> -<!-- begin first card --> -<card> -<do type="accept"> -<go href="#two"/> -</do> -<p> + + + + + + + +

Welcome to WAP with Smarty! Press OK to continue... -</p> -</card> -<!-- begin second card --> -<card id="two"> -<p> +

+
+ + +

Pretty easy isn't it? -</p> -</card> -</wml> +

+
+
+]]> +
-
- - Составные шаблоны - - This tip is a bit of a hack, but still a neat idea. Use at your own - risk. ;-) - - - Traditionally, programming templates into your applications goes as - follows: First, you accumulate your variables within your PHP - application, (maybe with database queries.) Then, you instantiate your - Smarty object, assign the variables and display the template. So lets - say for example we have a stock ticker on our template. We would - collect the stock data in our application, then assign these variables - in the template and display it. Now wouldn't it be nice if you could - add this stock ticker to any application by merely including the - template, and not worry about fetching the data up front? - - - You can embed PHP into your templates with the {php}{/php} tags. - With this, you can setup self contained templates with their own - data structures for assigning their own variables. With the logic - embedded like this, you can keep the template & logic together. This - way no matter where the template source is coming from, it is always - together as one component. - + + + Составные шаблоны + + This tip is a bit of a hack, but still a neat idea. Use at your own + risk. ;-) + + + Traditionally, programming templates into your applications goes as + follows: First, you accumulate your variables within your PHP + application, (maybe with database queries.) Then, you instantiate your + Smarty object, assign the variables and display the template. So lets + say for example we have a stock ticker on our template. We would + collect the stock data in our application, then assign these variables + in the template and display it. Now wouldn't it be nice if you could + add this stock ticker to any application by merely including the + template, and not worry about fetching the data up front? + + + You can embed PHP into your templates with the {php}{/php} tags. + With this, you can setup self contained templates with their own + data structures for assigning their own variables. With the logic + embedded like this, you can keep the template & logic together. This + way no matter where the template source is coming from, it is always + together as one component. + componentized template @@ -263,13 +272,13 @@ Pretty easy isn't it? Stock Name: {$ticker_name} Stock Price: {$ticker_price} ]]> - - As of Smarty 1.5.0, there is even a cleaner way. You can include php in - your templates with the {include_php ...} tag. This way you can keep - your PHP logic separated from the template logic. See the include_php function for - more information. - + + As of Smarty 1.5.0, there is even a cleaner way. You can include php in + your templates with the {include_php ...} tag. This way you can keep + your PHP logic separated from the template logic. See the include_php function for + more information. + componentized template with include_php @@ -303,36 +312,36 @@ index.tpl Stock Name: {$ticker_name} Stock Price: {$ticker_price} ]]> - - - Obfuscating E-mail Addresses - - Do you ever wonder how your E-mail address gets on so many spam mailing - lists? One way spammers collect E-mail addresses is from web pages. To - help combat this problem, you can make your E-mail address show up in - scrambled javascript in the HTML source, yet it it will look and work - correctly in the browser. This is done with the mailto plugin. - + + + Obfuscating E-mail Addresses + + Do you ever wonder how your E-mail address gets on so many spam mailing + lists? One way spammers collect E-mail addresses is from web pages. To + help combat this problem, you can make your E-mail address show up in + scrambled javascript in the HTML source, yet it it will look and work + correctly in the browser. This is done with the mailto plugin. + Example of Obfuscating an E-mail Address - + - - Technical Note - - This method isn't 100% foolproof. A spammer could conceivably program his - e-mail collector to decode these values, but not likely. - - - + + Technical Note + + This method isn't 100% foolproof. A spammer could conceivably program his + e-mail collector to decode these values, but not likely. + + +
+ diff --git a/docs/ru/appendixes/troubleshooting.xml b/docs/ru/appendixes/troubleshooting.xml index 22b09657..0bf0185e 100644 --- a/docs/ru/appendixes/troubleshooting.xml +++ b/docs/ru/appendixes/troubleshooting.xml @@ -1,59 +1,53 @@ - + - Troubleshooting - - - Smarty/PHP errors - - Smarty может распознать много ошибок типа отсутствующих признаков признака - Или уродливые переменные названия(имена). Если это случается, Вы будете видеть ошибку - Подобный следующему: - - Smarty can catch many errors such as missing tag attributes - or malformed variable names. If this happens, you will see an error - similar to the following: - - - -Smarty errors - + Troubleshooting + + Smarty/PHP errors + + Smarty can catch many errors such as missing tag attributes + or malformed variable names. If this happens, you will see an error + similar to the following: + + + Smarty errors + Warning: Smarty: [in index.tpl line 4]: syntax error: unknown tag - '%blah' - in /path/to/smarty/Smarty.class.php on line 1041 +in /path/to/smarty/Smarty.class.php on line 1041 Fatal error: Smarty: [in index.tpl line 28]: syntax error: missing section name - in /path/to/smarty/Smarty.class.php on line 1041 - - - - Smarty shows you the template name, the line number and the error. - After that, the error consists of the actual line number in the Smarty - class that the error occured. - - - - There are certain errors that Smarty cannot catch, such as missing - close tags. These types of errors usually end up in PHP compile-time - parsing errors. - - - -PHP parsing errors - -Parse error: parse error in /path/to/smarty/templates_c/index.tpl.php on line 75 - - - - When you encounter a PHP parsing error, the error line number will - correspond to the compiled PHP script, not the template itself. Usually - you can look at the template and spot the syntax error. Here are some - common things to look for: missing close tags for {if}{/if} or - {section}{/section}, or syntax of logic within an {if} tag. If you - can't find the error, you might have to open the compiled PHP file and - go to the line number to figure out where the corresponding error is in - the template. - - +in /path/to/smarty/Smarty.class.php on line 1041 + + + + Smarty shows you the template name, the line number and the error. + After that, the error consists of the actual line number in the Smarty + class that the error occured. + + + + There are certain errors that Smarty cannot catch, such as missing + close tags. These types of errors usually end up in PHP compile-time + parsing errors. + + + PHP parsing errors + +Parse error: parse error in /path/to/smarty/templates_c/index.tpl.php on line 75 + + + + + When you encounter a PHP parsing error, the error line number will + correspond to the compiled PHP script, not the template itself. Usually + you can look at the template and spot the syntax error. Here are some + common things to look for: missing close tags for {if}{/if} or + {section}{/section}, or syntax of logic within an {if} tag. If you + can't find the error, you might have to open the compiled PHP file and + go to the line number to figure out where the corresponding error is in + the template. + +