We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

How Do you Concatenate Two Fields into a Single Uninterrupted String in Expression Engines?

Development and Programming

Hoopsgal's avatar
Hoopsgal
181 posts
16 years ago
Hoopsgal's avatar Hoopsgal

I am trying to display the results of two fields in a single uninterrupted string. In one field (using the entry date calendar) I have the time of a game, in the second string I have the time zone (e.g., EDT, etc.) since these are going to be different than my time zone when I created the entry.

If I do it as a table with the two fields in a row, then because of the size of the cells in the second column elsewhere in the table, the second field (with the time zone) prints out too far away from the first (the time of the game) to read nicely on the page. E.g.,

<tr>
                           <th>Game Time:</th><td>{game_date format="%g:%i%A"} </td><td>{time_zone_primary}</td>
                              </tr>
                             {if game_time_local}<tr>
                                    <th>Local Game Time:</th><td>{game_time_local format="%g:%i%A"}</td>{if time_zone_local}<td>{time_zone_local}</td>{/if}
                              </tr>
                             {/if}[

gets you “3:00PM EDT”

I’ve tried using &,|, + and even the direction CONCAT, and all it does is add an extra simple to the result.

What’s weird (to me) is that elsewhere, I’ve been able to get other fields to display pretty much like I want it here. E.g.,

{title} - {game_date}

with the date format, gives me “Phoenix @ Los Angeles - Saturday, July 11, 2009” very easily, but when I try to do the same thing with the game time and timezone fields, it gives:

“3:00PM

EDT”

which just doesn’t do it for me.

Thanks

       
silenz's avatar
silenz
1,648 posts
16 years ago
silenz's avatar silenz

What format have you chosen for the timezone field? Looks like it’s xhtml so it gets wrapped in paragraph-tags.

       
Hoopsgal's avatar
Hoopsgal
181 posts
16 years ago
Hoopsgal's avatar Hoopsgal

If you were here, silenz, I would hug you! Can’t tell you how much time I’ve spent trying to gerrymander those doggoned time zones around. Now I might not even need the table.

Question: Should I leave the date field in HTML, since I may want to calculate off it, or select portions (such as just the date or just the time)? Or should I just set everything to “none” on formatting?

Thank you so much. Now I might not even need the table.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.