How to add a view part
nunocodex opened this issue · 1 comments
nunocodex commented
I tried to make a fix for the home page because missing the content part for make inside the errors generated by views but nothing happen, I follow the docs but without success, I have tried some ways (added show).
This is my source:
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1" />
{{! charset("utf-8") !}}
{{! pageTitle($title) !}}
{{! css("http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,700italic,300,400,700") !}}
{{! css($css) !}}
<link rel="icon" type="image/png" href="/favicon-32x32.png?v=1.0" sizes="32x32">
<link rel="icon" type="image/png" href="/favicon-16x16.png?v=1.0" sizes="16x16">
</head>
<body>
<main class="main">
<% part("content") %>
<div id="welcome-wrapper">
<section id="welcome">
<h1>Welcome</h1>
You just successfully created your first Opulence application. That wasn't too hard, was it?
</section>
<section id="learn-more">
<h3>Learn More</h3>
Read the <a href="https://www.opulencephp.com/docs/installing" target="_blank" title="Read the official documentation">official documentation</a>.
</section>
</div>
<% endpart %>
</main>
</body>
</html>
davidbyoung commented
I've fixed the home template in the skeleton Project. You can see how I did this there: https://github.com/opulencephp/Project/blob/1.0/resources/views/Master.fortune.php and https://github.com/opulencephp/Project/blob/1.0/resources/views/Home.fortune.php.
If you want to define a part and show it, too, do the following:
<% part("nameOfPart") %>
This is the content
<% show %>