Post by Fynn » Tue Mar 29, 2011 9:02 pm

Hey all,

Quick question, I've been searching for this for a few hours now.

How can I load an individual model in the html view? For example, I want to load 'latest products' on a specific place on the homepage.

Right now there is this code:

Code: Select all

  <?php foreach ($modules as $module) { ?>
  <?php echo ${$module['code']}; ?>
  <?php } ?>
But I want something like this:

Code: Select all

  <?php foreach ($modules as $module) { ?>
  <?php echo ${$module['code']['latest']}; ?>
  <?php } ?>
Is this possible? Thanks!

Newbie

Posts

Joined
Mon Mar 28, 2011 8:19 pm

Post by Qphoria » Wed Mar 30, 2011 12:31 am

First stop saying "model" when you mean "module" as they are 2 different things

Second, you can do this in the controller:

Code: Select all

$this->children[] = 'module/latest';
after the existing entries for $this->children

Then in the home.tpl you can use

Code: Select all

echo $latest; 
where you want it.

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by Fynn » Wed Mar 30, 2011 9:46 pm

Thank you very much Qphoria!

Newbie

Posts

Joined
Mon Mar 28, 2011 8:19 pm
Who is online

Users browsing this forum: No registered users and 60 guests