Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 03 Nov 2020, 05:10
Pitman's Avatar
Pitman Pitman is offline
 
Join Date: Dec 2001
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 03 Nov 2020 at 07:12 ---------------


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

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 03 Nov 2020, 07:54
lange's Avatar
lange lange is offline
 
Join Date: Apr 2003
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).


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

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
  #3  
Old 03 Nov 2020, 12:10
shka shka is offline
 
Join Date: Mar 2016
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


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

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 03 Nov 2020, 12:54
Pitman's Avatar
Pitman Pitman is offline
 
Join Date: Dec 2001
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


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

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 03 Nov 2020 at 13:05 ---------------

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 27 Nov 2020, 06:23
yilmaz's Avatar
yilmaz yilmaz is offline
 
Join Date: Sep 2004
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?

__________________
Donations always appreciated.
vByilmaz.com
vBulletin-forum.de
Nobody has a monopoly on vBulletin templates. Stay away from selfish, self-righteous and parasitic.
Reply With Quote
  #6  
Old 29 Nov 2020, 04:19
yilmaz's Avatar
yilmaz yilmaz is offline
 
Join Date: Sep 2004
Yilmaz - Channel Description Per Forum Page vB5
__________________
Donations always appreciated.
vByilmaz.com
vBulletin-forum.de
Nobody has a monopoly on vBulletin templates. Stay away from selfish, self-righteous and parasitic.
Reply With Quote
  #7  
Old 30 Nov 2020, 04:23
delicjous's Avatar
delicjous delicjous is offline
 
Join Date: Nov 2014
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:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

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...
__________________
vBulletin-Forum.de closed!
ⓒ by delicjous
Reply With Quote
  #8  
Old 30 Nov 2020, 07:06
Pitman's Avatar
Pitman Pitman is offline
 
Join Date: Dec 2001
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...


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

--------------- Added 30 Nov 2020 at 07:19 ---------------

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 30 Nov 2020, 07:51
delicjous's Avatar
delicjous delicjous is offline
 
Join Date: Nov 2014
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...


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

--------------- Added 30 Nov 2020 at 07:19 ---------------

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.
__________________
vBulletin-Forum.de closed!
ⓒ by delicjous
Reply With Quote
  #10  
Old 30 Nov 2020, 08:02
Pitman's Avatar
Pitman Pitman is offline
 
Join Date: Dec 2001
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
  #11  
Old 30 Nov 2020, 08:10
delicjous's Avatar
delicjous delicjous is offline
 
Join Date: Nov 2014
Some links might helpful for you:

https://forum.vbulletin.com/blogs/wayne-luke/3929999-

https://forum.vbulletin.com/forum/vb...template-hooks

https://forum.vbulletin.com/blogs/joe-d/3932614-

https://www.vbulletin.com/docs/html/...emplate_syntax

And like I wrote before ... you have the ability to show the hook places directly on viewing your page. there are options for that in settings -> options -> plugins
__________________
vBulletin-Forum.de closed!
ⓒ by delicjous

Last edited by delicjous; 30 Nov 2020 at 08:16.
Reply With Quote
  #12  
Old 30 Nov 2020, 15:36
yilmaz's Avatar
yilmaz yilmaz is offline
 
Join Date: Sep 2004
This mode shows the meta description to the right of the logo in the header

Meta Description in Header
__________________
Donations always appreciated.
vByilmaz.com
vBulletin-forum.de
Nobody has a monopoly on vBulletin templates. Stay away from selfish, self-righteous and parasitic.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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


New To Site? Need Help?

All times are GMT. The time now is 16:04.

Layout Options | Width: Wide Color: