Did you know FaceySpacey is the creator of Redux-First Router and Universal?

The Startup Incubator.
Your one stop social media shop
Resource Categories:

Technical
Non-Technical
Refer A Friend
Popular Articles
DEVELOPMENT TOOLS 1 - VERSION CONTROL (Mercurial)
CONTRACTING 2 - TOP 10 EASY SITE CREATOR TOOLS
Subscribe
Yii 3 - VIEWS
Views are your HTML templates that are delivered to your browser, filled with dynamic content generated by PHP. Let’s start by creating the bare minimum view necessary to show your About Us page:
<h1>About Us</h1> <div> <?php echo $content; ?> </div>
We’re actually going to jump to learning HTML in the next tutorial. So I won’t go too deep into explaining what <h1></h1> and <div></div> means. In general, they’re called "tags," and pair sof 2 matching tags (the ending one starting with a backslash) are called “elements.”
The idea here is simply that we display the value of the $content variable (i.e. your paragraph about your startup) right there in the middle of the HTML.
You may be wondering why we don’t just write that paragraph in plain text/html right there, rather than go through all the work of defining php variables in the corresponding controller class and then passing it to this view. Well, the answer is one you’ll typically hear while studying programming tutorials: this is an easy example that shows the core features you need to learn, and when you want to do more complex things (specifically dynamic things, where the value of $content can change) the utility of coding like this comes to light. Basically we could use the above HTML view file as a template for many similar pages, such as those in a blog, and display different blog article content via the variables, rather than code a different view file template for every single blog article. I'll provide a more complex example in later Yii tutorials that highlights the power of what you can do here.
Comments

SMM 3 - FORMULA TO FIND INFLUENCERS