2011-07-24, 01:59 PM
2011-07-24, 02:02 PM
You can either do an if statement to check if you're on the index page, or use the find_replace_templatesets() function to edit the index template.
2011-07-24, 02:06 PM
Okay confusing. I'd just like to let you know, this is my first ever plugin and I only know very basic php so I sort of need it broken down into smaller steps.
Like what if statement should I use?
Like what if statement should I use?
2011-07-24, 02:14 PM
Wrap your code inside this:
if(THIS_SCRIPT == "index.php")
{
//Example
}
2011-07-24, 02:22 PM
Like this?
function hello_world($page)
if(THIS_SCRIPT = "index.php")
{
global $mybb;
$date = my_date($mybb->settings['regdateformat'], $post['regdate']);
$page = str_replace("<div id=\"content\">", "<center><div id=\"content\"><p>Your username is {$mybb->user['username']} and you registered in {$date}. Enjoy your visit!</p></center>", $page);
return $page;
}
2011-07-24, 02:24 PM
You're missing your function's brackets:
function hello_world($page)
{
if(THIS_SCRIPT = "index.php")
{
global $mybb;
$date = my_date($mybb->settings['regdateformat'], $post['regdate']);
$page = str_replace("<div id=\"content\">", "<center><div id=\"content\"><p>Your username is {$mybb->user['username']} and you registered in {$date}. Enjoy your visit!</p></center>", $page);
return $page;
}
}
2011-07-24, 02:31 PM
Parse error: syntax error, unexpected '=' in /home/zingorwe/public_html/mybbprofessor/inc/plugins/hello.php on line 103
2011-07-24, 02:39 PM
Oops, my bad. This should work:
function hello_world($page)
{
if(THIS_SCRIPT == "index.php")
{
global $mybb;
$date = my_date($mybb->settings['regdateformat'], $post['regdate']);
$page = str_replace("<div id=\"content\">", "<center><div id=\"content\"><p>Your username is {$mybb->user['username']} and you registered in {$date}. Enjoy your visit!</p></center>", $page);
return $page;
}
}
2011-07-24, 02:42 PM
Much better, works perfectly now, thanks.
+Rep again.
+Rep again.