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 8461197
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T13:48:49+00:00 2026-06-10T13:48:49+00:00

With Magento design files, there seems a very strong preference to using the alternative

  • 0

With Magento design files, there seems a very strong preference to using the alternative php syntax (example below). What are the technical advantages? or what is the technical appeal if it is only a style preference?

<div class="page-title title-buttons">
    <h1><?php echo $this->__('Shopping Cart') ?></h1>
    <?php if(!$this->hasError()): ?>
    <ul class="checkout-types">
    <?php foreach ($this->getMethods('top_methods') as $method): ?>
        <?php if ($methodHtml = $this->getMethodHtml($method)): ?>
        <li><?php echo $methodHtml; ?></li>
        <?php endif; ?>
    <?php endforeach; ?>
    </ul>
    <?php endif; ?>
</div>
  • 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-06-10T13:48:51+00:00Added an answer on June 10, 2026 at 1:48 pm

    There is no “advantage” or “disadvantage”. It comes down to preference and maintainability.

    REMEMBER => You should really be SEPARATING PHP and HTML syntax. Keep your PHP and your HTML in separate files – this is for maintainability and lots of other reasons (theres lots of info out there if you search). There is no way you can completely separate the two things… you’re always going to need to insert PHP variables into HTML and stuff, but this should be kept to a minimum.

    Therefore I prefer to use that alternative syntax in template files in WordPress, Codeigniter and other things because the way I see it you’re inserting PHP into HTML in template files, so lets keep those PHP blocks insular.

    i.e. to me:

    <?php
    
    if(something){
        // this is a block of PHP
        // if you want to output html in here 
        // it seems right to do
        echo "<div>Here is some HTML</div>";
    }
    
    ?>
    

    and vice versa:

    <div>
        <!-- this is a template file and is written in html -->
        Hello <?=$username?> <!-- inserting PHP into HTML -->
        <?php if(something): ?> <!-- keep it insular - in its own separate blocks, don't mix the two -->
            <button>A button</button>
        <?php endif; ?>
    </div>
    

    Again, there is no “technical advantage” its just cleaner and better (IMO). This is mixing PHP and HTML too much:

    <div><!-- straight html -->
    
        <?php
            if(something){
                echo "<button>A Button</button>"; <!-- html output via php -->
            }
        ?>
    
    </div>
    

    And this is just plain terrible:

    <div>
    
        <?php
            if(something){
                ?>
                    <button>A Button</button>
                    <!-- make your mind up! -->
                <?php
            }
        ?>
    
    </div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm setting up a Magento site and have some design requirements that we can't
Magento 1.4.1.1 Back in history, app/code/core/Mage/GoogleAnalytics/Block/Ga.php was copied over to app/code/local/Mage/GoogleAnalytics/Block/Ga.php and changes were
Magento 1.7.0.0 ok i'm using the product tabs that are available in the modern
I just discovered on my site using magento 1.3.2.2 that on a bundled product,
Magento is a newish (past 5 years) PHP based Ecommerce system with an architecture
I'm trying to modyfiy magento's product page layout ( app/design/frontend/default/*template*/template/catalog/product/view.phtml ) but i'm not
I'm using Magento 1.6. I've created my own theme (mytheme) under base. So my
I’ve gotten fairly familiar with Magento’s design structure and now taking my hand out
Are all the tables in Magento follow EAV Design ? Where can I find
I am trying to port a site design from OSCommerce to Magento and I

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.