Removes PHP references
This commit is contained in:
parent
7eba5fbc02
commit
55a2d5b577
|
@ -257,8 +257,7 @@ lookup and function calls.
|
||||||
Note ``{{ article.pub_date|date:"F j, Y" }}`` uses a Unix-style "pipe" (the "|"
|
Note ``{{ article.pub_date|date:"F j, Y" }}`` uses a Unix-style "pipe" (the "|"
|
||||||
character). This is called a template filter, and it's a way to filter the value
|
character). This is called a template filter, and it's a way to filter the value
|
||||||
of a variable. In this case, the date filter formats a Python datetime object in
|
of a variable. In this case, the date filter formats a Python datetime object in
|
||||||
the given format (as found in PHP's date function; yes, there is one good idea
|
the given format (as found in PHP's date function).
|
||||||
in PHP).
|
|
||||||
|
|
||||||
You can chain together as many filters as you'd like. You can write custom
|
You can chain together as many filters as you'd like. You can write custom
|
||||||
filters. You can write custom template tags, which run custom Python code behind
|
filters. You can write custom template tags, which run custom Python code behind
|
||||||
|
|
|
@ -81,12 +81,12 @@ work, see :doc:`Troubleshooting </faq/troubleshooting>`.
|
||||||
|
|
||||||
.. admonition:: Where should this code live?
|
.. admonition:: Where should this code live?
|
||||||
|
|
||||||
If your background is in PHP, you're probably used to putting code under the
|
If your background is in plain old PHP (with no use of modern frameworks),
|
||||||
Web server's document root (in a place such as ``/var/www``). With Django,
|
you're probably used to putting code under the Web server's document root
|
||||||
you don't do that. It's not a good idea to put any of this Python code
|
(in a place such as ``/var/www``). With Django, you don't do that. It's
|
||||||
within your Web server's document root, because it risks the possibility
|
not a good idea to put any of this Python code within your Web server's
|
||||||
that people may be able to view your code over the Web. That's not good for
|
document root, because it risks the possibility that people may be able
|
||||||
security.
|
to view your code over the Web. That's not good for security.
|
||||||
|
|
||||||
Put your code in some directory **outside** of the document root, such as
|
Put your code in some directory **outside** of the document root, such as
|
||||||
:file:`/home/mycode`.
|
:file:`/home/mycode`.
|
||||||
|
|
|
@ -235,11 +235,11 @@ be used to identify the matched pattern; and ``\d+`` is a regular expression to
|
||||||
match a sequence of digits (i.e., a number).
|
match a sequence of digits (i.e., a number).
|
||||||
|
|
||||||
Because the URL patterns are regular expressions, there really is no limit on
|
Because the URL patterns are regular expressions, there really is no limit on
|
||||||
what you can do with them. And there's no need to add URL cruft such as ``.php``
|
what you can do with them. And there's no need to add URL cruft such as
|
||||||
-- unless you have a sick sense of humor, in which case you can do something
|
``.html`` -- unless you want to, in which case you can do something like
|
||||||
like this::
|
this::
|
||||||
|
|
||||||
(r'^polls/latest\.php$', 'polls.views.index'),
|
(r'^polls/latest\.html$', 'polls.views.index'),
|
||||||
|
|
||||||
But, don't do that. It's silly.
|
But, don't do that. It's silly.
|
||||||
|
|
||||||
|
|
|
@ -203,9 +203,6 @@ We see a template system as a tool that controls presentation and
|
||||||
presentation-related logic -- and that's it. The template system shouldn't
|
presentation-related logic -- and that's it. The template system shouldn't
|
||||||
support functionality that goes beyond this basic goal.
|
support functionality that goes beyond this basic goal.
|
||||||
|
|
||||||
If we wanted to put everything in templates, we'd be using PHP. Been there,
|
|
||||||
done that, wised up.
|
|
||||||
|
|
||||||
Discourage redundancy
|
Discourage redundancy
|
||||||
---------------------
|
---------------------
|
||||||
|
|
||||||
|
|
|
@ -16,9 +16,9 @@ or CheetahTemplate_, you should feel right at home with Django's templates.
|
||||||
.. admonition:: Philosophy
|
.. admonition:: Philosophy
|
||||||
|
|
||||||
If you have a background in programming, or if you're used to languages
|
If you have a background in programming, or if you're used to languages
|
||||||
like PHP which mix programming code directly into HTML, you'll want to
|
which mix programming code directly into HTML, you'll want to bear in
|
||||||
bear in mind that the Django template system is not simply Python embedded
|
mind that the Django template system is not simply Python embedded into
|
||||||
into HTML. This is by design: the template system is meant to express
|
HTML. This is by design: the template system is meant to express
|
||||||
presentation, not program logic.
|
presentation, not program logic.
|
||||||
|
|
||||||
The Django template system provides tags which function similarly to some
|
The Django template system provides tags which function similarly to some
|
||||||
|
|
Loading…
Reference in New Issue