• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Transfer admin data to front end

Jeremy

Well-known member
#5
No. DataWriters are for what their name implies they are for. If you have the data displayed in the backend, you have all the necessary components for it to be displayed on the front end.
 

Matthew Hawley

Well-known member
#6
So it would be this?

Code:
<xen:foreach loop="$addedLinks" value="$link">
	<li><a href="{$link.href}" class="{xen:if "{$selected} == {$link.route}", 'secondaryContent', 'primaryContent'}">{$link.title}</a></li>
</xen:foreach>
 

Matthew Hawley

Well-known member
#7
@Jeremy how did you get this to work?

Code:
<xen:foreach loop="$addedLinks" value="$link">
                    <li><a href="{$link.href}" class="{xen:if "{$selected} == {$link.route}", 'secondaryContent', 'primaryContent'}">{$link.title}</a></li>
</xen:foreach>
When I try it, I get this:

Template Errors: cf_directory_index
  1. Invalid argument supplied for foreach() in /home3/mcwh/public_html/xxx/library/XenForo/Template/Abstract.php(265) : eval()'d code, line 26:
    25: ';
    26: foreach ($addedLinks AS $link)
    27: {
 
#8
@Jeremy how did you get this to work?

Code:
<xen:foreach loop="$addedLinks" value="$link">
                    <li><a href="{$link.href}" class="{xen:if "{$selected} == {$link.route}", 'secondaryContent', 'primaryContent'}">{$link.title}</a></li>
</xen:foreach>
When I try it, I get this:

Template Errors: cf_directory_index
  1. Invalid argument supplied for foreach() in /home3/mcwh/public_html/xxx/library/XenForo/Template/Abstract.php(265) : eval()'d code, line 26:
    25: ';
    26: foreach ($addedLinks AS $link)
    27: {
I assume you never passed the $addedLinks to the template.

For instance when you do this:

PHP:
$addedLinks = array();
return $this->responseView('XX_ViewPublic_Forum', 'xx', array('addedLinks' => $addedLinks));
If you'll do the above you won't see the error you see right now. but you'll have to do what ever you need to do in order to get $addedLinks populated with data.
 

Matthew Hawley

Well-known member
#9
I assume you never passed the $addedLinks to the template.

For instance when you do this:

PHP:
$addedLinks = array();
return $this->responseView('XX_ViewPublic_Forum', 'xx', array('addedLinks' => $addedLinks));
If you'll do the above you won't see the error you see right now. but you'll have to do what ever you need to do in order to get $addedLinks populated with data.
Which file do I do this on?
 
#10
Nevermind I would do it in the controllerpublic file. I found this in Jeremy's help manager addon.

Code:
protected function _getWrapper($selected, XenForo_ControllerResponse_View $subView) {
        $wrapper = parent::_getWrapper($selected, $subView);

      $links = array();
    $helpModel = XenForo_Model::create('XI_HelpManager_Model_Page');
    $pages = $helpModel->getAllPagesForDisplay();

    $wrapper->params['addedLinks'] = $pages;

        return $wrapper;
    }
But that would help me with my addon as its for the help section...How would I change this to suit my addon?