将站点从PHP站点转换为完整的LemonStand电子商务站点

Brand new to LemonStand, and it's my front-runner for developing a client's web site.

This first candidate for utilizing LemonStand is a newly built web site I built in PHP.

I've got all of the non-e-commerce pages (things like about and contact) pulling from the LemonStand CMS.

But now I am trying to convert what were simple PHP includes to partials:.

Example:

<? include 'standard_include.php'; ?>

<? include 'header.php'; ?>

to LemonStand's

<? $this->render_partial('standard_include') ?>

<? $this->render_partial('header') ?>

I get an unhandled exception related to undefined variables:

This is what the beginning my page/template looks like

<?php
require_once('lib/php/configuration.php');
$pagetype = 'home';
$subpagetype = 'index';
$titleValue = 'Client Name';
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title><?php echo $titleValue ?></title>    

<? $this->render_partial('standard_include') ?>

</head>

<body>

<? $this->render_partial('header') ?>

Do the partials not render till later in the page load process (as compared to PHP includes)?

Am I utilizing partials incorrectly? If so, what do I do to put the PHP includes into the LemonStand backdoor system?

I'm thinking the render_partial is happening after the pages start rendering, while the include happens prior, so it has a value for pagetype.

I'm thinking the solution is going to be to keep them includes. I just won't be able to have every file in their admin/backend system.

For common elements, the included templates with LemonStand don't seem to do anything but have them inline, which obviously isn't optimal for making a change across a site for something like a header or footer.

I've never used Lemonstand, but if its MVC works like other MVC systems, then you need to inject the variables needed by standard_include into the view. Something like:

$this->renderPartial('standard_include', array('pagetype'=>$pagetype, ...)) ?>

Otherwise the partial won't have access to the variables you defined in your parent template because the partial is rendered in a different context.

PHP include works differently. It just literally inserts the included file in place at that point before the script is executed.