2017-07-24, 10:13 PM
Hi,
TL : DR - How are buttons created in MyBB themes ? And how can I override them to use a button from MaterializeCSS ?
Im interested in integrating Materializecss with a theme I would like to create for MyBB.
(Disclaimer: Not done this before, and new to php, css and html)
I was making reasonable progress and am able to place some Materialize elements where I want them, with the style I want.
However, I have hit a brick-wall, try as I might, I cannot figure this out.
For context, I am editing , and am concentrating on the buttons Edit, Delete, Reply for posts, the main block of code is
And the styling appears to be handled by
Now the line of code that causing me to get confused
Whats confusing me is, with my limited experience, I believe in order to create a button there needs to be a statement something like
However there is no such declaration here. If I remove the {$post['button_edit']} code, then the button is removed. If I put in another {$post['button_edit']} then I get another edit button, leading me to believe the declaration is being built somewhere and I think $post has something to do with it.
After searching for everything I can think of, I have come up pretty dry. Found cross reference's to language translations and such like. So $post appears to be creating the button, and also supplying the text in the right language.
I found one block of code that looked hopeful in 'jquery.plugins' and 'jquery.plugins_e', at line 1030.
This appears to be building a html declaration, but I can't find any relation to my actual problem (maybe through inexperience?) I tried changing some lines in ,js code to see what effect it had, but no effect was had on what I wanted.
I want to use material buttons throughout, and not the standard buttons and don't know the best way to approach this. Is there a way of over-riding the default buttons in someway. So standard buttons get replaced by Materialisze buttons.
I could just remove the {$post['button_edit']} and put my materialise code there, but I'm not sure how I would get the text / translation this way.
I don't have any problem going through and editing lots of templates and inserting all the materialize buttons where they need to be, if that is the way it needs to be done, but it just doesn't seem very efficient.
Any advice greatly appreciated.
TL : DR - How are buttons created in MyBB themes ? And how can I override them to use a button from MaterializeCSS ?
Im interested in integrating Materializecss with a theme I would like to create for MyBB.
(Disclaimer: Not done this before, and new to php, css and html)
I was making reasonable progress and am able to place some Materialize elements where I want them, with the style I want.
However, I have hit a brick-wall, try as I might, I cannot figure this out.
For context, I am editing , and am concentrating on the buttons Edit, Delete, Reply for posts, the main block of code is
Quote:Postbit Templates > postbit
<div class="post_controls_default">
<div class="postbit_buttons author_buttons float_left">
{$post['button_www']}{$post['button_pm']}{$post['button_rep']}
</div>
<a class="waves-effect waves-teal ban-flat">Material Button</a>
<a class="btn-flat"><i class="material-icons left">edit</i>Edit Post</a>
<p>
<input type="checkbox" class="filled-in" id="test5" />
<label for="test5">Material Checkbox</label>
</p>
<div class="postbit_buttons post_management_buttons float_right">
{$post['button_edit']}{$post['button_quickdelete']}{$post['button_quickrestore']}{$post['button_quote']}{$post['button_multiquote']}{$post['button_report']}{$post['button_warn']}{$post['button_purgespammer']}{$post['button_reply_pm']}{$post['button_replyall_pm']}{$post['button_forward_pm']}{$post['button_delete_pm']}
</div>
And the styling appears to be handled by
Quote:global.css
.postbit_buttons > a:active {
display: inline-block;
color: #2c82c9;
padding: 7px 16px 7px 14px;
margin: 5px 2px 2px;
font-size: 12px;
border: 1px solid #bed3e4;
}
Now the line of code that causing me to get confused
{$post['button_edit']}
Whats confusing me is, with my limited experience, I believe in order to create a button there needs to be a statement something like
<button type="button">Click Me!</button>
However there is no such declaration here. If I remove the {$post['button_edit']} code, then the button is removed. If I put in another {$post['button_edit']} then I get another edit button, leading me to believe the declaration is being built somewhere and I think $post has something to do with it.
After searching for everything I can think of, I have come up pretty dry. Found cross reference's to language translations and such like. So $post appears to be creating the button, and also supplying the text in the right language.
I found one block of code that looked hopeful in 'jquery.plugins' and 'jquery.plugins_e', at line 1030.
// iterate over each button and create them
for(i=0, l=buttons.length; i<l; i++){
v = buttons[i],
defbtn = stateobj.focus === i || (isNaN(stateobj.focus) && stateobj.defaultButton === i) ? (opts.prefix + 'defaultbutton ' + opts.classes.defaultButton) : '';
state += '<button class="'+ opts.classes.button +' '+ opts.prefix + 'button '+ defbtn;
if(typeof v.classes !== "undefined"){
state += ' '+ ($.isArray(v.classes)? v.classes.join(' ') : v.classes) + ' ';
}
state += '" name="' + opts.prefix + '_' + statename + '_button' + v.title.replace(/[^a-z0-9]+/gi,'') + '" value="' + v.value + '">' + v.title + '</button>';
}
This appears to be building a html declaration, but I can't find any relation to my actual problem (maybe through inexperience?) I tried changing some lines in ,js code to see what effect it had, but no effect was had on what I wanted.
I want to use material buttons throughout, and not the standard buttons and don't know the best way to approach this. Is there a way of over-riding the default buttons in someway. So standard buttons get replaced by Materialisze buttons.
I could just remove the {$post['button_edit']} and put my materialise code there, but I'm not sure how I would get the text / translation this way.
I don't have any problem going through and editing lots of templates and inserting all the materialize buttons where they need to be, if that is the way it needs to be done, but it just doesn't seem very efficient.
Any advice greatly appreciated.