Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Aiheen aloitti: Sir Osis of Liver - maaliskuu 07, 2020, 12:07:44 AP

Otsikko: Admin $txt[] strings
Kirjoitti: Sir Osis of Liver - maaliskuu 07, 2020, 12:07:44 AP
Where are the $txt[ ] strings called in Admin.template.php?   Searched the code several times, the string variables for title bars are in ManageSettings.english.php but nowhere else.  Like these -



$txt['setup_verification_questions'] = 'Verification Questions';
$txt['setup_verification_questions_desc'] = '<span class="smalltext">If you want users to answer verification questions in order to stop spam bots you should setup a number of questions in the table below. You should pick relatively simple questions; answers are not case sensitive. You may use BBC in the questions for formatting, to remove a question simply delete the contents of that line.</span>';


Otsikko: Re: Admin $txt[] strings
Kirjoitti: wintstar - maaliskuu 07, 2020, 03:39:22 AP
There is no separate template.

LainaaSources/ManageSettings.php
   $context['sub_template'] = 'show_settings';

Admin.template.php at line 740
Lainaa// Template for showing settings (Of any kind really!)
function template_show_settings()
{



Admin.template.php at line 793 $config_vars
// Now actually loop through all the variables.
$is_open = false;
foreach ($context['config_vars'] as $config_var)
{
// Is it a title or a description?
if (is_array($config_var) && ($config_var['type'] == 'title' || $config_var['type'] == 'desc'))
{
// Not a list yet?
if ($is_open)
{
$is_open = false;
echo '
</dl>
</div>
<span class="botslice"><span></span></span>
</div>';
}


ManageSettings.php  $config_vars = array(
$config_vars = array(

array('title', 'setup_verification_questions'),
array('desc', 'setup_verification_questions_desc'),
array('callback', 'question_answer_list'),
);
Otsikko: Re: Admin $txt[] strings
Kirjoitti: Sir Osis of Liver - maaliskuu 07, 2020, 05:27:04 IP
Was looking for something like that, don't see how it works.  How are the strings loaded if the actual $txt[] variables aren't called?
Otsikko: Re: Admin $txt[] strings
Kirjoitti: SychO - maaliskuu 07, 2020, 05:52:43 IP
They are called dynamically, the keys are specified in the settings array, the source code processes the array and sets up the template.
Otsikko: Re: Admin $txt[] strings
Kirjoitti: Sir Osis of Liver - maaliskuu 07, 2020, 07:19:19 IP
   ??? I'll have to think about that.
Otsikko: Re: Admin $txt[] strings
Kirjoitti: Antechinus - maaliskuu 07, 2020, 09:06:32 IP
It's not that tricky. The calls are handled in Sources/Admin-whatever.php, and then sent to the template. It's the same process as generating the page index, or the columns on the memberlist table.

Why does it matter? What are you trying to do?
Otsikko: Re: Admin $txt[] strings
Kirjoitti: Sir Osis of Liver - maaliskuu 08, 2020, 11:04:32 IP
Was trying to undo something one of my regulars did to Sycho's Lazarus theme.  When she gets bored she plays with css, and did something that pushed content left in some admin panels.  Not knowing what she did, or what she was trying to do when she did it, only that she had done it before (several times) and I had fixed it easily, wasn't getting it this time so I was backtracking through admin template trying to use $txt[] variables as markers to find css classes (inspect element was returning bogus classes), and not getting anywhere.  She's switched back to her primary theme, so am hopeful I won't have to worry about it any further, as my somewhat limited attention span has lapsed.

Otsikko: Re: Admin $txt[] strings
Kirjoitti: Antechinus - maaliskuu 09, 2020, 06:17:32 AP
Tell her playing with CSS is all well and good, but sensible people take backups of things before they screw them.

And they play around on test sites, not on the main theme of a live forum.
Otsikko: Re: Admin $txt[] strings
Kirjoitti: Sir Osis of Liver - maaliskuu 09, 2020, 12:32:16 IP
Lainaus käyttäjältä: Antechinus - maaliskuu 09, 2020, 06:17:32 AP
Tell her playing with CSS is all well and good, but sensible people take backups of things before they screw them.

You have no idea how many times. ::)

Lainaa
And they play around on test sites, not on the main theme of a live forum.

She has a clone we set up last year, still drifts back to main site. (https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.thekrashsite.com%2Fpics%2Fidk.gif&hash=9ac7acf13f4cfaa1b58390444a38dea11e5473d2)

Otsikko: Re: Admin $txt[] strings
Kirjoitti: Antechinus - maaliskuu 09, 2020, 04:27:13 IP
Lainaus käyttäjältä: Sir Osis of Liver - maaliskuu 09, 2020, 12:32:16 IPShe has a clone we set up last year, still drifts back to main site. (https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.thekrashsite.com%2Fpics%2Fidk.gif&hash=9ac7acf13f4cfaa1b58390444a38dea11e5473d2)

Probably because she's not a hard core code junkie, and the main site has more sense of community than an isolated test site. I suspect she likes the social aspect of it.

Get her to install a browser extension:
https://addons.mozilla.org/en-US/firefox/addon/styl-us/
https://addons.opera.com/en/extensions/details/stylus/

Then she can screw around with that all she likes, without borking things for anyone else. If she comes up with some good ideas, they can be incorporated in the site's code once they work.

If she's too stubborn or masochistic to do that, just accept it's her own damned fault and charge her ruthlessly. :P
Otsikko: Re: Admin $txt[] strings
Kirjoitti: Sir Osis of Liver - maaliskuu 10, 2020, 12:21:20 AP
Eh, don't charge her anything.  Nice lady, nice forum, and primary theme is one of the prettier ones I've done (here (https://ebook-mecca.com/)), but she likes to play with other themes.  Keeps me busy.

Will take a look at that FF addon.
Otsikko: Re: Admin $txt[] strings
Kirjoitti: Antechinus - maaliskuu 10, 2020, 01:08:44 AP
Ok. Re the primary theme, a suggestion for your background image.

body {
    background: url(https://ebook-mecca.com/Themes/mobile-desktop/images/sunset.jpg) 50% 0 fixed;
    background-size: cover;
    font: 78%/130% Comic Sans MS;}


That way it will sort itself out for everyone's screen. Give it a go and check out the difference. :)
Otsikko: Re: Admin $txt[] strings
Kirjoitti: Sir Osis of Liver - maaliskuu 10, 2020, 01:16:53 AP
Will try that.  I had tinkered with it a bit, but she was trying different images at the time so left it as is.

Looks familiar.  It stretches the bg image and it's distorted in pc view.
Otsikko: Re: Admin $txt[] strings
Kirjoitti: Antechinus - maaliskuu 10, 2020, 02:08:09 AP
No, it's not distorted at all. It's simply scaled so it matches the actual proportions of the image, but will cover the entire screen. IOW, on narrow screens some of the image will be hidden at the left and right, but the visible centre section will not be distorted.

IMO this looks better than having the image repeat down the page, which looks daggy, and it beats having the image not covering the whole width of the screen (which looks daggy too).
Otsikko: Re: Admin $txt[] strings
Kirjoitti: Sir Osis of Liver - maaliskuu 10, 2020, 04:53:12 IP
We had tried that, didn't like it.  Whatever it does to the bg image it looks distorted in pc view.  I don't use a phone, but she says it looks fine as is, and looks ok to me in FF mobile emulations (which I know are not 100% reliable).
Otsikko: Re: Admin $txt[] strings
Kirjoitti: Antechinus - maaliskuu 10, 2020, 05:14:25 IP
Here's how your code looks on my monitor.
Otsikko: Re: Admin $txt[] strings
Kirjoitti: Sir Osis of Liver - maaliskuu 10, 2020, 05:36:26 IP
Should look like this on pc -
Otsikko: Re: Admin $txt[] strings
Kirjoitti: Antechinus - maaliskuu 10, 2020, 05:58:33 IP
ROFL. Well it doesn't, as I just pointed out. :D

You're apparently only testing on screens which are smaller than the actual image. The image is 1900 wide by 1068 high. My monitor is 2560 wide by 1440 high. If you use background-size: cover; instead it will do what it says on the tin: it will cover the entire viewport area.

Your call though. No skin off my nose. :)
Otsikko: Re: Admin $txt[] strings
Kirjoitti: Sir Osis of Liver - maaliskuu 10, 2020, 06:05:02 IP
The reason we didn't use cover is because it stretches the image horizontally and looks awful if display size is smaller than image size.  It doesn't fit it to display width.
Otsikko: Re: Admin $txt[] strings
Kirjoitti: Antechinus - maaliskuu 10, 2020, 06:57:53 IP
No, it doesn't fit to display width on all screens, but cover does look a lot less awful than what you currently have if the viewport width is over 1900px and/or the viewport height is over 1068.

It does not stretch the image horizontally either. As I mentioned previously, what it does is scale the image equally on the x and y axes, so that the resulting size is sufficient to cover the viewport. Image proportions stay exactly the same. A circle on the original image will still be a circle on the scaled image.

By the way, no background image will display fully on a narrow screen anyway even if you don't use cover. Background images are automatically clipped at the borders of the relevant element if they are larger than that element, so on any viewport narrower than 1900 your image is already being partially hidden.

If you're not prepared to use cover on your monitor, the best option would be to add a media query for larger screens.

@media screen and (min-width: 1900px), screen and (min-height: 1068px) {
body {
    background: url(https://ebook-mecca.com/Themes/mobile-desktop/images/sunset.jpg) 50% 0 fixed;
    background-size: cover;
}
}


That way you see what you're used to, and if anyone rocks up with a larger monitor they'll see something decent too. And if you want the image positioned at the right instead of centered obviously you could use this instead:

@media screen and (min-width: 1900px), screen and (min-height: 1068px) {
body {
    background: url(https://ebook-mecca.com/Themes/mobile-desktop/images/sunset.jpg) 100% 0 fixed;
    background-size: cover;
}
}

Otsikko: Re: Admin $txt[] strings
Kirjoitti: Sir Osis of Liver - maaliskuu 10, 2020, 07:17:21 IP
I put in the first one, should look ok on your monitor.  Problem with this is I can only view a theme on my 23" 1280x720 monitor, a 7" tab, and various FF emulations.  You may be able to visualize the css on different size displays without seeing them, but I have to see it to work with it.  If it ain't broke I can't fix it.
Otsikko: Re: Admin $txt[] strings
Kirjoitti: Antechinus - maaliskuu 10, 2020, 07:54:51 IP
Looks much better on my box. :)

You can always check this sort of thing by using a temporary image that is smaller than your screen. If you throw in something like a 1024x640 you'll be able to see what's going on with your 1280.
Otsikko: Re: Admin $txt[] strings
Kirjoitti: Sir Osis of Liver - maaliskuu 11, 2020, 12:34:54 IP
That's a keeper, it's a good general solution for a problem I can't see.