Last active
October 30, 2015 20:15
-
-
Save drmmr763/244d46385000cfc01bf9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="col-md-12"> | |
<div id="listing-awards"> | |
<?php | |
$medals = new StdClass; | |
$medals->text = '{fabrik view=list id=2 medals___Winery=' . $this->item->id . ' showfilters=0}'; | |
$medalsParams = new JRegistry; | |
JPluginHelper::importPlugin('fabrik'); // <- this should be the name of the plugin. so if its fabrik's content | |
$dispatcher = JDispatcher::getInstance(); | |
$dispatcher->trigger('onContentPrepare', array('k2.item', &$medals, &$medalsParams, 0)); | |
// I'm not sure what you're trying to check here. The code should be doing this: | |
// 1) create a class and assign a property of "text" to it. Pass that object to the event dispatcher. | |
// 2) the event dispatcher inspects the "text" property and modifies it by replacig the plugin code with the fabrik list | |
// 3) then you simply output the modified text property | |
// 4) why do we need to do an "if" on the text property here? You're doing a true or false check, but it should always be true. | |
// the "text" property here will be the list HTML from the event dispatcher. So this won't be "false" unless that somehow breaks. | |
if (! $medals->text) { | |
echo "It worked!"; | |
} | |
else { | |
echo "<h3>Medals</h3><br/>" . $medals->text; | |
} | |
// I think you just want to do: | |
echo '<h3>Medals</h3>'; | |
echo $medals->text; | |
?> | |
</div> | |
<div id="listing-recognition"> | |
<?php $recognition = new StdClass; | |
$recognition->text = '{fabrik view=list id=3 recognitions___Winery=' . $this->item->id . ' showfilters=0}'; | |
$recognitionParams = new JRegistry; | |
JPluginHelper::importPlugin('fabrik'); // we need the right name here | |
$dispatcher = JDispatcher::getInstance(); | |
$dispatcher->trigger('onContentPrepare', array('k2.item', &$recognition, &$recognitionParams, 0)); | |
if (! $recognition->text) { | |
echo "It worked!"; | |
} | |
else { | |
echo "<h3>Recognitions</h3><br/>" . $recognition->text;; | |
} | |
?> | |
</div> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment