hi this is mike you've been talking with another
griffin jungle trickle julia time as promised this time around we're going to
be covering
uh... tranquil template language
uh... so that we can now start manipulate the output of the data that
would be in store in in our database
so uh... just to recap on our last previous lesson were clean
very lightly on temperate language
basically set up these
two pages where
week list olavarria
particles
in the database
and then we made a link so that you could soon be impeached one individually
and you can see that up
since then arts one put some more lower blips in the net to stew
to sit
and uh...
fruitful something else that i'm gonna show you shortly
well with
this weird
then now gonna make a slate little change to our project because
a project used to keep all the templates in the mean project folder
so we used to cool
inside of this templates folder gap
for a long time please
hasn't been doing in previous uh... tutorials we've been modular runner
molecule in arising
a lot article
and this time mcgann mochila rise
the templates also so we're going to bring in
the templates into the out folder
rather than keeping at it inside the park project for here organist bring it
in it
so that the templates inside at this op
pols told separately from everything else
so that they can be kept
ananda next single package that we can drive in and drop
in any of the you know any of that particular fancy in the future
include not templates as well as our cold
very very happy
we've moved our article
and articles html templates that we created in our previous example
as one of the thing we need to do
we need to tell jangled thought we've also included a new folder into the into
the project
where we're going to keep these templates
and the way we do that is recorded last seconds dot p y
if you go to the section that says template underscored
d_r_i_ diaz
we've got
our initial set in
which we had
and then we're gonna add this extra sentenced yet
which just basically is the extra pot the extra path
to the extra for that we're going to use
once that's the case
restart your server
then jungle will be quite happy to search in both of those fall doesn't
look for templates
and the reason why we're gonna have set two separate full isn't gonna
demonstrate something later on
called template inheritance
which allows you to have
basic set of templates for your
you'll whole project
which can be applied
smaller templates which apply specifically to absolute using within
the project
that might not make sense right now but i'm gonna demonstrated you'd be c
that's actually really cool thing to do
and say gee a lot of weight
so without with we've set of sentence
and we don't need to do any more changes in the freeway
or going to do is charged in outlook thought templates
so uh... articles templates this is the wall not sure yet so the one that just
lists articles
is exactly the same as it was previously where we have
afford
sian for article in articles soul for every article in this articles ary
a list
uh... do the following outputs in html
was an article might be
in this
reference
uh... and then the title
inside of the
and then
some of the body text
and then
use in the same format the clearly bruce and the percentage saying
on this sent two signed and clearly race
we use and four just to see that this is
holds section of the
the fall of corpus
within that's
we've got a variable name
and remember when we were mohan sittin variable names
little use these
particular racist because that the signify something in terms of logical
something more complex
use these
which is just to clear the princes
and another
near the site to signify that
that this is the end of the declaration of way we want this variable to be
dropping
so variables to clearly bruce's anything else that's in terms of logic like if
statements off for loops
that's with calibration percent x
right now
what would get in
is the title with a tape at the link
and then a lot of text underneath 'cause where also output in the body
say we want to be more brief and we wanted to have and
a much smaller simply display bless pasted to deal with
there's a way that we can bend uh... alter the way that's
the sperry polls albeit help put into the html
the so-called fooled us
uh... filled a
and can do many things that are lots of photos and he fired by citicorp and do
acquitted google sition on dawned jungle villas if you want to know the whole
fullest
but a court or two or three beaten useful one for interest in one's own
initial you know
and just demonstrate the point along with this
and they all
the loa filter truncate waits for life
and i'm quite sure either opa photo-op as well
just uh... what about the structure
if you want to apply for that
use the pike
and then to fill the name
if you want to have another felt on top of that it's another party
and then if opening
if your fellow has uh...
arguments to send to the following
it will need to send a cool
sorry focal
how many of the arguments that he should send to that folder
so in the case of those was in the plane this fella
lula
which in turn everything lower case
and then apply this photo op drum kit with its
which will shorten the sentences
kitten that's
there are ten
words in their it will go
once i get past ten words of a stop printing any of the text of the becomes
of it is very ble
and put three
periods on the end
without her plight
those fellows shit then
shorten this
text
so let's have a group
very cool
that's sp made it and i summarized vision
and obviously view on the click you get the full story afterwards
which is a common thing that you do in web sites
so thats
the basics the felons
legacy if u wanna know love about different ones
you all what's available
go ahead and google it that uh...
you can annex list of them
and you can can you pick and choose which ones you think they're more prove
yourself
but there's a an example of couple celeste
just a quickie
uh... cool unused pappa instead
lol
three guesses what open does
victims everything duplicates
tected handy
and c_d_-eight hotly in court and cause
and much in the if you had to do that
by self
potentially be copeland's echoed whereas it just gotten one wit with a party
so it's really cute
what's next
how about the if statement so how do we
how do we texted things are true
and whether they should be displayed all weather
there should be some so for action
june during our template
way that we do that's is
to use the the clearly bruce's on percent
the india for anything with logic
so we call curly braces
if
and then we do our text
so in the case of our test unseen
if articles dot current
so
the amount of items dot in the current
and and the articles list
a greater than zero
due to the following
and then i'm gonna
i've been extra bit to the end
it says
else
if that's not true
if there is if account
greater than zero
put unknown to show
message out
and then finally on it
and docked
with the and if
that's basically
the way that you would declaring if statement
and of course of a did it right now
it still shows all three
if we just slightly
read it dot
if the count less than zero
to the following it's not seen on shore
well no it's not going to be true so that shit said shimon control
because
our if statement
text
has resulted in pimples
to set that back to normal
what's next
next we're going to
taking this
that we've been building
we're gonna apply in or parole designed to it
on our web designer
so i'm not going to show you nice pretty design unconditionally is it
is a template dot created
inside about jungle
project
templates folder not inside the article templates for the actual
project templates folder
i've called it
based on a city mouth
the reason why
got lucky is because this will be
basis
re part of the site and how will the llc
so what's in there
uh... we've got
in there
uh... standard altman tax bill
well-managed tml
of course
something
about the title
go a little bit of styling
just to make it's not like of just to make it more obviously wrong which
sections electric
in in our body
of incident
a few
distant obstruction of the page
but they're not sad at these new things here
like i said
curly braces in the present each means something more complex
than just a very funny
so block
tells the template language
that this section of the page
convenient
site all
and then
everything in between here
and be substantiated
templates
as long as they refer to cite
all as a book
within
and for the damp
we've got a book
called content
and block that because you haven't got any content in their scl
let's just
something in their this is the complaint
there
nap if we can just look at the st louis in a browser
what you've got
as you go to sidebar
with articles and admin in it
and then you've caught content area
content area
this is the content area
this is the basis
for the holding out
we've defined these blocks
so that the template language can then
replace
dot content
by any over templates
thought shuster orville wright these areas
so for instance uh... c
in the 'cause this content area if this was the front page we might just have an
image in the welcome message
hind in one of our templates we would use them
would be use the peace template
but then overwrite the contents block
and see
incision image
in the cases of all ur
articles
we're going to overwrite the contents block
office pipe ph
part of the page here
and insist these
into the content block
this area here
gets overwritten
bible that templates
dot can inherit
this template
uh... so eveything template inheritance
uh... style we of smaller templates taking advantage already existing
functionality i've written in different and in previews
more complex templates
how does not look when he talks people uses
without we patel all the tango template and system
that we want to use that basic tml
you know articles html
as we go
this page
on the very first line of this template binding visit it has to be on the first
lane when you're dealing with this one specific amount
we see
this template extends
the peace it's tml template
how does it extended
extends this block
extends this block content
listen
disc content block is extended
to use what's incited al content block
in this template
so we've inherited all of the layout and c_s_x_ in everything that we put in our
bases tml
just by sian
this expense that
and uh... this block here overrides the original content block
let's just take a look at what happens when you do that
it takes the original
surrounded template
pendants it's everything in sight of that
because that's the one that's the block we chose to overwrite
sort of what about all
articles
applied to their so let's go back to
articles
template
we're going to do exactly the same thing with an a c
extends
the html
hands
we're gonna read to clear the block
uh... andover right
pedicle extends
content
another block we coach
overwrite
is if we just couldn't pissed at
is we could stick in between there
all block
will recreate it into the template
but this time
we don't need the admin
overridden both books
the sidebar block
and the content block fog article
so that's going to see what happens when do that
so it puts off text
for all content area inside of the content
part of our system of our template
and then
we override are left im menu offsite ball
with twenty one link instead of two
and nuts
all drawn from one
basic template
that was set up
couple of pages
i mean as you can see the p_t_a_ stopped obviously we've written all of this text
for the basic template
for the other ones we have not to rewrite anything which is basically
importers old so-to-speak
all or i did it
and told us that
you know the rest of the stuff that comes inside yet is what should be
inserted
and that's what we mean by template corrections
this template from articles
inherits everything from this
and then we can extend its own
that's the basics
or template language
if you enjoyed this video and it was instructional flee and please click the
link button
if you'd like to know more then uh...
subscribe to this channel and look at notifications have attended some new
uh...
new tutorial out of it
thanks for watching