vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   vBulletin 4 article widget modification (https://vborg.vbsupport.ru/showthread.php?t=263254)

Mihalis 05-06-2011 04:20 PM

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.

Mihalis 05-10-2011 08:08 AM

Anybody who knows how to do this?

Lynne 05-10-2011 03:58 PM

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

Mihalis 05-10-2011 05:26 PM

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?

Lynne 05-10-2011 08:09 PM

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.

Mihalis 05-11-2011 11:21 AM

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.

Lynne 05-11-2011 03:28 PM

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>


Mihalis 05-12-2011 03:50 PM

I am going to try it and get back at you. Thank you!

Mihalis 05-12-2011 05:25 PM

1 Attachment(s)
Worked like a charm! Yay!

Thank you so much Lynne!

https://vborg.vbsupport.ru/attachmen...1&d=1305224674

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.

Aramist 06-27-2011 09:45 AM

HI Mihalis...

Could u share the code with us?

I'm very interested in this widget modification..

Ty in advance.

Ara


All times are GMT. The time now is 03:10 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.01138 seconds
  • Memory Usage 1,731KB
  • 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
  • (1)bbcode_code_printable
  • (1)bbcode_html_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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