[Solved] Template Marker is not replaced {marker}
#1
Hello,

i'm trying to program a plugin for my mybb Page, but somehow it's now working.
The Plugin is named scrolling_gallery and this is the code:


if(!defined('IN_MYBB'))
        die('This file cannot be accessed directly.');

$plugins->add_hook('index_start','scrolling_gallery');

function scrolling_gallery(){
        global $mybb, $templates, $scrolling_gallery;
        $str = 'hello world';
        $scrolling_gallery=null;
         eval('$scrolling_gallery="' . $str . '";');
}

function scrolling_gallery_info()
{

        return array(
                "name"              => "Scrolling Gallery",
                "description"       => "Nothing interesting here",
                "website"           => "",
                "author"            => "Denis D",
                "authorsite"        => "Under Construction!",
                "version"           => "1.0.0",
                "compatibility"     => "18*",
                "guid"              => "",
                );
}

In the template I have added {scrolling_gallery} and like I read, that should work.
But nothing happend...

MyBB Version :1.8.7

Someone an idea?

Edit:

Maybe I clearify "nothing happened".
Nothing showed on the Page, where my default string should appear.
When I add a return-Statement, the site is blank "like i thought" (in this moment)
Reply
#2
{$scrolling_gallery} should work on the index template
in general, $ is used for the variables
Reply
#3
{$scrolling_gallery} will work.
Reply
#4
Also tried {$scrolling_gallery}  but no changes.

But ".m." have said , it will only work on the index template, this also includes subtemplates?

The template "{$scrolling_gallery}" is called is named "header"



<html>
<head>
<title>{$mybb->settings['bbname']}</title>
{$headerinclude}
<script type="text/javascript">
<!--
lang.no_new_posts = "{$lang->no_new_posts}";
lang.click_mark_read = "{$lang->click_mark_read}";
// -->
</script>

<!--LIGHTBOX COPYRIGHTS AT THE END OF THE CODE-->
<link href="css/lightbox.css" rel="stylesheet">

</head>
<body>
{$header}
<div class="forum"><br />
{$dvz_shoutbox}
{$forums}
</div>
Reply
#5
Quote:$plugins->add_hook('index_start','scrolling_gallery');
it is coded to work on index related templates through index_start hook

to get it on the header, you have to use a global hook (eg. global_start)

see plugin hooks and plugins & hooks explained
Reply
#6
Thank you very much .m.
Now I see, that I misunderstood the hooks Smile
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)