Jump to content

Nothing pass from wireRenderFile


adrianmak
 Share

Recommended Posts

products-index.php

<?php
// debug message
$content = "debug msg: This is a product index page.";

$page_title = $page->title;

$childpages = $page->children();

$layout = wireRenderFile("products-index-tpl", array('childpages'=>$products));

// output
$content .= $layout;

products-index-tpl.php

<?php

$out = "";

foreach($products as $product) {

$out .= $product->title . "<br/>";

}

echo $out;

I found that $products is null/empty in products-index.tpl.php.

Then, I print the $childpages at products-index.php, the variable has a value, pages id(s)

If I didn't the wireRenderFile method and put back the foreach loop from products-index-tpl.php into products-index.php. IT WORKS.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...