@Johnny2R, thanks for posting the code. I think I get it now.
We can get the same functionality in Couch by making the following changes -
1. The Couch version of the materpage would become as follows -
We'll need to use this masterpage as an snippet so move the file to the 'couch/snippets' folder (or to whatever location you have configured this folder). I'm assuming that the file is named 'master.html'.
Now the Couch managed template that you were using PHP in to set the variables, would become as follows -
As you can see, the calling page first sets variables named 'my_title', 'my_header', 'my_content' and 'my_footer' and then embeds the master page that makes use of those variables.
Does this help?
We can get the same functionality in Couch by making the following changes -
1. The Couch version of the materpage would become as follows -
- Code: Select all
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Meta Goes Here">
<title><cms:show my_title /></title>
<link rel="icon" href="favicon.ico" type="image/x-icon">
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
<link href='https://fonts.googleapis.com/css?family=Open+Sans+Condensed:300,700|Alegreya:400,300,700' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
<link rel="stylesheet" href="css/layouts/custom.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<cms:if my_header >
<cms:show my_header />
</cms:if>
</head>
<body>
<div class="container-fluid">
<div class="row">
<div class="col-xs-12 banner"><img src="img/banner.png"/></div>
</div>
</div>
<div class="content">
<div class="container-fluid">
<div class="row">
<cms:show my_content />
</div>
</div>
</div>
<div class="content">
<div class="container-fluid">
<div class="row footer">
<div class="col-xs-12">© 2016 CouchCMS Testing</div>
</div>
</div>
</div>
<cms:if my_footer >
<cms:show my_footer />
</cms:if>
</body>
</html>
We'll need to use this masterpage as an snippet so move the file to the 'couch/snippets' folder (or to whatever location you have configured this folder). I'm assuming that the file is named 'master.html'.
Now the Couch managed template that you were using PHP in to set the variables, would become as follows -
- Code: Select all
<?php require_once('couch/cms.php' ); ?>
<!-- set 'my_title' variable -->
<cms:set my_title="Test Page" />
<cms:template title= "<cms:show my_title />" />
<!-- set 'my_header' variable -->
<cms:capture into='my_header'>
<meta name="description" content="Test page meta description">
</cms:capture>
<!-- set 'my_content' variable -->
<cms:capture into='my_content'>
<div>
<h1>Real Content</h1>
<cms:editable name='left_content' label="Left Content" type='richtext'>
<p>Blah blah</p>
</cms:editable>
</div>
</cms:capture>
<!-- set 'my_footer' variable -->
<cms:capture into='my_footer'>
<script type="text/javascript"></script>
</cms:capture>
<!-- eventually call the master page that will use the variables set above -->
<cms:embed 'master.html' />
<?php COUCH::invoke(); ?>
As you can see, the calling page first sets variables named 'my_title', 'my_header', 'my_content' and 'my_footer' and then embeds the master page that makes use of those variables.
Does this help?