News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Looking for help...

Started by djoos5, February 27, 2019, 01:04:11 PM

Previous topic - Next topic

djoos5

First, let me start by saying I am not sure if this is where this post should go. If I am on the wrong board, please let me know and I will move my post.

Second, I just downloaded the fantastic new SMF 2.1 RC1 to my RPG forum and it is working great! I am having a challenge though with restoring the modifications that I had done for my boards under the previous versions and I am hoping I can get some help. I have forgotten where some of the changes need made, and I know now, too, that the way things are now coded is not the same as it used to be and thus my old notes are not applicable.

So let me start by pointing to the three images attached below. On each are four bullets that I need help addressing and I think three are easy fixes - the third is going to probably be a bit of a challenge. I will go in order of the items:

1] on my old board, as can be seen in picture 1, I have a background image that fills the screen behind the boards. I do not remember where I add that - is it on the Index.css file? If not, I would truly appreciate the guidance on where to code the image. The image itself is already uploaded to my forum software and so I believe I just need to map to it.

2] on my old board, as can be seen in picture 1, I also edited my screen so that the center forum was wider and filled out more space on my screen. I think that this, too, was done with the Index.css file, but it has been a long time and I don't remember how I did it. My notes that I wrote are vague to this matter, and any help would be fantastic.

3] on my old board, as can be seen in picture 1, I had added three new buttons to my main menu, and reorganized the ones that are part of the primary theme. I have already added the buttons to my Subs.php file and the code works - you will see that the buttons are there in the picture 3 below. The help I need on this one is how do I get the pictures to show up for the individual buttons, instead of having the ? before each of them. I am pretty sure that this function was also done on the Index.css by adding:

.generic_icons.dice {

background: url(../images/dice_button_icon.png);

}


I have added this code for each of the four new buttons, but it is not putting in the button icons.

Again - thanks for help on this one!

4] Lastly, on my old board, I had used the customization mod for the dice roller and added three buttons to my Post page that allowed me to add a dice roll by type - picture 4. It also added the buttons and that was done in the Subs-editor.php file (I believe), but I looked at the new PHP code and it no longer reflects the same arrays.

As an FYI, I did add the Dice Roller code to my Subs.php, Subs-post.php, and Modifications.english.php and the BBC code works. The function rolls the dice and if you tamper with it, it shows that information. What I can't get is the buttons that I used to have in my Post formatting menu.

So for bullet 4, I would love some help on how to add my three buttons back to the post screen, so my players can quickly add the BBC code with a click.

I know I am being overly thankful in this post, but I understand how hard you guys work and then we novice modders come in with all the questions. So, I will thank in advance for any help that is given!

I look forward to any response.

DJ

Arantor

Well, 2) needs work because it's designed to be responsive and you can't just change it. 3) you need to add more code to override the background position, try adding background-position: 0 0; to the CSS you have.

As for 4), not sure how easy that is, the new editor is a lot lot different and I don't know anyone that has done that yet...

djoos5

I think I just resolved 1st issue.

It is in the body section of the Index.css file.

djoos5

Hey Arantor!

You helped me a while back with my coding! Thanks then and now!

I was looking through all of my old posts here to see if I could get some insight and you were a big help with the button fixes before.

Arantor

Yes but the editor is completely different now and I haven't looked at what it takes at add a button :(

djoos5

Yea, I understand.

I was just saying hello and that you had helped me before.

Just sending some appreciation for the time you had given me a year or so ago.

live627

Quote from: Arantor on February 27, 2019, 01:23:38 PM
Yes but the editor is completely different now and I haven't looked at what it takes at add a button :(
Almost the same code

An example mod: https://www.simplemachines.org/community/index.php?action=dlattach;topic=319968.0;attach=261094

djoos5

Starting to come together!

TO my issues:

1] Resolved! This was in the Index.css file.

2] Sort of resolved. I can live with the settings for my forums width. I understand it needs to be active for other devices.

3] This one is coming along! I have my buttons in there, but the question marks are still there, too (see picture below). If anyone has any ideas how to help, I would appreciate it.

Here is what I did on this one:

Added my button to Subs.php like this:

'characters' => array(
'title' => 'Characters',
'href' => '',
'show' => !$user_info['is_guest'],
'sub_buttons' => array(
                                 ),


Then I added this code to the end of my Index.css

.main_icons.characters {
background: url(33/images/characters_button_icon.png);
}


So, it found the image, but it won't remove the 'question mark'. I appreciate any help!

4] As Arantor has informed me, this might take work so I will have to find a work around. If anything, I will just have the players type the [roll] BBC code for their posts.

Arantor

Quote from: live627 on February 27, 2019, 02:39:10 PM
Quote from: Arantor on February 27, 2019, 01:23:38 PM
Yes but the editor is completely different now and I haven't looked at what it takes at add a button :(
Almost the same code

An example mod: https://www.simplemachines.org/community/index.php?action=dlattach;topic=319968.0;attach=261094

Is it? Last time I tried it (around beta 1) this approach no longer worked and I haven't looked in a while.

djoos5

Quote from: djoos5 on February 27, 2019, 02:46:06 PM
Starting to come together!

TO my issues:

3] This one is coming along! I have my buttons in there, but the question marks are still there, too (see picture below). If anyone has any ideas how to help, I would appreciate it.

Here is what I did on this one:

