vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Displaying Images in Profile Block instead of Text? (https://vborg.vbsupport.ru/showthread.php?t=220804)

gorentals 08-13-2009 03:34 PM

Displaying Images in Profile Block instead of Text?
 
Lets say I have 3 Custom Fields. Game1, Game 2, Game 3

And I want my members to enter codes for each of the 3 games.
Anyone know how to accomplish this?

Lynne 08-13-2009 04:01 PM

I think there is an article in the articles forums on how to add a block to the profile/member.php page. Have you looked there?

gorentals 08-13-2009 07:10 PM

THanks Lynne. I did find this https://vborg.vbsupport.ru/showthread.php?t=203775

I am able to create the fields, and the block, but I don't know the code on how to display images based on a field.

So lets say I have field 1: text (to be used as the alt text of graphic)

Then in profile Block I would like to display a graphic that represents Field 1.

Does this make sense to anyone?

Thanks for your time

HMBeaty 08-13-2009 07:18 PM

You can do it how I did mine and create an if conditional for each one by using a code like this...
HTML Code:

<if condition="$post[fieldxx]">
        <img src="$stylevar[imgdir_misc]/$post[fieldxx].gif" alt="" />
</if>

And change xx to your profile field number. You must also have the image named exactly how the profile field is written. For example, if you have an option that says "Marine Corps", you must name your image "Marine Corps.gif" or whatever extension you want to use (.gif, .png, etc.)

Hope that helps you out :)

Lynne 08-13-2009 08:42 PM

See if what Brooks posted is what you wanted. You may want to add something in where it says alt="". Like alt="$post[fieldxx]" ? It's hard to tell without actual examples of what you will have in the fields.

gorentals 08-13-2009 11:50 PM

Thank you guys for helping me out. Here is my code in the Memberinfo Template at the bottom: I am also on Vbulletin 3.8.3

<div id="sidebar_container">
<!-- sidebar -->
$template_hook[profile_right_first]
$blocks[stats_mini]
<!--new block-->
<!-- $id -->
<div id="$id" class="tborder content_block">
<h4 class="thead block_title">
<a href="#top" class="collapse_gadget" onclick="return toggle_collapse('$id')"><img id="collapseimg_$id" src="$stylevar[imgdir_button]/collapse_generic{$vbcollapse['collapseimg_'.$id]}.gif" alt="" border="0" /></a>
<a name="$id"></a>
<span class="block_name">Codes</span>
</h4>
<div class="block_content" id="collapseobj_$id" style="{$vbcollapse['collapseobj_'.$id]}"><div class="alt1 smallfont block_row block_footer">
<if condition="$post[field15]">
<img src="$stylevar[imgdir_misc]/$post[field15].png" alt="$post[field15]" />
</if>

</div></div>
</div>
<!-- / $id -->
<!--new block-->


$template_hook[profile_right_mini]
$blocks[friends_mini]
$blocks[youtube]
$blocks[albums]
$template_hook[profile_right_album]
$blocks[groups]
$blocks[visitors]
$template_hook[profile_right_last]
<!-- / sidebar -->
</div>

<!-- end usercss -->
</div>

$footer

</body>
</html>

Ok I can see the Codes Block, but nothing shows. I have a Field called mk and its field15. What is entered in that field is just numbers. Is my code wrong? thanks for any assistance.

Lynne 08-14-2009 12:10 AM

The code you wrote is looking for image files named 2322.png or 222.png or whatever-the-number-is.png. If you always want it to show mk.png, then you need to change $post[field15].png to mk.png

gorentals 08-14-2009 12:49 AM

Ok I changed the code. No matter what I have in Field15 the graphic never shows up in my codes block. Is there something wrong with my block code? The field is just a single text field. Logically it looks like it should display the image. I am at a loss as to why nothing displays.

HMBeaty 08-14-2009 01:36 AM

Quote:

Originally Posted by gorentals (Post 1866836)
Ok I can see the Codes Block, but nothing shows. I have a Field called mk and its field15. What is entered in that field is just number codes like... 2322-2222-2223-2322. I also created a file called mk.png to show as the graphic in the block. Is my code wrong? thanks for any assistance.

If you have 2322-2222-2223-2322 entered in the field, your image needs to be named 2322-2222-2223-2322.png or .gif or whatever

Lynne 08-14-2009 01:37 AM

I should have noticed... you can't use $post right there, it's should be $userinfo.

HMBeaty 08-14-2009 01:41 AM

AH! Yes! Since this is in the memberinfo templates, your code should be..

HTML Code:

<if condition="$userinfo[field15]">
<img src="$stylevar[imgdir_misc]/$userinfo[field15].png" alt="$userinfo[field15]" />
</if>


gorentals 08-14-2009 02:05 AM

Thank you Brooks and Lynne that was it!!! Kudos!

HMBeaty 08-14-2009 02:15 AM

Not a problem :)


All times are GMT. The time now is 04:54 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.02559 seconds
  • Memory Usage 1,739KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_html_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (13)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete