Calling a Particular Type Within ZOO for Joomla

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
StudyRx
Forum Newbie
Posts: 5
Joined: Mon Jan 03, 2011 4:00 pm

Calling a Particular Type Within ZOO for Joomla

Post by StudyRx »

Hello All,

I am receiving terrible support from the administrators over @ yootheme for their product ZOO. It is an awesome component for Joomla but the support is just non-existent so I have to jump in and test it over and over to see what will work. I have very little experience in php and usually get around any code by throwing stuff up against the wall and seeing if it sticks.

I have several particular types for this one app instance. This will probably not be important to you. I just need to check my code and see how to do something. So far I have been using this tutorial: http://www.yootheme.com/docs/home/item/ ... cular-type

I have successfully done this for one template of one more particular type. It automatically reverts to the main type for all items. So this is my current code:

Code: Select all

<div id="yoo-zoo" class="yoo-zoo <?php echo $css_class; ?> <?php echo $css_class.'-'.$this->item->alias; ?>">
	<?php if ($this->item->type == 'patientprofiles') : ?>
		<div class="patientprofiles"><?php echo $this->renderer->render('item.patientprofiles.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; ?>
</div>
I have several other particular types (allergies, doctorprofiles, drugprofiles...etc)

I would like to go to those as well but if I do this (say for allergies) it gives me an error on the line @ the last </div> tag. Any ideas?

Code: Select all

<div id="yoo-zoo" class="yoo-zoo <?php echo $css_class; ?> <?php echo $css_class.'-'.$this->item->alias; ?>">
	<?php if ($this->item->type == 'patientprofiles') : ?>
		<div class="patientprofiles"><?php echo $this->renderer->render('item.patientprofiles.full', array('view' => $this, 'item' => $this->item)); ?></div>
	<?php else: ?>
<?php if ($this->item->type == 'allergies') : ?>
		<div class="allergies"><?php echo $this->renderer->render('item.allergies.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; ?>
</div>
StudyRx
Forum Newbie
Posts: 5
Joined: Mon Jan 03, 2011 4:00 pm

Re: Calling a Particular Type Within ZOO for Joomla

Post by StudyRx »

I have figured it out after a bit of reading...

THE WORKING CODE:

Code: Select all

<div id="yoo-zoo" class="yoo-zoo <?php echo $css_class; ?> <?php echo $css_class.'-'.$this->item->alias; ?>">

	
	<?php if ($this->item->type == 'patientprofiles') : ?>
	
		<div class="patientprofiles"><?php echo $this->renderer->render('item.patientprofiles.full', array('view' => $this, 'item' => $this->item)); ?></div>
		
	<?php elseif ($this->item->type == 'allergies') : ?>
	
		<div class="allergies"><?php echo $this->renderer->render('item.allergies.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; ?>

</div>
Neilos
Forum Contributor
Posts: 179
Joined: Fri Nov 19, 2010 2:07 am

Re: Calling a Particular Type Within ZOO for Joomla

Post by Neilos »

lol congrats, I was thinking about looking in to this for you but I was hesitant as I don't know anything about Joomla or ZOO. I'm glad you sussed it :D
StudyRx
Forum Newbie
Posts: 5
Joined: Mon Jan 03, 2011 4:00 pm

Re: Calling a Particular Type Within ZOO for Joomla

Post by StudyRx »

Thanks. :)

Now I am just working on trying to differentiate between the templates...lol.

For each particular type, there are different templates...hence...the full at the end of the code...

Code: Select all

<?php if ($this->item->type == 'patientprofiles') : ?>
       
                <div class="patientprofiles"><?php echo $this->renderer->render('item.patientprofiles.full', array('view' => $this, 'item' => $this->item)); ?></div>
All I have to figure out now is how to render the other template "teaser"

Code: Select all

<?php if ($this->item->type == 'patientprofiles') : ?>
       
                <div class="patientprofiles"><?php echo $this->renderer->render('item.patientprofiles.teaser', array('view' => $this, 'item' => $this->item)); ?></div>
I just need to figure out where it goes. Thanks again. :)
Post Reply