How to combine 2 language strings

Discussion forum for MOD Writers regarding MOD Development.
Locked
User avatar
dan1dyoung
Registered User
Posts: 35
Joined: Sun Jun 29, 2008 5:13 pm
Location: Royston, England
Contact:

How to combine 2 language strings

Post by dan1dyoung »

Hi,

In the template you can combine two language/variables like this:

Code: Select all

{L_TRACKER_NAV_TICKET}{TRACKER_TICKET_ID}
But how can you combine them in the php??

Code: Select all

'FORUM_NAME'   => $user->lang['TRACKER_NAV_TICKET'][$ticket_id],
Thanks

Dan
My phpBB Modifications & Tips are here: http://www.dysolutions.co.uk/phpbb
User avatar
RMcGirr83
Recognised Extension Developer
Posts: 21283
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: How to combine 2 language strings

Post by RMcGirr83 »

Code: Select all

'FORUM_NAME'   => $user->lang['TRACKER_NAV_TICKET'] .'[' . $ticket_id . ']',
Appreciate the extensions/mods/support then buy me a beer Image
In times of change, learners inherit the earth, while the learned find themselves beautifully equipped to deal with a world that no longer exists - Eric Hoffer
Former Modifications/Extensions Team Member | My extensions | My extensions are updated regularly on github
All requests for support via PM will be ignored
User avatar
Highway of Life
Former Team Member
Posts: 6048
Joined: Wed Feb 02, 2005 5:41 pm
Location: Seattle, WA
Name: David Lewis
Contact:

Re: How to combine 2 language strings

Post by Highway of Life »

Rich’s example will work, if you want brackets around your ticket id.

I believe you’re looking for something like this:

Code: Select all

'FORUM_NAME' => $user->lang['TRACKER_NAV_TICKET'] . $ticket_id, 
HTML template:

Code: Select all

{FORUM_NAME}
you can also use something like this:

Code: Select all

'FORUM_NAME' => sprintf($user->lang['TRACKER_NAV_TICKET'], $ticket_id),

// your TRACKER_NAV_TICKET lang variable would be:
'TRACKER_NAV_TICKET' => 'tracker ticket id: %d', 
And your HTML template contains the same variable as above.
The phpBB Weekly Podcast - Discussing the developments of phpBB4 and beyond.

New to phpBB3? Want to learn about programing?
Visit phpBB Academy at StarTrekGuide to learn how.
User avatar
dan1dyoung
Registered User
Posts: 35
Joined: Sun Jun 29, 2008 5:13 pm
Location: Royston, England
Contact:

Re: How to combine 2 language strings

Post by dan1dyoung »

Great,

Sorted, thanks guys.

Used:

Code: Select all

'FORUM_NAME'   => $user->lang['TRACKER_NAV_TICKET'] .$ticket_id,

Dan
My phpBB Modifications & Tips are here: http://www.dysolutions.co.uk/phpbb
Locked

Return to “[3.0.x] MOD Writers Discussion”