Jump to content

[RESOLVED] samo basic php question


GaVrA

Recommended Posts

Ok i have this:

 

		else
	{
		if ( $this->ipsclass->member['new_msg'] == 1 )	
		{
			$msg_data['TEXT'] = sprintf( $this->ipsclass->lang['msg_new1'], $this->ipsclass->member['new_msg'] );
		}
		else if ( $this->ipsclass->member['new_msg'] > 0 )
		{
			$msg_data['TEXT'] = sprintf( $this->ipsclass->lang['msg_new_more'], $this->ipsclass->member['new_msg'] );
		}
		else
		{
			$msg_data['TEXT'] = sprintf( $this->ipsclass->lang['msg_new'], $this->ipsclass->member['new_msg'] );
		}
	}

 

 

If user have 1 new message first statment goes to work, 2nd for any number else then 0, and 3rd just tell's it 0 new messages.

 

Sooo couse my language is complicated, i need it to be like this:

 

  1. if # of new messages = 1 -> 1 nova poruka($this->ipsclass->lang['msg_new1'])
  2. if # of new messages = 2 or 3 or 4 -> 2 or 3 or 4 nove poruke($this->ipsclass->lang['msg_new_more2'])
  3. if # of new messages 5 or >5 -> 5 novih poruka ($this->ipsclass->lang['msg_new_more3'])

 

 

So i know i am noob, and maybe there is symplier way to write it but would this work:

 

		else
	{
		if ( $this->ipsclass->member['new_msg'] == 1 )	
		{
			$msg_data['TEXT'] = sprintf( $this->ipsclass->lang['msg_new1'], $this->ipsclass->member['new_msg'] );
		}
		else if ( $this->ipsclass->member['new_msg'] > 0 )
		{
			$msg_data['TEXT'] = sprintf( $this->ipsclass->lang['msg_new_more'], $this->ipsclass->member['new_msg'] );
		}
		else if ( $this->ipsclass->member['new_msg'] == 2 )
		{
			$msg_data['TEXT'] = sprintf( $this->ipsclass->lang['msg_new_more2'], $this->ipsclass->member['new_msg'] );
		}
		else if ( $this->ipsclass->member['new_msg'] == 3 )
		{
			$msg_data['TEXT'] = sprintf( $this->ipsclass->lang['msg_new_more2'], $this->ipsclass->member['new_msg'] );
		}
		else if ( $this->ipsclass->member['new_msg'] == 3 )
		{
			$msg_data['TEXT'] = sprintf( $this->ipsclass->lang['msg_new_more2'], $this->ipsclass->member['new_msg'] );
		}
		else if ( $this->ipsclass->member['new_msg'] == 5 )
		{
			$msg_data['TEXT'] = sprintf( $this->ipsclass->lang['msg_new_more3'], $this->ipsclass->member['new_msg'] );
		}
		else if ( $this->ipsclass->member['new_msg'] > 5 )
		{
			$msg_data['TEXT'] = sprintf( $this->ipsclass->lang['msg_new_more3'], $this->ipsclass->member['new_msg'] );
		}
		else
		{
			$msg_data['TEXT'] = sprintf( $this->ipsclass->lang['msg_new'], $this->ipsclass->member['new_msg'] );
		}
	}

Link to comment
Share on other sites


  • Management

lol :lol:

 

Here you go:

		else
	{
		if ( $this->ipsclass->member['new_msg'] == 1 )	
		{
			$msg_data['TEXT'] = sprintf( $this->ipsclass->lang['msg_new1'], $this->ipsclass->member['new_msg'] );
		}
		elseif ( $this->ipsclass->member['new_msg'] > 1 && $this->ipsclass->member['new_msg'] < 5 )
		{
			$msg_data['TEXT'] = sprintf( $this->ipsclass->lang['msg_new_more2'], $this->ipsclass->member['new_msg'] );
		}
		elseif ( $this->ipsclass->member['new_msg'] > 4 )
		{
			$msg_data['TEXT'] = sprintf( $this->ipsclass->lang['msg_new_more3'], $this->ipsclass->member['new_msg'] );
		}
		else
		{
			$msg_data['TEXT'] = sprintf( $this->ipsclass->lang['msg_new'], $this->ipsclass->member['new_msg'] );
		}
	}

Board Rules - Available Products - Need a Custom Work?

 

< Don't PM me for support, post in the forum or submit a ticket from the client area instead! >

Link to comment
Share on other sites


  • Management
lol :P

Yeah well, we are not all pro like you... :lol:

 

No, i was laughing for that :)

Sooo couse my language is complicated, i need it to be like this:

 

  1. if # of new messages = 1 -> 1 nova poruka($this->ipsclass->lang['msg_new1'])

  2. if # of new messages = 2 or 3 or 4 -> 2 or 3 or 4 nove poruke($this->ipsclass->lang['msg_new_more2'])

  3. if # of new messages 5 or >5 -> 5 novih poruka ($this->ipsclass->lang['msg_new_more3'])

Board Rules - Available Products - Need a Custom Work?

 

< Don't PM me for support, post in the forum or submit a ticket from the client area instead! >

Link to comment
Share on other sites


Like i said it's complicated to combine my language coretcly with web thingy's... :) This is just one of problems i have with that,

 

on english its:

 

 

1 member

 

2 member's

 

3 member's

 

etc

 

On my language its:

 

1 član

 

2-4 člana

 

5 članova

 

6 članova

 

etc... :lol:

 

But anyhow i hope edit on most parts that, and ill start with this for new messages... :P

Link to comment
Share on other sites


  • Management

The issue/request this topic was opened for has now been resolved. If you need further assistance, please open a new topic.

 

If this topic was closed prematurely, please contact me so I can re-open it. :lol:

 

 

Topic Closed

Board Rules - Available Products - Need a Custom Work?

 

< Don't PM me for support, post in the forum or submit a ticket from the client area instead! >

Link to comment
Share on other sites


Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.