Welcome, Guest. Please login or register.

Username: Password:
Pages: 1 2 [3] 4   Go Down

Author Topic: Website greetings  (Read 4710 times)

0 Members and 1 Guest are viewing this topic.

Lunarya

  • Lady BAMF Dragon
  • Trusted Member
  • Elder Dragon
  • *****
  • Offline Offline
  • Gender: Female
  • Posts: 1,275
  • Also known as Aurkae on other places...
    • My Deviantart
Re: Website greetings
« Reply #30 on: November 14, 2008, 10:37:56 PM »

USERNAME, do a barrel roll!

lol!!! that made me crack up
Logged
http://silver-wings1000.deviantart.com
"Getting rid of a delusion makes us wiser than getting hold of a truth." -Ludwig Borne
"Laziness breeds Stupidity" - Fallout 3

DragonofWar

  • Whelp
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 43
Re: Website greetings
« Reply #31 on: November 14, 2008, 11:43:53 PM »

USERNAME walks into a bar. Ouch!!
Logged

dragon81

  • Dragon
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 171
Re: Website greetings
« Reply #32 on: November 15, 2008, 12:15:59 AM »

Watch it you got one on your tail, USERNAME
Logged
"And so these [blind] men of Indostan, Disputed loud and long, Each in his own opinion, Exceeding stiff and strong, Through each was partly in the right, And all were in the wrong!" -excerpt from a poem by John Godfrey Saxe, about six blind men who each observed only a part of an elephant.

Aurelia

  • Administrator
  • Legendary Dragon
  • *****
  • Offline Offline
  • Gender: Female
  • Posts: 3,313
Re: Website greetings
« Reply #33 on: November 15, 2008, 08:19:12 AM »

Made you look! [username]
Logged
"Damn!  I want a shockey-monkey."

Saq

  • Legendary Dragon
  • *****
  • Offline Offline
  • Gender: Male
  • Posts: 2,531
Re: Website greetings
« Reply #34 on: November 15, 2008, 08:32:29 AM »

USERNAME, the cake is a lie!
Logged

dragon81

  • Dragon
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 171
Re: Website greetings
« Reply #35 on: November 15, 2008, 03:51:29 PM »

Use The Brake, USERNAME!
Logged
"And so these [blind] men of Indostan, Disputed loud and long, Each in his own opinion, Exceeding stiff and strong, Through each was partly in the right, And all were in the wrong!" -excerpt from a poem by John Godfrey Saxe, about six blind men who each observed only a part of an elephant.

dragon81

  • Dragon
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 171
Re: Website greetings
« Reply #36 on: November 15, 2008, 08:11:47 PM »

The matrix has you, USERNAME
Logged
"And so these [blind] men of Indostan, Disputed loud and long, Each in his own opinion, Exceeding stiff and strong, Through each was partly in the right, And all were in the wrong!" -excerpt from a poem by John Godfrey Saxe, about six blind men who each observed only a part of an elephant.

dragon81

  • Dragon
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 171
Re: Website greetings
« Reply #37 on: November 17, 2008, 08:04:39 PM »

You can't stop the rock, USERNAME



3 in a row  :dragon_surprised:
Logged
"And so these [blind] men of Indostan, Disputed loud and long, Each in his own opinion, Exceeding stiff and strong, Through each was partly in the right, And all were in the wrong!" -excerpt from a poem by John Godfrey Saxe, about six blind men who each observed only a part of an elephant.

huginkoprim

  • Trusted Member
  • Dragon
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 128
Re: Website greetings
« Reply #38 on: November 27, 2008, 07:16:04 PM »

USERNAME is that really you?
Logged

Selroth

  • 'Lil Imaginary Friend
  • Administrator
  • Legendary Dragon
  • *****
  • Offline Offline
  • Gender: Male
  • Posts: 3,606
    • Draconity.org
Re: Website greetings
« Reply #39 on: June 08, 2009, 07:16:40 AM »

Moar!!

And they all gotta end with the username.
Logged
Everything is built from imagination.

I love hearing from the community I maintain!  Feel free to send me a PM or look around my profile.

Rocangus

  • A less "fluffy" dragon
  • Legendary Dragon
  • *****
  • Offline Offline
  • Gender: Male
  • Posts: 6,895
  • Avatar by Defonthana
Re: Website greetings
« Reply #40 on: June 08, 2009, 10:33:47 AM »

Okay, I'll change Nekru's a bit: Do a barrel roll, USERNAME!
Logged

Dradolan

  • Gothic Dragon
  • Tagger
  • Legendary Dragon
  • *****
  • Offline Offline
  • Gender: Male
  • Posts: 2,637
  • ~Gothic Love~
Re: Website greetings
« Reply #41 on: June 08, 2009, 10:40:10 AM »

Oh, you bastard USERNAME

