Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 General Discussions
  #41  
Old 12-19-2014, 09:20 PM
KGodel's Avatar
KGodel KGodel is offline
 
Join Date: May 2011
Location: Indiana
Posts: 332
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

So do I need to create a separate layout for these pages to basically have a static page widget in there?
Reply With Quote
  #42  
Old 01-01-2015, 09:48 PM
KGodel's Avatar
KGodel KGodel is offline
 
Join Date: May 2011
Location: Indiana
Posts: 332
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Back from the dead, I found this code in an old post on vb.com, but it doesn't seem to work. It should add the author's avatar to the templater and allow me to use it on the article and preview templates, however it is only showing my avatar, not the avatar of the article author. Note: this is only on previews. When I view an article itself, the correct avatar shows.

(Figured I'd use this thread since it is still relevant).

PHP Code:
require_once(DIR '/includes/functions_user.php');
$avatarurl fetch_avatar_url($view->authoridtrue);
if (
$avatarurl[0]) {
     
$avatarurl $avatarurl[0];
}
/* render template and register variables */
vB_Template::preRegister('vbcms_content_article_page',array('avatarurl' => $avatarurl));
vB_Template::preRegister('vbcms_content_article_preview',array('avatarurl' => $avatarurl)); 

And another question, I see that I can choose sections to display on a page, but there isn't an option to only show articles from a certain category within that section. Is this intended or am I using the wrong widget in the layout?

And one last question, the CMS preview tries to pull an image for the "preview" of the article, and then disables any images in the post from showing in it. Can I turn this off and allow the previews to show the images?
Reply With Quote
  #43  
Old 01-04-2015, 05:54 AM
KGodel's Avatar
KGodel KGodel is offline
 
Join Date: May 2011
Location: Indiana
Posts: 332
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Friendly bump. The most pertinent question is the code I provided for the avatar. ^^ Everything else can be worked around I suppose. ^^
Reply With Quote
  #44  
Old 01-04-2015, 11:34 AM
Dead Eddie's Avatar
Dead Eddie Dead Eddie is offline
 
Join Date: Apr 2004
Location: at Home...
Posts: 196
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What hook are you using?
Reply With Quote
  #45  
Old 01-04-2015, 04:34 PM
KGodel's Avatar
KGodel KGodel is offline
 
Join Date: May 2011
Location: Indiana
Posts: 332
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

vbcms_article_populate_end

I read somewhere this was the appropriate hook.
Reply With Quote
  #46  
Old 01-04-2015, 10:58 PM
Dead Eddie's Avatar
Dead Eddie Dead Eddie is offline
 
Join Date: Apr 2004
Location: at Home...
Posts: 196
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It seems to work correctly on my test install. Maybe another plugin is interfering?
Reply With Quote
  #47  
Old 01-04-2015, 11:03 PM
KGodel's Avatar
KGodel KGodel is offline
 
Join Date: May 2011
Location: Indiana
Posts: 332
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

On the previews it shows other people's avatars? It works for me, however only my avatar appears, even if I am not the author of the article.
Reply With Quote
  #48  
Old 01-04-2015, 11:20 PM
Dead Eddie's Avatar
Dead Eddie Dead Eddie is offline
 
Join Date: Apr 2004
Location: at Home...
Posts: 196
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Two authors:

string 'image.php?u=2&dateline=1420404720&type=th umb' (length=52)
string 'image.php?u=1&dateline=1420403212&type=th umb' (length=52)
string 'image.php?u=1&dateline=1420403212&type=th umb' (length=52)
string 'image.php?u=1&dateline=1420403212&type=th umb' (length=52)
string 'image.php?u=1&dateline=1420403212&type=th umb' (length=52)
string 'image.php?u=1&dateline=1420403212&type=th umb' (length=52)
string 'image.php?u=1&dateline=1420403212&type=th umb' (length=52)

--------------- Added [DATE]1420421196[/DATE] at [TIME]1420421196[/TIME] ---------------

I lied. Somehow it got changed going into the template.

--------------- Added [DATE]1420421442[/DATE] at [TIME]1420421442[/TIME] ---------------

This worked for me:

PHP Code:
require_once(DIR '/includes/functions_user.php');
$avatarurl fetch_avatar_url($view->authoridtrue);
if (
$avatarurl[0]) {
     
$avatarurl $avatarurl[0];
}
/* render template and register variables */

$view->avatarurl $avatarurl
Reply With Quote
  #49  
Old 01-05-2015, 12:46 AM
KGodel's Avatar
KGodel KGodel is offline
 
Join Date: May 2011
Location: Indiana
Posts: 332
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Will try.

Edit: it works, thanks. Could you explain why your change worked so I can know for future reference? My guess is that pre-registering only did the value of one thing and once that value was registered any change afterward will affect the variable?

Any help on the additional questions would be appreciated (from anyone). Thanks for the help!
Reply With Quote
  #50  
Old 01-05-2015, 11:59 AM
Dead Eddie's Avatar
Dead Eddie Dead Eddie is offline
 
Join Date: Apr 2004
Location: at Home...
Posts: 196
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by KGodel View Post
Could you explain why your change worked so I can know for future reference?
It's just the way the CMS works. If you're sending values to the template, the fastest, easiest, and best way to to do it is to add it to the view directly (the view is responsible for knowing everything about rendering output to the screen).

I didn't track your code back to see why the values were being changed, so I don't know why it wasn't working correctly.
Reply With Quote
Благодарность от:
KGodel
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 04:19 AM.


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.04290 seconds
  • Memory Usage 2,283KB
  • Queries Executed 14 (?)
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
  • (2)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (10)post_thanks_box
  • (1)post_thanks_box_bit
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (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_postinfo_query
  • fetch_postinfo
  • 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
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete