Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
  #1  
Old 05-06-2011, 04:20 PM
Mihalis Mihalis is offline
 
Join Date: Nov 2008
Posts: 51
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default vBulletin 4 article widget modification

Hello there,

I want to create an article widget and thought to ask some advice from you guys. I want a widget that will list articles from a preferred section. So far so good, i can use the default vBulletin 4 widget. But instead of having the poster's avatar images beside each thread listing, i want it to show the article's image.

Do you think something like that could be possible by changing the appropriate template? ... and how?

Thanx.
Reply With Quote
  #2  
Old 05-10-2011, 08:08 AM
Mihalis Mihalis is offline
 
Join Date: Nov 2008
Posts: 51
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Anybody who knows how to do this?
Reply With Quote
  #3  
Old 05-10-2011, 03:58 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You'd have to change more than just the template, you would probably have to change the widget code also because I would guess the article image is not in the query. Look in packages/vbcms/widgets/recentarticle.php
Reply With Quote
  #4  
Old 05-10-2011, 05:26 PM
Mihalis Mihalis is offline
 
Join Date: Nov 2008
Posts: 51
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you for your answer Lynne!

Although i think this is way beyond my coding knowledge, i will give it a shot and maybe understand what i must do.

Ok... so heres the part i find that refers to the avatar:

Code:
//get the avatar
				if (vB::$vbulletin->options['avatarenabled'])
				{
					$article['avatar'] = fetch_avatar_from_record($article);
				}

				$articles[$article['nodeid']]  = $article;
			}
I presume i must change this code to fetch the article image instead, if i get this right. Now my question is, how do i fetch the article image?
Reply With Quote
  #5  
Old 05-10-2011, 08:09 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Actually, you can just ignore the avatar stuff. I mean, who cares if they grab the avatar? What I'm talking about is the query to grab the articles and whether the previewimage is in the query. It actually looks like it is - look around line 308. So, right around where they get the article is where you would need to define the previewimage variables. You probably want to change the height/width there also.
Reply With Quote
  #6  
Old 05-11-2011, 11:21 AM
Mihalis Mihalis is offline
 
Join Date: Nov 2008
Posts: 51
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you for the answer Lynne.

Sorry but i don't get it. I mean ok the previewimage is in the query from what it looks like in line 308, if i get it right now. Nawww... i don't get it. I think this is way over my head for me to workaround.
Reply With Quote
  #7  
Old 05-11-2011, 03:28 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Did you try just modifyin gthe template to use it? I mean, it looks like it is already available via the query.

HTML Code:
<vb:if condition="$article['previewimage']">
<img alt="previewimage" src="{vb:raw article.previewimage}"  with="50" height="50" />
<vb:else />
show something else
</vb:if>
Reply With Quote
  #8  
Old 05-12-2011, 03:50 PM
Mihalis Mihalis is offline
 
Join Date: Nov 2008
Posts: 51
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I am going to try it and get back at you. Thank you!
Reply With Quote
  #9  
Old 05-12-2011, 05:25 PM
Mihalis Mihalis is offline
 
Join Date: Nov 2008
Posts: 51
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Worked like a charm! Yay!

Thank you so much Lynne!



PS. Haven't found how to change the icon size though yet. The "height" "width" combo in the code does not work with this widget. It's fixed on 30X30. Edit: found it... stylevar.
Attached Images
File Type: png Screen shot 2011-05-12 at 9.23.50 ?.?..png (40.3 KB, 0 views)
Reply With Quote
  #10  
Old 06-27-2011, 09:45 AM
Aramist Aramist is offline
 
Join Date: Apr 2006
Posts: 127
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

HI Mihalis...

Could u share the code with us?

I'm very interested in this widget modification..

Ty in advance.

Ara
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:02 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04595 seconds
  • Memory Usage 2,260KB
  • Queries Executed 12 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (1)bbcode_html
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (1)postbit_attachment
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • postbit_attachment
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete