1
Cuidiu
More Efficient Way to Code This?
  • 2006/10/1 23:22

  • Cuidiu

  • Quite a regular

  • Posts: 358

  • Since: 2006/4/23


Hi All,

I'd like to know if there's a more efficient way to do this. Here's what I want - at the top of the user profile page, next to the registered user's name "About John Doe" I'd like to pull something from the dynamic fields and display it there. Here's what I've done and it works but I'm sure there must be a better way to accomplish this.
Snippet from profile_userinfo.html XOOPS 2.2.4:
<{foreach item=category from=$categories name=catcount}>
   <{if isset(
$category.fields)}><table>
      <
tr><td><{$category.cat_title}>td>
<
td>[color=CC0000]<{foreach item=field from=$category.fields}><{if $field.value == '1'}>
<
strong>Special Text Herestrong><{/if}><{/foreach}>[/color]td>
  <{foreach 
item=field from=$category.fields}>
                    <
tr><td><{$field.value}>td>tr>

Is using foreach like that inefficient when I only need to pull from one field? Can I use the field name or id? It's a radio yes/no. I've experimented but nothing I've tried works other than the code above (not surprising since I'm a PHP newbie). I Would really appreciate some help from you PHP experts.

Cuidiu
[size=x-small]Working sites:
XOOPS 2.0.16 PHP 5.2.2, MySQL 5.0.24a-standard-log, Apache/2.0.54 (Unix)
XOOPS 2.2.4, PHP 4.3.10, MySQL 3.23.58, Apache/1.3.33 (Unix)[/size]

Login

Who's Online

408 user(s) are online (132 user(s) are browsing Support Forums)


Members: 0


Guests: 408


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Aug 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits