ChapmIndustries
ChapmIndustries

Reputation: 1531

Where does Magento get its HTML from?

I've been messing around in Magento because a client uses it but for the life of me I can not understand how Magento is loading pages. Every page is a PHP script that pulls some magical files out of the air and displays them. I've ordered a book on how this works but it wont be here for a while.

What I want to know for now is where the actual HTML that Magento is loading is kept. There must be a folder that holds chunks of HTML that Magento sticks together, yes?

Upvotes: 0

Views: 1380

Answers (2)

Andrey Tserkus
Andrey Tserkus

Reputation: 3634

There are 3 main sources (ordered by significance):

  • Templates - app/design/<area>/<package>/<theme>/template/.... This is the most general source of HTML
  • Blocks - app/code/<pool>/<Namespace>/<Module>/Block/.... Some of them return direct html or contain rules on composing and wrapping templates, other blocks.
  • Library classes - lib. They can contain HTML, which is used by Magento.

Occasionally, HTML can be present in another locations as well (e.g. several models or controllers) - but it is a rare/exceptional practice.

Upvotes: 3

Alana Storm
Alana Storm

Reputation: 166046

Magento's templates are located in the app/design/frontend folder — anything with a phtml ending is template that contains mixed PHP and HTML. There's many templates used to render a Magento page. You can get an idea of the templates involved by look at the Block tab of the Commerce Bug demo site (self link, Commerce Bug is a Magento debugging extension I created and sell, but the demo site is free) — although chances are your client's system is using a custom theme which will have it's templates in different locations.

Upvotes: 0

Related Questions