Jump to content
  • 0

не могу понять принцип работы шаблонизаторов


sc@r@bey
 Share

Question

разъясните в чем принцип работы шаблонизатора,

пусть вот этот код будет

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//RU" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional-dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ru" lang="ru">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
<link rel=stylesheet type=text/css href="css/css.css">

<title><?php echo "TITLE"; ?>/title>
</head>
<body>
<div id="container">
<div id="header">
<?php echo "HEADER"; ?>
</div>
<div id="navigation">
<?php echo "NAVIGATION"; ?>
</div>

<div id="sidebar-right">
<?php echo "SIDEBAR A"; ?>
</div>

<div id="sidebar-left">
<?php echo "SIDEBAR B"; ?>
</div>
<div id="content"><div id="content-inner">
<?php echo "CONTENT"; ?>
</div></div>
<div id="footer">
<?php echo "FOOTER"; ?>
</div>
</div>
</body>

Edited by sc@r@bey
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Основной принцип шаблонизатора - разграничить логику и представление.

Есть простые типы шаблонизаторов, которые умеют только заменять некие идентификаторы на значение, а есть более продвинутые, которые умеют много всего, и по сути являются макроязыком (тот же смарти, мэйсон, и прочие)

Кому выгодны шаблонизаторы? Командам более чем из 1 человек. Шаблонизаторы позволяют распараллетить процесс работы над кодом. Еще один позитивный момент - шаблонизатор позволяет разделить зоны ответственности между кодером и программистом. Мало того, "общение" между программистом и кодером осуществляется на макроуровне, что позволяет сократить расходы на обучение программера HTML-ю, а кодера - серверным языкам программирования.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  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.

 Share

×
×
  • 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. See more about our Guidelines and Privacy Policy