1. 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?

Discussion in 'XenForo Development Discussions' started by ismael33, Oct 18, 2011.

  1. ismael33

    ismael33 Member

    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?
     
  2. Brogan

    Brogan XenForo Moderator Staff Member

    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. ismael33

    ismael33 Member

    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.
     
  4. Brogan

    Brogan XenForo Moderator Staff Member

    You can try copying the code for the quick navigation menu and amend it to add a post thread link.
     
  5. ragtek

    ragtek Guest

    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;
        }
     
  6. ismael33

    ismael33 Member

    In wich class are 'getAllNodesByType' function. Have i to put it in 'PHP Callback' option in the page node?
     
  7. ragtek

    ragtek Guest

    ismael33 likes this.
  8. ismael33

    ismael33 Member

    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?
     
  9. ismael33

    ismael33 Member

    please, can you tell me if have i to create a 'Dev' directory into 'xenforo/library'?
     
  10. Floris

    Floris Guest

    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.
     
    ismael33 likes this.
  11. ismael33

    ismael33 Member

    Thank you Floris
     

Share This Page