Added my button to Subs.php like this:

'characters' => array(
'title' => 'Characters',
'href' => '',
'show' => !$user_info['is_guest'],
'sub_buttons' => array(
                                 ),


Then I added this code to the end of my Index.css

.main_icons.characters {
background: url(../images/characters_button_icon.png);
}


So, it found the image, but it won't remove the 'question mark'. I appreciate any help!

I just wanted to bump this one again, to see if anyone has a suggestion on what to do and also to clarify the details that I am needing help with. The question mark remains, but the icon image is there - although it looks like it is duplicating it.

Thanks in advance!

vii

Use the 'icon' parameter of the $buttons array and set the file name of your icon, and put it in the default images directory. So like:


'characters' => array(
            'title' => 'Characters',
            'href' => '',
            'show' => !$user_info['is_guest'],
            'icon' => 'characters_button_icon.png',
            'sub_buttons' => array(
                                 ),



I think the issue here is that it's trying to use the forum's sprite file which has the default icons, but you didn't provide a class that has the coordinates, so it ends up using the first image in each file, which happens to be the question mark icon. It's also why your icon keeps repeating. It is expecting to use a sprite but you're not providing one.

djoos5

Hey Virginiaz,

Thanks for replying with some help!!

I added the code you suggested...

'icon' => 'characters_button_icon.png',

...and it is still defaulting to the question mark icon.

I then changed my Index.css file to look for a generic icon (this is the commands I added in SMF 2.1 beta 2)...

.generic_icons.characters {
background: url(../images/character_buttons_icon.png);
}


...and it still just defaults to the question mark.

So, I know without the icon code in my button string and having .main_icons.characters it is at least looking for and finding my added icons. I am just at a loss from there.

I appreciate the help, very much, and I welcome any other suggestions!

THANK YOU!!

Kindred

It's a sprite file.... you have to use CSS to declare the correct size and location (x,y) of the image you want within the sprite.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Arantor

I even suggested how to reset the position further up this thread...

vii

This is the code for the 'icon' parameter:

                // Does this button have its own icon?
                if (isset($button['icon']) && file_exists($settings['theme_dir'] . '/images/' . $button['icon']))
                    $button['icon'] = '<img src="' . $settings['images_url'] . '/' . $button['icon'] . '" alt="">';
                elseif (isset($button['icon']) && file_exists($settings['default_theme_dir'] . '/images/' . $button['icon']))
                    $button['icon'] = '<img src="' . $settings['default_images_url'] . '/' . $button['icon'] . '" alt="">';
                elseif (isset($button['icon']))
                    $button['icon'] = '<span class="main_icons ' . $button['icon'] . '"></span>';
                else
                    $button['icon'] = '<span class="main_icons ' . $act . '"></span>';


Did you put the image file in the right place? You can add your image to the sprite file but you don't have to. But if you do, you have to provide the coordinates.

djoos5

First let me say sorry if I am not understanding 100% what each of you are saying - I am a novice at php coding and only do enough (with help) to make the simple tweaks to my board.

To Kindred - a sprite file? I am assuming you are talking about the image I attached below. I did not add my own icons to this file that comes from the SMF file. I truly don't know how. Nor do I know how to find the coordinates. I have always created and used my own little 16x16 PNG icons that I upload to ../Themes/default/images/

To Arantor - Yea, I saw your coordinate code suggestion, but I assumed that that was for what Kindred is talking about - where the icon is on a page of icons and you address its coordinates. Do I need to address the icon's coordinates if it is not on the sprite file? I am too much of a novice to know how to do that and I think I would be at a loss for people giving me that volume of assistance.  ;D

To Virginiaz - where do I place that code? In the Subs.php file or in the Index.css? And to answer your second part, yea - I have my own separate icons that I uploaded to: ../Themes/default/images/

Thanks again everyone for your input and help!

djoos5

Just as an FYI, this is the thread that I had gotten everyone's assistance with back in 2015 when the SMF 2.1 beta released.

Margarett's instructions worked perfectly and i was able to add icons and buttons to the main menu as well as the POST BBC editor buttons, but something has changed between the beta release and RC 1.

https://www.simplemachines.org/community/index.php?topic=536183.msg3809983#msg3809983

Bottom line is, my buttons work and everything is functioning the way I want it. It is just the matter of getting the correct icons to distinguish the buttons. I would love to also be able to add BBC buttons to the post screen, but that will be a conversation for another thread!  ;) ;D

vii

The code was just to show what smf 2.1 does with the 'icon' parameter. It's already in Subs.php. All you should have to do is provide the filename so long as you put the actual file in the proper directory. That way you can avoid adding your image to the main icons sprite file (or creating your own).

I don't know what you're doing wrong. I tested it on my end and it works fine.

djoos5

Okay, I will give it another try and see what is happening.

Thanks!

djoos5

#19
Virginiaz, are you needing to make any changes to the Index.css file to get your code to operate?

If so, what do you change there?

Here is my code in my Subs.php...

'characters' => array(
'title' => 'Characters',
'href' => '',
'show' => !$user_info['is_guest'],
                'icon' => 'characters_button_icon.png',
'sub_buttons' => array(
                               )


I have the image uploaded to ../Themes/default/images/

Does it need to be a GIF file instead of PNG?

I cannot see anything I am missing.

Advertisement: