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.

 

 

 

Link to comment
Share on other sites

<?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;
}
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.