Jump to content

does this code make sence to you and if so


Vizionz

Recommended Posts

<?php if ($this->item->type == 'demo') : ?>
	<div class="demo"><?php echo $this->renderer->render('item.demo.full', array('view' => $this, 'item' => $this->item)); ?></div>	
<?php else: ?>
	<div class="item"><?php echo $this->renderer->render('item.full', array('view' => $this, 'item' => $this->item)); ?></div><?php endif; ?>

 

now how would i add another class to show

<?php if ($this->item->type == 'demo1') : ?>
	<div class="demo1"><?php echo $this->renderer->render('item.demo1.full', array('view' => $this, 'item' => $this->item)); ?></div>	
<?php else: ?>
	<div class="item"><?php echo $this->renderer->render('item.full', array('view' => $this, 'item' => $this->item)); ?></div><?php endif; ?>

 

how would i combine them into a workking code.

 

so it would check first to see if Demo and demo 1 exist and if not it would dispaly the item.

 

 

 

<?php
switch($this->item->type) {
case "demo":
	echo "<div class=\"demo\">".$this->renderer->render('item.demo.full', array('view' => $this, 'item' => $this->item))."</div>\n";
break;
case "demo1":
	echo "<div class=\"demo1\">".$this->renderer->render('item.demo1.full', array('view' => $this, 'item' => $this->item))."</div>\n";
break;
default:
	echo "<div class=\"item\">".$this->renderer->render('item.full', array('view' => $this, 'item' => $this->item))."</div>\n";
break;
}
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.