Go Back   vb.org Archive > vBulletin 5 Connect Discussion > vB5 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 11-03-2020, 04:10 AM
Pitman's Avatar
Pitman Pitman is offline
 
Join Date: Dec 2001
Posts: 99
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Dynamic Header per Forum/Page

I am wanting to dynamically change the header depending on what forum a user is viewing.

Can anyone help me get started with something like that?

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

Code:
<vb:if condition="$page['nodeid'] == 3">
Seems to work fine when looking at the specific forum id, but is there any way to pull the nodeid or forumid in the header template when viewing a thread/post within a certain forum?
Reply With Quote
  #2  
Old 11-03-2020, 06:54 AM
lange's Avatar
lange lange is offline
 
Join Date: Apr 2003
Location: Montreal (Canada)
Posts: 282
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

With vB 3.8.11, I am using conditionals with the following PHP module to dynamically change all page content including the header.

I am not a coder and I am not familiar with conditionals in vB5 Connect (it would be a good idea to have a list of conditionals under vB 5 Connect).

Code:
$safe_functions[] = 'rand';
You can see the dynamique change in action here (sorry it's in my first language):

https://www.youtube.com/watch?v=wShJ...=youtu.be&t=44
https://www.youtube.com/watch?v=wShJ...=youtu.be&t=60
https://www.youtube.com/watch?v=wShJ...youtu.be&t=124
https://www.youtube.com/watch?v=wShJ...youtu.be&t=180

Maybe a vB5 coder may help you more with this issue.
Reply With Quote
Благодарность от:
yilmaz
  #3  
Old 11-03-2020, 11:10 AM
shka shka is offline
 
Join Date: Mar 2016
Posts: 79
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Pitman View Post
Seems to work fine when looking at the specific forum id, but is there any way to pull the nodeid or forumid in the header template when viewing a thread/post within a certain forum?
As you wrote they are always inside. But you have to check if empty or not. Like line 31

Code:
	<vb:if condition="!empty($page['nodeid']) AND !empty($page['channelid'])">
Or do you mean how you get (in your example the "3") the list of nodeid's or channelid's to compare with? How do you want do manage this values? In admincp, as a value in settings/options? As a channel setting? As a fixed list? What is the 'dynamic content'?

Your post is too unspecific. (for me)
Reply With Quote
  #4  
Old 11-03-2020, 11:54 AM
Pitman's Avatar
Pitman Pitman is offline
 
Join Date: Dec 2001
Posts: 99
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by shka View Post
As you wrote they are always inside. But you have to check if empty or not. Like line 31

Code:
	<vb:if condition="!empty($page['nodeid']) AND !empty($page['channelid'])">
Or do you mean how you get (in your example the "3") the list of nodeid's or channelid's to compare with? How do you want do manage this values? In admincp, as a value in settings/options? As a channel setting? As a fixed list? What is the 'dynamic content'?

Your post is too unspecific. (for me)
Thanks for the response...

Basically, what I'm trying to do is display the forum title and a brief description (not the same exact description of the forum) within the header template of each forum\thread page.

For example... the header on this site: it has an image that says VBULLETIN.ORG then "The Official vBulletin Modifications Site." Doing what I'm trying to do here on this site, would change the image to the text "vB5 Programming Discussions" and then beneath it, a custom description of the forum this thread is in (instead of "Discuss anything related to programming for vBulletin 5.x series eg. PHP, MYSQL, XHTML, etc", something like "Programming modifications and customizations for vBulletin 5.x series" just for example).

I basically want to mimic the forum title\description text below the navigation bar inside of the header template, but use a secondary description for each forum\main page.

I hope that makes a little better sense.

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

Quote:
Originally Posted by shka View Post
How do you want do manage this values? In admincp, as a value in settings/options? As a channel setting? As a fixed list?
Honestly, in 4.x, I did this all inside the header template. I would, however, love to be able to add a secondary description field for each forum inside the admincp to be able to control this content easier, but that's not 100% necessary. I can use if\else conditions in the header template as I did previously... I don't intend to add\change forums very frequently.
Reply With Quote
  #5  
Old 11-27-2020, 05:23 AM
yilmaz's Avatar
yilmaz yilmaz is offline
 
Join Date: Sep 2004
Posts: 751
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Would you like to display the description of the forum in the place I marked as in the screenshot?





Or do you want to add a custom description to each forum, as in this screenshot?

Reply With Quote
  #6  
Old 11-29-2020, 03:19 AM
yilmaz's Avatar
yilmaz yilmaz is offline
 
Join Date: Sep 2004
Posts: 751
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

<a href="https://vborg.vbsupport.ru/showthread.php?t=328380" target="_blank">Yilmaz - Channel Description Per Forum Page vB5</a>
Reply With Quote
  #7  
Old 11-30-2020, 03:23 AM
delicjous's Avatar
delicjous delicjous is offline
 
Join Date: Nov 2014
Posts: 352
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Sorry just read your question...The last answer you got is not the best.

An addon could help, but there is also an easier way with less performance issues.

1. Create phrases for each channel you need a new description and name it

... whateveryouwant_1 -> this have to be whateveryouwant_channelnumber for each channel.

If you want a description in channel 3, 12 and 23 you need the templates
whateveryouwant_3, whateveryouwant_12, whateveryouwant_23

2. Create a template and hook it into the position you need. You could see hook positions when you activate the options in (options.php?do=options&dogroup=plugin) for admins only.

3. In the template you need the following code:

HTML Code:
<vb:if condition="in_array($page['channelid'], array(3,12,23)">
{vb:set dcdphrasename, 'whateveryouwant_'}
{vb:strcat dcdphrasename, {vb:raw page.channelid}}
{vb:phrase dcdphrasename}
</vb:if>
If that description should show at channelview only you need to replace the condition:
<vb:if condition="in_array($page['channelid'], array(3,12,23) AND $page['channelid'] == $page['nodeid']">

Thats it... (Not testet, but should work) ... (some hook-positions (eg header before notices) needs more code to look nice and clean!)

Everytime you need a new description you create a new phrase and paste the channelid into the array on that template. The array in the condition takes care the description only loads on pages you it it loaded. first two lines in condition build the phrasename and the third ffetches and display the phrase.


The reson I would not use an entire addon with a new content-editor for this, is the performance-loss each new addon or plugin means for your page. Phrases are cached and your admin do not need a new content-editor to use it. The addon set a new field to a databasetable and have to fetch this each time a user is view a channel-page, even there is no desription on it.... There is so much more...
Reply With Quote
  #8  
Old 11-30-2020, 06:06 AM
Pitman's Avatar
Pitman Pitman is offline
 
Join Date: Dec 2001
Posts: 99
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks delicjous, that actually sounds simple enough... I've been able to accomplish everything I've needed to do so far with editing the header template (and even the display_Forums_list template for a few other things)... however, now you've got me concerned about performance issues...

Would your suggestion use less resources than using something similar to...

HTML Code:
{vb:set headtitle, {vb:raw page.title}}
{vb:set headdesc, 'Default Extended Description'}

<vb:if condition="$page['channelid'] == 24">
{vb:set headtitle, 'Channel 24 Extended Title'}
{vb:set headdesc, 'Channel 24 Extended Description'}

<vb:elseif condition="$page['channelid'] == 18" />
{vb:set headtitle, 'Channel 18 Extended Title'}
{vb:set headdesc, 'Channel 18 Extended Description'}

<vb:elseif condition="$page['channelid'] == 16" />
{vb:set headtitle, 'Channel 16 Extended Title'}
{vb:set headdesc, 'Channel 16 Extended Description'}

................................

</vb:if>
HTML Code:
{vb:raw headtitle}
{vb:raw headdesc}
--------------- Added [DATE]1606724368[/DATE] at [TIME]1606724368[/TIME] ---------------

Although I'm not a coder or anything, it seems like to me if there could be an extra column added to the database table for each forum\channel (whatever) for a more descriptive title and description (not to mention breadcrumb title). It would be a lot easier for me to do what I need to do and possibly less resource intensive.
Reply With Quote
  #9  
Old 11-30-2020, 06:51 AM
delicjous's Avatar
delicjous delicjous is offline
 
Join Date: Nov 2014
Posts: 352
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Pitman View Post
Thanks delicjous, that actually sounds simple enough... I've been able to accomplish everything I've needed to do so far with editing the header template (and even the display_Forums_list template for a few other things)... however, now you've got me concerned about performance issues...

Would your suggestion use less resources than using something similar to...

HTML Code:
{vb:set headtitle, {vb:raw page.title}}
{vb:set headdesc, 'Default Extended Description'}

<vb:if condition="$page['channelid'] == 24">
{vb:set headtitle, 'Channel 24 Extended Title'}
{vb:set headdesc, 'Channel 24 Extended Description'}

<vb:elseif condition="$page['channelid'] == 18" />
{vb:set headtitle, 'Channel 18 Extended Title'}
{vb:set headdesc, 'Channel 18 Extended Description'}

<vb:elseif condition="$page['channelid'] == 16" />
{vb:set headtitle, 'Channel 16 Extended Title'}
{vb:set headdesc, 'Channel 16 Extended Description'}

................................

</vb:if>
HTML Code:
{vb:raw headtitle}
{vb:raw headdesc}
--------------- Added [DATE]1606724368[/DATE] at [TIME]1606724368[/TIME] ---------------

Although I'm not a coder or anything, it seems like to me if there could be an extra column added to the database table for each forum\channel (whatever) for a more descriptive title and description (not to mention breadcrumb title). It would be a lot easier for me to do what I need to do and possibly less resource intensive.
First you use multiple if statements, which could be done with only one if you use an array.
Each if-condition needs performance (not that much, but you should use one if you could)!

Second you should use template-hooks to show any of your custom-content. The templates try to merge all your custom-stuff on updates. If this fails you use the old core-template and that could break your page in worst case. Just search for hook in the header template and you could see the locations in the template.
Reply With Quote
  #10  
Old 11-30-2020, 07:02 AM
Pitman's Avatar
Pitman Pitman is offline
 
Join Date: Dec 2001
Posts: 99
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Honestly, I'm not too up-to-date on template hooks, but it looks like I could possibly use the hook "{vb:hook 'header_after_body_begin'}" for that. I'm still not sure what the best way to go about this would be.
Reply With Quote
Reply


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 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04278 seconds
  • Memory Usage 2,312KB
  • 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
  • (4)bbcode_code
  • (5)bbcode_html
  • (4)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
  • (1)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
  • (2)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_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
  • postbit_attachment
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete