2017-10-27, 04:29 AM
Hi this is my first post. I'm new to mybb development.
I'm mainly a ruby on rails & node dev but have got the opportunity to work on an awesome community with mybb.
I just started building a plugin and have some questions that can't be answered in the docs or I can't find it online.
I feel posting is the best option to get help from someone who has a bunch of experience.
Anyway lol.
In my _install I call a method from a file I included which adds a template and then replaces a part of the header template with this template I created.
That works fine. I'm not sure if this is ideal so let me know. The docs say to do it that way so I did.
Now the issue i'm having is when I deactivate I want to delete that $template I added to the header.
Here's my code.
This does not work and just adds a space.
Please let me know what i'm doing wrong. Any tips or advice that will help me get in the mybb dev loop quicker are greatly appreciated.
Thanks in advance!
Edit: I'm also wondering if structuring my plugin folder like this is reasonable.
Pages file being where It would serve pages needed and create templates
Bump?
I'm mainly a ruby on rails & node dev but have got the opportunity to work on an awesome community with mybb.
I just started building a plugin and have some questions that can't be answered in the docs or I can't find it online.
I feel posting is the best option to get help from someone who has a bunch of experience.
Anyway lol.
In my _install I call a method from a file I included which adds a template and then replaces a part of the header template with this template I created.
That works fine. I'm not sure if this is ideal so let me know. The docs say to do it that way so I did.
Now the issue i'm having is when I deactivate I want to delete that $template I added to the header.
Here's my code.
function remove_navbar_trade_link() {
global $templates;
eval("\$trade_nav = \"".$templates->get("header_menu_trade")."\";");
find_replace_templatesets(
"header",
"#" . preg_quote($trade_nav) . "#i",
""
);
}
function add_navbar_trade_link() {
global $templates;
eval("\$trade_nav = \"".$templates->get("header_menu_trade")."\";");
find_replace_templatesets(
"header",
"#" . preg_quote('<ul class="menu top_links">'). "#i",
"<ul class=\"menu top_links\">\n{$trade_nav}"
);
}
This does not work and just adds a space.
Please let me know what i'm doing wrong. Any tips or advice that will help me get in the mybb dev loop quicker are greatly appreciated.
Thanks in advance!
Edit: I'm also wondering if structuring my plugin folder like this is reasonable.
-plugins folder
-myplugin.php
-/myplugin/
-myplugin_pages.php
-myplugin_templates.php
Pages file being where It would serve pages needed and create templates
Bump?