NO! BAD USERNAME! BAD!

Its over 9000 USERNAME!
Logged
My steamID is ~Grim~RoA EoS~ (or grimroaeos to make it easier)
I have Chronic Fatigue Syndrome (CFS)
"Death is not the greatest loss in life. The greatest loss is what dies inside us while we live." - Norman Cousins


Selroth

  • 'Lil Imaginary Friend
  • Administrator
  • Legendary Dragon
  • *****
  • Offline Offline
  • Gender: Male
  • Posts: 3,606
    • Draconity.org
Re: Website greetings
« Reply #42 on: June 08, 2009, 10:54:20 AM »

NO! BAD USERNAME! BAD!

Can't do that one.  USERNAME has to be the last thingy.  Unless I get un-lazy.
Logged
Everything is built from imagination.

I love hearing from the community I maintain!  Feel free to send me a PM or look around my profile.

32-bit int

  • Dragon
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 229
Re: Website greetings
« Reply #43 on: June 08, 2009, 10:55:17 AM »

I have reviewed the source code of what I assume is the extension being used to implement this feature, and I have noticed something I don't like;

Code: [Select]
  if(!empty($context['user']['is_logged']) && !empty($modSettings['cgdt_enable'])) {

   $context['greeting'] =  $greeting.', <strong>'.$context['user']['name'].'</strong>';

   }

  

   elseif(!empty($context['user']['is_logged']) && empty($modSettings['cgdt_enable'])) {

   $context['greeting'] =  $txt['hello_member_ndt'].', <strong>'.$context['user']['name'].'</strong>';

   }

  

   elseif(empty($context['user']['is_logged']) && !empty($modSettings['cgdt_enable'])) {

   $context['greeting'] =  $greeting.', <strong>'.$txt['guest'].'</strong>';

   }

  

   elseif(empty($context['user']['is_logged']) && empty($modSettings['cgdt_enable'])) {

   $context['greeting'] =  $txt['hello_guest'].', <strong>'.$txt['guest'].'</strong>';

   }


A chain of elseifs!  :shock: The last one is completely unnecessary, and in any case it should probably be written with if...else statements nested, not chained, i.e.:

Code: [Select]
if (!empty($context['user']['is_logged'])) {
   if (!empty($modSettings['cgdt_enable'])) {
      $context['greeting'] =  $greeting.', <strong>'.$context['user']['name'].'</strong>';
   }
   else { // empty($modSettings['cgdt_enable']) == true
      $context['greeting'] =  $txt['hello_member_ndt'].', <strong>'.$context['user']['name'].'</strong>';
   }
else { // empty($context['user']['is_logged']) == true
   if (!empty($modSettings['cgdt_enable'])) {
      $context['greeting'] =  $greeting.', <strong>'.$txt['guest'].'</strong>';
   }
   else { // empty($modSettings['cgdt_enable']) == true
      $context['greeting'] =  $txt['hello_guest'].', <strong>'.$txt['guest'].'</strong>';
   }
}

...because with a chain of three elseifs after an if, the number of control statements necessary to determine which of the four lines of code to run could be anywhere from one to four, while with the ifs nested two deep it's a constant two, and each of the two expressions is simpler, so the nested structure can (probably) always execute at least as quickly as the elseif chain, and definitely more quickly when greeting a guest.

Of course, on this site the amount of runtime wasted by that code is probably negligible, so it doesn't really matter too much, but I couldn't resist the urge to point it out.



I was wondering why the punctuation in those greetings was so bad, but the fact that custom text can only appear before the username explains it.

I don't think it would be difficult to modify the code to support greetings text after the username, in addition to before it. You could store the text to appear after the username in separate variables and just concatenate them (and the username) together, or have a single variable containing a certain string which is then replaced with the username, in Perl s/$USERNAME/$context{user}->{name}/ should do it, but I don't remember how to do substring substitution in PHP.



If you're out of ideas, you could always quote Shakespeare;

Is this a dagger which I see before me, $USERNAME
Come, let me clutch thee, $USERNAME
Wherefore art thou, $USERNAME
To be or not to be, $USERNAME
Logged
This sentence no verb.

Dradolan

  • Gothic Dragon
  • Tagger
  • Legendary Dragon
  • *****
  • Offline Offline
  • Gender: Male
  • Posts: 2,637
  • ~Gothic Love~
Re: Website greetings
« Reply #44 on: June 08, 2009, 10:57:45 AM »

Okay.

NO! BAD USERNAME
Logged
My steamID is ~Grim~RoA EoS~ (or grimroaeos to make it easier)
I have Chronic Fatigue Syndrome (CFS)
"Death is not the greatest loss in life. The greatest loss is what dies inside us while we live." - Norman Cousins


Pages: 1 2 [3] 4   Go Up
Tags: