Nodes As Tabs

Nodes As Tabs 1.5.1

No permission to download
Been trying this all day a few different ways..

The most promising approach, below, read all rows (80) but did not pass any values to $response - my output just shows 80 blank rows.

Lol, everywhich way gives me some success but not what I want:cry:

PHP:
<?php
class SummaryRatings_Model_SummaryRatings
    {
        public static function getRatings(XenForo_ControllerPublic_Abstract $controller, XenForo_ControllerResponse_Abstract &$response)
            {
                $db = XenForo_Application::getDb();
 
                $ratings = $db->query("
                    SELECT *
                    FROM ratings
                    ");
 
                while ($rating = $ratings->fetch())
                {
                    $allratings[] = array(
                        'player_image' => base64_encode( $rating['player_image']) ,
                        'player_name' => $rating['player_name'],
                        'rating' => $rating['rating']
                    );
                }
 
                $response->params['row'] = $allratings;
       
            }
           
    }
?>
 
PHP:
<?php
class SummaryRatings_Model_SummaryRatings
    {
        public static function getRatings(XenForo_ControllerPublic_Abstract $controller, XenForo_ControllerResponse_Abstract &$response)
            {
                $db = XenForo_Application::getDb();
 
                $ratings = $db->fetchAll("
                    SELECT *
                    FROM ratings
                    ");

                $allratings = array();
                foreach ($ratings AS $rating)
                {
                    $allratings[] = array(
                        'player_image' => base64_encode( $rating['player_image']) ,
                        'player_name' => $rating['player_name'],
                        'rating' => $rating['rating']
                    );
                }
 
                $response->params['rows'] = $allratings;
       
            }
           
    }
?>

Then in your template you can "foreach" over the rows:

Code:
<table CELLPADDING=30 border =5 >

<xen:foreach loop="$rows" value="$row">
<tr>
<td>{$row.title}</td>
<td>{$row.player_name}</td>
<td>{$row.rating}</td>
</tr>
</xen:foreach>

</table>
 
OK I got to the point - after 8 hours:eek: where I know my query is ok up the $response command.

I have echoed out one of the variables to ensure that the data is being read by the query below (and it is)

PHP:
<?php
class SummaryRatings_Model_SummaryRatings
    {
        public static function getRatings(XenForo_ControllerPublic_Abstract $controller, XenForo_ControllerResponse_Abstract &$response)
            {
                $mysqli = new mysqli("localhost", "arsenalt_admin", "ramsday00",  "arsenalt_xenforo");
 
                /* check connection */
                if (mysqli_connect_errno()) {
                    printf("Connect failed: %s\n", mysqli_connect_error());
                    exit();
                }
 
                $query = "SELECT title, player_name, player_image, rating FROM ratings";
                $result = $mysqli->query($query);
 
                /* associative and numeric array */
               
                while($row = $result->fetch_array(MYSQLI_ASSOC))
                {
                $rows[] = $row;
                }
 
                foreach($rows as $row)
                {
                $row['player_image'] = base64_encode( $row['player_image'] );
                echo $row['rating'];
                }
                $response->params['row'] = $rows;
               
       
            }
           
    }
?>

BUT, all i get in the xenforo page template are 80 blank rows - so I suspect that the $response command is not reading the data...

I am completely stuck on where to go next.:(

Please help me get over last hurdle:D

cheers

J
 
I like your previous code better, the one that I amended, and the one that uses XF's $db object.

If you were a woman I would be proposing right now - I had missed your ammended code using the $db object and have just swapped it back.... it works!

Thank you very much! With this I can adapt it now for so much of what I want to do(y)

Anyone trying to do something similar - Jake's amended code in post #222 is the code that works...
 
How can i change the text color of a node title that is a tab. I would like one of my node tabs to be a different color then the default (Only one though)
 
How can i change the text color of a node title that is a tab. I would like one of my node tabs to be a different color then the default (Only one though)

Admin CP -> Appearance -> Templates -> EXTRA.css

Rich (BB code):
.navTabs .navTab.nodetab1 .navLink
{
	color: red;
}

You need to enter the node_id of the node that is a tab.
 
Admin CP -> Appearance -> Templates -> EXTRA.css

Rich (BB code):
.navTabs .navTab.nodetab1 .navLink
{
color: red;
}

You need to enter the node_id of the node that is a tab.
Hmm this doesnt seem to work for me. I am getting the ID from the url at the bottom when holding my mouse over it in applications -> node tree.
http://www.website.com/forum/admin.php?nodes/thenodesname.59/edit

Looks as such:
Code:
.navTabs .navTab.nodetab59 .navLink
{
    color: red;
}
.discussionListItem.unread .title a:before
{
    content: '[Unread] ';
    color: grey;
    font-weight: bold;
}
.discussionListItem.locked .title a:before
{
    content: '[Locked] ';
    color: red;
    font-weight: bold;
}
.discussionListItem.sticky .title a:before
{
    content: '[Sticky] ';
    color: gold;
    font-weight: bold;
}
 
Jake,
I setup a tab as a link forum and can't get the links template to display below the tab. Any ideas?

Thanks,
Itworx4me
 
Jake, would it be possible to set a unique menu ID similarly to the Account, Conversations and Alert menu? I'm trying to set columns similar to how the account menu is, and I need to modify the width of the tab added by this addon to do so, but it only used the XenForoUniq# ID.
 
Jake, would it be possible to set a unique menu ID similarly to the Account, Conversations and Alert menu? I'm trying to set columns similar to how the account menu is, and I need to modify the width of the tab added by this addon to do so, but it only used the XenForoUniq# ID.

All tabs created by this addon have an id of:

nodetab#

Where # is the node_id of the node. You can use that in CSS selectors for custom styling of node tabs. Here is an example:

http://xenforo.com/community/threads/nodes-as-tabs.26687/page-12#post-435085

And please read the few posts after that too. There used to be a bug in the default navigation template, and that bug is still included in many custom styles that people use.
 
Top Bottom