Jump to content

Archived

This topic is now archived and is closed to further replies.

ze_newbie

Is it PHP : {if $related_categories}

Recommended Posts

Hello everybody,
It's my first post and I just started learning PHP.
So excuse me for these newbie questions.

I open a template (with .tpl extension) and I found these snippets.

[code]
{$header}
{$lang.categories}
{/if}
{if $related_categories}
[/code]

My 1st question is :
I think it is not PHP, please can you tell me what does it mean ?

In the template I found also this :

[code]
<meta name="keywords" content="{$keywords}" />
<br />
[/code]

My 2nd question is : why is it for example [code]<br /> and not <br>[/code] ?

Thanks in advance.

Share this post


Link to post
Share on other sites
You are correct, this is not php. There are many template systems built with php and this appears to be one of them. Usually these template files are parsed by a template engine and the {$variables} you see are replace by something in a database.

Share this post


Link to post
Share on other sites
There are literally thousands of template engines written in php. Most are pretty simular though some are more complex. What is it you want a tutorial on? Creating the .tpl files? Or actually building a template engine?

The later would [b]not[/b] be a good place for a newbie to start learning php.

Share this post


Link to post
Share on other sites
Both please.
Don't worry I learn quickly and I had many years of assembly programming. Assembly was like my mother tongue.
I stopped coding for years but the "mechanic" still nice.  ;D

Share this post


Link to post
Share on other sites
still, you should start by learning the traditional hello world, rather than an entire script, where basic syntax and rule knowledge are assumed.

[code=php:0]
<?php
  echo "hello world";
?>
[/code]

for instance.

Share this post


Link to post
Share on other sites
I already started with basics. I am not pretentious but for the "basics" I just need few days (quelques nuits blanches).
If am able to write an emulator I think that a template engine will not fear me.
Thanks for your help but a
[code]<?php
  echo "hello world";
?>[/code]
I already know that.
Excuse for disturbing.

Share this post


Link to post
Share on other sites
[url=http://www.google.com.au/search?q=php+template+engine+tutorial&start=0&start=0&ie=utf-8&oe=utf-8&client=firefox&rls=org.mozilla:en-US:unofficial]Google[/url] racked up quite a few results on the subject, Ive not read any tutorials myself.

Share this post


Link to post
Share on other sites
okay well good luck on learning to build a template engine then. maybe i misunderstood you. you seem to ask how to do it, but you ask basic syntax questions, like the {blah} and why something has [code]<br/>[/code] and not [code]<br>[/code] (which btw isn't even php it's plain old html).  Maybe you can be more specific, or else maybe thorpe's linkie is what you are looking for?

Share this post


Link to post
Share on other sites

×

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.