News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Where do I find: Total time logged in: X days X hours and X minutes string?

Started by Urbanite, September 24, 2009, 12:39:05 PM

Previous topic - Next topic

Urbanite

Im using the Google theme and now that I have logged on for more than 24 hours the days are showing, trouble is its wrapping onto the next line. It's just the way the theme is set out and it's not going to fit at that length.

Where do I find this so that I can abbreviate the text that shows from: "Total time logged in: X days, XX hours and XX minutes" to say just "Logged in: ....."?
Just when you finally get it idiot proof ...along comes a bigger idiot!

Taneon

The words "Total time logged in: " are in the language file index.english.php (by default) around the line 600.

Urbanite

Thanks Taneon, thats exactly where it is, ok so work this one out, I altered it, no change..... I renamed the index.english.php file so now it don't exist ... still no change  ::) I was expecting errors, not so much as an error.

So if its not using the default index.english at all and it don't have its own index.english in the theme... I'm stumped.

Ive even used Windows GREP to try and find the text within the Google theme files.... still nothing
Just when you finally get it idiot proof ...along comes a bigger idiot!

Taneon

Did you empty cache? Waited a minute or so?

You have to modify index.(your current language).php found in folder of the language your currently using.

But other than that i dont know what could be wrong.

I will post a BAD WORKAROUND for this particular proble. Just delete in template the part where it acces that language string and write " Logged in: ". Note that is consider extreamly bad practise to write text in template file itself and not in language string.

So, warning issued :P this is what you do:

Go into index.template.php of Google theme and find this part

Code (Find) Select

echo '
', $txt['totalTimeLogged1'];


and replace the entire thing with

Code (Replace) Select

echo ' Logged in: ';


Again, some better fix should be found. But its a working workaround :)

Tell me how it'll go, OK?

Urbanite

Yes the unethical fix worked perfectly, thanks!

OK now call me pernickety but how do I add a couple of spaces before the text 'Logged in:' appears? i.e. '   Logged in:'

It would help centralise the text in the space available.
Just when you finally get it idiot proof ...along comes a bigger idiot!

Taneon

Yup, thats the way. In the code i wrote above I already added a space before and after the text. So, just add spaces you need.

Know that this go then even further into unethical waters :P

Urbanite

This is why I'm askiing because no matter how many spaces I put in, it remains in the same place, and yes I'm emptying the cache every time.

In other words    echo '         Logged in: '; still ends uplooking like this on screen.

.....new replies to your posts. Logged in:  with only one space  ::)
Just when you finally get it idiot proof ...along comes a bigger idiot!

Urbanite

OK sorted it, had to do it like this

   echo '   Logged Time: ';


:)
Just when you finally get it idiot proof ...along comes a bigger idiot!

Urbanite

Hmmm its got me thinking, is this a clue as to why changing the string in index.English.php didn't work? as I am having to enter HTML code to make a space appear?

Maybe I'm wrong, but the original problem is there, albeit i worked around it.  ::)
Just when you finally get it idiot proof ...along comes a bigger idiot!

Tyrsson

Anytime you change a language file you need to do two things before checking the changes.

1) Clear the forum cache in the routine maintenance area of admincp.

2) Clear your browser cache.

ETA: Just caught that someone suggested that... Will look into this in a minute.
PM at your own risk, some I answer, if they are interesting, some I ignore.

Tyrsson

Quote from: Urbanite on September 27, 2009, 10:21:19 AM
OK sorted it, had to do it like this

   echo '   Logged Time: ';


:)
Yes do it this way. You shouldn't hardcode strings in the template files as it will cause problems with mod installs and uninstalls etc.
PM at your own risk, some I answer, if they are interesting, some I ignore.

Urbanite

Quote from: Tyrsson on September 27, 2009, 10:52:45 AM
Anytime you change a language file you need to do two things before checking the changes.

1) Clear the forum cache in the routine maintenance area of admincp.

2) Clear your browser cache.



YES!! ok problem solved, although I was clearing the browser cache what I wasn't doing was number (1) Clear the forum cache in the routine maintenance area of admincp.

Everything is as it should be and NO workaround! :D

Thanks Taneon & Tyrsson
Just when you finally get it idiot proof ...along comes a bigger idiot!

Taneon

lol sorry man, i need to learn to give more thorough instructions in the future. Should've been more specific about cache.

But its great this is working now and no bad workarounds :D

Tyrsson

PM at your own risk, some I answer, if they are interesting, some I ignore.

Advertisement: