Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3756554
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T09:52:11+00:00 2026-05-19T09:52:11+00:00

I am deciding if to use some template engine in php code or no.

  • 0

I am deciding if to use some template engine in php code or no.
Now I take close look to Smarty.

To be honest, it is not clear for me its benefits.

My impressions are not very good from the very beginning.
I tried to go through the demo application: http://www.smarty.net/sampleapp1. And from the very beginning I obtained notices . I fixed this by passing values to forms.
I changes the code from

// adding a guestbook entry
$guestbook->displayForm();

to

// adding a guestbook entry
$guestbook->displayForm(array('Name' => '', 'Comment' => ''));

While guessing this I understand that it complicates debugging the code.
And this also makes me to learn one more language – it is easy, but most easy is not to learn something new at all if there is no needed.
Alternative is to use PHP itself.

Syntax comparison http://www.smarty.net/syntax_comparison is most funny for me: calculate number of symbols…. But I am familiar with PHP and this is easy for me to write on it, and Smarty is new for me. And I don’t think that for Web Designers are so difficult to learn some simple php constructs, and Smarty is so simpler in this respect. If I am wrong it would be good to hear web designer here.

Smarty parses the code and this is in fact time overhead.

But at the same time many people use it. And that is why I would like to understand the reasons for this?
Where are the benefits? Am I missing something?

If you know good alternative to Smarty, it would be good to know about.
Thanks!

UPDATE:

I have found also the question on subject: How to use Smarty better with PHP?. In general it is also about not to use Smarty. But this is 1.5 years old. Possibly something changed?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T09:52:11+00:00Added an answer on May 19, 2026 at 9:52 am

    I agree that it causes overhead, I worked in a project that used Smarty and it was a nightmare. The two benefits you can get are

    1: designers that are not familiar with PHP can work out with your HTML without coding skills required. But doesn’t that mean they will eventually need to study Smarty first? I really don’t see any point.

    2: For template separation: you can use PHP alternative syntax the same way you would use Smarty, without losing the power of that giant programming language. Example of alternative syntax:

    <div>Product list</div>
    <?php foreach($products as $product): ?>
    
    <div>Product: <?php echo $product->name; ?> </div>
    <div>Price: <?php echo $product->price; ?> </div>
    <?php if($product->discountPercentage): ?>
    <div>
    Discount: <?php echo $product->price * $product->discountPercentage / 100; ?> off! </div>
    <?php endif; ?>
    
    <?php endforeach; ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Name the design considerations in deciding between use of a singleton versus a static
What guidlines do you use when deciding whether to let a method dodge an
I wanted to know, while deciding which language or technology to use for implementing
I am deciding on a framework to try out for PHP. I have narrowed
I'm having problems deciding on what is the best way is to handle and
I'm having trouble deciding if I want a project of mine to be web-based
We are deciding the naming convention for tables, columns, procedures, etc. at our development
I'm stuck deciding how to handle exceptions in my application. Much if my issues
Are there any guidelines/best practices for deciding what type of data should be stored
i'm going to be responsible for deciding how tagging branching is going to happen

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.