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

How to show all nodes in a page node?

#1
I need to show all nodes in a page node. Then i will link all entries to create new thread in that forum.

Which is the best way to do this preserving permissions?
 

Brogan

XenForo moderator
Staff member
#2
Node Tree -> Node -> Page Options -> List Sibling Nodes/List Child Nodes

Oh wait, you want to create URL's to all forums on a single page?
You will just have to create the HTML code and add it to the page.

You can try wrapping specific URLs in user group conditionals, to show/hide each one to specific groups.

Or, if you're proficient with PHP, you can do a PHP callback.
 
#3
That's not exactly i need. I need to show all nodes, not only List Sibling Nodes. Something like forum's list in 'fast navigation link' but chanching their destination link.
 
R

ragtek

Guest
#5
You can get all Forums with this code snippet
PHP:
    public static function getAllNodesByType($type = 'Forum', $ignoreNestedSetOrdering = false, $listView = false)
    {
        /** @var $nodeModel XenForo_Model_Node */
        $nodeModel = self::getNodeModel();

        $nodes = $nodeModel->getAllNodes($ignoreNestedSetOrdering, $listView);
        foreach ($nodes AS $node) {
            if ($node['node_type_id'] != $type) {
                unset($nodes[$node['node_id']]);
            }
        }

        return $nodes;
    }
 
#8
ok. So the steps are:

1. create a new class with a static method
2. create a template
3. do a php callback

where have i to create the new class and how xenforo knows where is it?
 
F

Floris

Guest
#10
Custom things like a php callback are .. custom, so they require you to build your add-on within the library, in a custom dir, with a custom file. Perhaps you will have more add-ons, etc. So I recommend to people to use a unique personalized but recognizable main directory - for my site i put all my plugins under library/ in the xenfans/ directory. Since this is in relation to pages php callback, I would just make up a dir called pages/ and inside it your index.php (can also be callbackstuff.php. So you get:

library/ismael/pages/index.php

index.php starts with:

<?php
class ismael_pages_index
{
// your code here
}

the class is build on the dir it's un, from underneath the library/ directory, the php file is appended without the .php
I've coloured them so you can see what I mean. library/dir/dir/dir/file.php ends as dir_dir_dir_file

Within the class you can put your function with a return.