[php callback] how to fetch the content from .txt

Snister2

Active member
Registered
Joined
Jan 6, 2023
Messages
40
Points
18

Reputation:

How to enable getting the original code from the node_list_forum template using phpcallback and it will act like the original code of the subnode instead of plane text. from txt file content.

I plan to create an external admin panel with a few features that can change the appearance of the style.
PHP:
<?php

namespace senospanel;

class index
{
    public static function getCode()
    {
        // Read the content of the text file
        $code = file_get_contents('../../admin-theme/data/subnode/value1.txt');
        
        // Return the code with appropriate escaping
        return htmlspecialchars($code);
    }
}
?>
I didn't make an addon, I just put it there
1709808709866.png


this the code use to fetch from txt
HTML:
<xf:if is="$depth == 2 AND property('nodeListSubDisplay') == 'flat'">
                    <xf:macro template="forum_list" name="sub_nodes_flat"
                        arg-children="{$children}"
                        arg-childExtras="{$childExtras}"
                        arg-depth="{{ $depth + 1 }}" />
                </xf:if>
1709808822507.png

here is the result
1709808879295.png

I hope someone will notice my problem and correct me
 

Splicho

Emudevs.gg Owner
Staff member
Moderator
Collaborate
Registered
Joined
Jan 21, 2022
Messages
630
Points
103

Reputation:

So you want to put something in the text file and it will print there under the node?
 

Snister2

Active member
Registered
Joined
Jan 6, 2023
Messages
40
Points
18

Reputation:

So you want to put something in the text file and it will print there under the node?
SplichoYes, I try elements from sub node its work but if i use template code not work
 

Splicho

Emudevs.gg Owner
Staff member
Moderator
Collaborate
Registered
Joined
Jan 21, 2022
Messages
630
Points
103

Reputation:

Yes, I try elements from sub node its work but if i use template code not work
Snister2Would be better logic if you wrap that into a custom var.
Like {$senospanel.text} instead writing all this macro function.

But dunno how.
 
Top