Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 08-04-2010, 12:59 PM
downloadsuk downloadsuk is offline
 
Join Date: Jul 2010
Location: China
Posts: 64
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Maybe this belongs in customisation, but I REALLY need an explanation

I am trying to modify my VB4 CMS / Forums main chrome

I have heavily modified the code. I found out I cannot take the user "toplinks" section outside of the "header" template, because for some reason the vboption.facebookconnect enabled boolean is only accessible there. If I take outside the template, the facebook button disappears.

I can't take the navbar outside of navbar template, because it won't show the CMS home tab.... again, its stuck inside there.

It seems the internal processes that actually generate the final templates for VB are so obfuscated and hidden that I cannot work out the processes. Anyway, I got this far. I have set up everything that is not VB4 variable dependent inside my navbar template.

I removed the {vb:raw header} line from GENERIC_SHELL and placed it in the right place , where I want it to appear inside the navbar, see code snippet below. Careful it's long

NAVBAR

Code:
<div class="above_body"> <!-- closing tag is in template this -->

<!-- DLUK CUSTOM COMBINED NAV HEADER BEGINS -->

<div  id="header" class="floatcontainer doc_header dLuk_customCombinedNavHeader_div_main">

<!-- DLUK MAINIMG BEGIN -->

   <div class="dLuk_customMainImg_div_container">
      <a id="dLuk_mainImg_a" name="top" href="../index.php{vb:raw session.sessionurl_q}" class="logo-image"><img id="dLuk_mainImg_img"src="../_imgs/_custom/dluk_head_slice_logo-01-a-07312010.png" alt="Downloads.co.uk | news, views and discussion" /></a>
   </div>

<!-- DLUK MAINIMG END -->

<!-- DLUK NEW CUSTOM NAV BAR BEGIN -->

<div class="dluk_customNavBar_div_containerNavbarAndSearch">

<!-- DLUK NAVBAR BEGIN -->
   
   <div id="navbar" class="dLuk_customNavbar_div_container navbar">
      <ul id="navtabs" class="navtabs floatcontainer<vb:if condition="$show['member'] AND $notifications_total"> notify</vb:if>">
         {vb:raw template_hook.navtab_start}
         <vb:if condition="!$vboptions['selectednavtab'] AND THIS_SCRIPT != 'search'">
	 <li class="selected">
            <a class="navtab" href="{vb:raw vboptions.forumhome}.php{vb:raw session.sessionurl_q}">{vb:rawphrase forum}</a>
	    <ul class="floatcontainer">
	    {vb:raw template_hook.navbar_start}
	    <vb:if condition="$show['searchbuttons']">
	      <vb:if condition="$show['member']">
	      <li><a href="search.php?{vb:raw session.sessionurl}do=getnew&amp;contenttype=vBForum_Post">{vb:rawphrase new_posts_nav}</a></li>
	      <vb:else />
	      <li><a href="search.php?{vb:raw session.sessionurl}do=getdaily&amp;contenttype=vBForum_Post">{vb:rawphrase todays_posts}</a></li>
	      </vb:if>
	     </vb:if>
	     {vb:raw template_hook.navbar_after_getnew}
	     <vb:if condition="$show['pmmainlink']">
	       <li><a href="private.php{vb:raw session.sessionurl_q}" rel="nofollow">{vb:rawphrase private_messages}</a></li>
	     </vb:if>
	     {vb:raw template_hook.navbar_after_pm}
		<li><a rel="help" href="faq.php{vb:raw session.sessionurl_q}" accesskey="5">{vb:rawphrase faq}</a></li>
	     {vb:raw template_hook.navbar_after_faq}
	        <li><a href="calendar.php{vb:raw session.sessionurl_q}">{vb:rawphrase calendar}</a></li>
	     {vb:raw template_hook.navbar_after_calendar}
             <vb:if condition="$show['communitylink']">
	        <li class="popupmenu">
		<a href="javascript://" class="popupctrl" accesskey="6">{vb:rawphrase community}</a>
		<ul class="popupbody popuphover">
							{vb:raw template_hook.navbar_community_menu_start}
							<vb:if condition="$show['quick_links_groups']">
								<li><a href="group.php{vb:raw session.sessionurl_q}">{vb:rawphrase social_groups}</a></li>
							</vb:if>
							<vb:if condition="$show['quick_links_albums']">
								<li><a href="album.php{vb:raw session.sessionurl_q}">{vb:rawphrase pictures_and_albums}</a></li>
							</vb:if>
							<vb:if condition="$bbuserinfo['userid']">
								<li><a href="profile.php?{vb:raw session.sessionurl}do=buddylist"><vb:if condition="$show['friends_and_contacts']">{vb:rawphrase contacts_and_friends}<vb:else />{vb:rawphrase contacts}</vb:if></a></li>
							</vb:if>
							<vb:if condition="$show['memberslist']">
								<li><a href="memberlist.php{vb:raw session.sessionurl_q}">{vb:rawphrase members_list}</a></li>
							</vb:if>
							{vb:raw template_hook.navbar_community_menu_end}
						</ul>
					</li>
					</vb:if>
					{vb:raw template_hook.navbar_after_community}
					<li class="popupmenu">
						<a href="javascript://" class="popupctrl">{vb:rawphrase forum_actions}</a>
						<ul class="popupbody popuphover">
							<li>
								<a href="forumdisplay.php?{vb:raw session.sessionurl}do=markread&amp;markreadhash={vb:raw bbuserinfo.securitytoken}">{vb:rawphrase mark_forums_read}</a>
							</li>
                                                        <vb:if condition="$show['member']">
							<li>
								<a href="profile.php?{vb:raw session.sessionurl}do=editoptions">{vb:rawphrase edit_options}</a>
							</li>
							<li>
								<a href="profile.php?{vb:raw session.sessionurl}do=editprofile">{vb:rawphrase edit_your_details}</a>
							</li>
							</vb:if>
						</ul>
					</li>
					<li class="popupmenu">
						<a href="javascript://" class="popupctrl" accesskey="3">{vb:rawphrase quick_links}</a>
						<ul class="popupbody popuphover">
							<vb:if condition="$show['member']">
								<li><a href="subscription.php{vb:raw session.sessionurl_q}" rel="nofollow">{vb:rawphrase subscribed_threads}</a></li>
								<li><a href="javascript://" onclick="window.open(getBaseUrl() + 'misc.php?{vb:raw session.sessionurl}do=buddylist&amp;focus=1','buddylist','statusbar=no,menubar=no,toolbar=no,scrollbars=yes,resizable=yes,width=250,height=300'); return false;">{vb:rawphrase open_contacts}</a></li>
							</vb:if>
							<vb:if condition="$vboptions['forumleaders']">
							<li><a href="showgroups.php{vb:raw session.sessionurl_q}" rel="nofollow">
		<vb:if condition="$vb_suite_installed">
			{vb:rawphrase view_site_leaders}
		<vb:else />
			{vb:rawphrase view_forum_leaders}
		</vb:if>
	</a></li>
							</vb:if>
							{vb:raw template_hook.navbar_quick_links_menu_pos1}
							{vb:raw template_hook.navbar_quick_links_menu_pos2}
							{vb:raw template_hook.navbar_quick_links_menu_pos3}
							<vb:if condition="$show['wollink']">
								<li><a href="online.php{vb:raw session.sessionurl_q}">{vb:rawphrase whos_online}</a></li>
							</vb:if>
							{vb:raw template_hook.navbar_quick_links_menu_pos4}
						</ul>
					</li>
					{vb:raw template_hook.navbar_end}
				</ul>

			</li>
		<vb:else />
			<li><a class="navtab" href="{vb:raw vboptions.forumhome}.php{vb:raw session.sessionurl_q}">{vb:rawphrase forum}</a></li>
		</vb:if>
		{vb:raw template_hook.navtab_middle}
		<vb:if condition="!$vboptions['selectednavtab'] AND THIS_SCRIPT == 'search'">
			<vb:if condition="$show['member']">
			<li  class="selected"><a class="navtab" href="search.php?{vb:raw session.sessionurl}do=getnew&amp;contenttype=vBForum_Post" accesskey="2">{vb:rawphrase getnew_tab}</a>
				<ul class="floatcontainer">
					<li><a href="search.php?{vb:raw session.sessionurl}do=getnew&amp;contenttype=vBForum_Post">{vb:rawphrase new_posts_nav}</a></li>
					<li><a href="search.php?{vb:raw session.sessionurl}do=getnew&amp;contenttype=vBForum_SocialGroupMessage">{vb:rawphrase new_group_messages_nav}</a></li>
					<li><a href="search.php?{vb:raw session.sessionurl}do=getnew&amp;contenttype=vBForum_Event">{vb:rawphrase new_events_nav}</a></li>
					{vb:raw template_hook.navbar_getnew_menu}
					<li><a href="forumdisplay.php?{vb:raw session.sessionurl}do=markread&amp;markreadhash={vb:raw bbuserinfo.securitytoken}">{vb:rawphrase mark_forums_read}</a></li>
				</ul>
			</li>
			<vb:else />
			<li  class="selected"><a class="navtab" href="search.php?{vb:raw session.sessionurl}do=getdaily&amp;contenttype=vBForum_Post" accesskey="2">{vb:rawphrase getnew_tab}</a>
				<ul class="floatcontainer">
					<li><a href="search.php?{vb:raw session.sessionurl}do=getdaily&amp;contenttype=vBForum_Post">{vb:rawphrase todays_posts}</a></li>
					<li><a href="search.php?{vb:raw session.sessionurl}do=getdaily&amp;contenttype=vBForum_SocialGroupMessage">{vb:rawphrase daily_group_message}</a></li>
					<li><a href="search.php?{vb:raw session.sessionurl}do=getdaily&amp;contenttype=vBForum_Event">{vb:rawphrase daily_events}</a></li>
					{vb:raw template_hook.navbar_getdaily_menu}
					<li><a href="forumdisplay.php?{vb:raw session.sessionurl}do=markread&amp;markreadhash={vb:raw bbuserinfo.securitytoken}">{vb:rawphrase mark_forums_read}</a></li>
				</ul>
			</li>
			</vb:if>
		<vb:elseif condition="$show['member']" />
			<li><a class="navtab" href="search.php?{vb:raw session.sessionurl}do=getnew&amp;contenttype=vBForum_Post" accesskey="2">{vb:rawphrase getnew_tab}</a></li>
		<vb:else />
			<li><a class="navtab" href="search.php?{vb:raw session.sessionurl}do=getdaily&amp;contenttype=vBForum_Post" accesskey="2">{vb:rawphrase getnew_tab}</a></li>
		</vb:if>
		{vb:raw template_hook.navtab_end}
	</ul>
   </div>

   <!-- DLUK CUSTOM NAVBAR END -->

<!-- DLUK CUSTOM SEARCH BEGIN -->
   
        <vb:if condition="$vboptions['enablesearches']">
            <div id="globalsearch" class="globalsearch dLuk_search_div_container">
            <ul class="navbar_advanced_search">
                <li><a href="search.php{vb:raw session.sessionurl_q}" accesskey="4">{vb:rawphrase advanced_search}</a></li>
            </ul>
            <form action="search.php?{vb:raw session.sessionurl}do=process" method="post" id="navbar_search" class="navbar_search">
                <vb:comment><input type="hidden" name="s" value="{vb:raw session.sessionurl}" /></vb:comment>
                <input type="hidden" name="securitytoken" value="{vb:raw bbuserinfo.securitytoken}" />
                <input type="hidden" name="do" value="process" />
   <span class="dluk_header_customnavsearch_span_container"
<span class="buttoncontainer"><span><input type="image" class="searchbutton" src="../_imgs/_custom/downloadsUK_srchDev_01a.<vb:if condition="(is_browser('ie') AND !is_browser('ie', 7) AND !is_browser('ie', 8))">gif<vb:else />png</vb:if>" name="submit" onclick="document.getElementById('navbar_search').submit;" tabindex="100"/></span></span>
                <span class="textboxcontainer"><span><input type="text" value="" name="query" class="textbox" tabindex="99"/></span></span>
   </span>                
            </form>
            </div>
        </vb:if>
   
    <!-- DLUK CUSTOM SEARCH END -->

</div>

{vb:raw header}

<div class="ad_global_header">
	{vb:raw ad_location.global_header1}
	{vb:raw ad_location.global_header2}
</div>

</div><!-- closing div for above_body -->

<div class="body_wrapper">
<div id="breadcrumb" class="breadcrumb">
	<ul class="floatcontainer">
		<li class="navbithome"><a href="index.php{vb:raw session.sessionurl_q}" accesskey="1"><img src="{vb:stylevar imgdir_misc}/navbit-home.png" alt="{vb:rawphrase home}" /></a></li>

		{vb:raw navbits.breadcrumb}
		{vb:raw navbits.lastelement}
	</ul>
	<hr />
</div>

{vb:raw ad_location.ad_navbar_below}
{vb:raw ad_location.global_below_navbar}

<vb:if condition="$show['notices'] AND THIS_SCRIPT != 'register'">
	<form action="profile.php?do=dismissnotice" method="post" id="notices" class="notices">
		<input type="hidden" name="do" value="dismissnotice" />
		<input type="hidden" name="s" value="{vb:raw session.sessionurl}" />
		<input type="hidden" name="securitytoken" value="{vb:raw bbuserinfo.securitytoken}" />
		<input type="hidden" id="dismiss_notice_hidden" name="dismiss_noticeid" value="" />
		<input type="hidden" name="url" value="{vb:raw return_link}" />
		<ol>
			{vb:raw notices}
		</ol>
	</form>
</vb:if>
But when the final code is generated, the HTML that is spits out makes the code from the header template (the top links code) appear above the navbar stuff, as if I had never removed header from GENERIC_SHELL and it had been called like normal, thus pulling the code and dumping it there. See HTML below

Code:
<div class="forum_disabled"><b>Alert:</b> The forums are currently turned off!</div>  <!-- DLUK CUSTOM CONTAINER USER BEGIN -->
 
<div class="dLuk_User_div_containerUser">

      <!-- DLUK CUSTOM USER BEGIN -->

    	<div id="toplinks" class="toplinks">
			
			<ul class="isuser">
				<li><a href="login.php?do=logout&amp;logouthash=1280930102-3e503a9144ab2e7348f7b35bd111c534d14de013" onclick="return log_out('Are you sure you want to log out?')">Log Out</a></li>
				
					<li><a href="usercp.php">Settings</a></li>
					<li><a href="member.php/1-dlukadmin">My Profile</a></li>
				
                    <li class="popupmenu nonotifications" id="nonotifications">
                        <a id="yui-gen2" class="popupctrl" href="usercp.php">Notifications</a>
                        <ul id="yui-gen1" class="popupbody">
                            <li>No new messages</li>
                            <li><a href="private.php">Inbox</a></li>
                        </ul>
                    </li>
				
		    <li class="welcomelink">Welcome, <a href="member.php/1-dlukadmin">dlukadmin</a></li>
				
                    <li id="fb_headerbox">

	<a id="fb_loginbtn" href="#"><img title="The Facebook Platform" src="images/misc/facebook_login.gif" alt="The Facebook Platform"></a>

</li>
 
                
			</ul>
            
			
			
		</div>
		
 		<!-- DLUK CUSTOM USER END -->

	</div>

   <!-- DLUK CUSTOM CONTAINER USER END -->




 
<div class="above_body"> <!-- closing tag is in template this -->

<!-- DLUK CUSTOM COMBINED NAV HEADER BEGINS -->

<div id="header" class="floatcontainer doc_header dLuk_customCombinedNavHeader_div_main">

<!-- DLUK MAINIMG BEGIN -->

   <div class="dLuk_customMainImg_div_container">
      <a id="dLuk_mainImg_a" name="top" href="../index.php" class="logo-image"><img title="Downloads.co.uk | news, views and discussion" id="dLuk_mainImg_img" src="../_imgs/_custom/dluk_head_slice_logo-01-a-07312010.png" alt="Downloads.co.uk | news, views and discussion"></a>
   </div>

<!-- DLUK MAINIMG END -->

<!-- DLUK NEW CUSTOM NAV BAR BEGIN -->

<div class="dluk_customNavBar_div_containerNavbarAndSearch">

<!-- DLUK NAVBAR BEGIN -->
   
   <div id="navbar" class="dLuk_customNavbar_div_container navbar">
      <ul id="navtabs" class="navtabs floatcontainer">
         
<li class="selected">
	
		<a class="navtab" href="../">News</a>
	
	<ul class="floatcontainer">
		
		
			
				<li><a href="../content.php/45-platform-windows">Windows</a></li>
			
				<li><a href="../content.php/11-platform-mac">Mac</a></li>
			
				<li><a href="../content.php/5-platform-linux">Linux</a></li>
			
				<li><a href="../content.php/2-platform-web">Web</a></li>
			
				<li><a href="../content.php/3-platform-mobile">Mobile</a></li>
			
		
		
	</ul>
</li>
 
         
			<li><a class="navtab" href="forum.php">Forum</a></li>
		
		
	<li><a class="navtab" href="blog.php">Blogs</a></li>
 
		
			<li><a class="navtab" href="search.php?do=getnew&amp;contenttype=vBForum_Post" accesskey="2">What's New?</a></li>
		
		
	</ul>
   </div>

   <!-- DLUK CUSTOM NAVBAR END -->

<!-- DLUK CUSTOM SEARCH BEGIN -->
   
        
            <div id="globalsearch" class="globalsearch dLuk_search_div_container">
            <ul class="navbar_advanced_search">
                <li><a href="search.php" accesskey="4">Advanced Search</a></li>
            </ul>
            <form action="search.php?do=process" method="post" id="navbar_search" class="navbar_search">
                
                <input name="securitytoken" value="1280930102-3e503a9144ab2e7348f7b35bd111c534d14de013" type="hidden">
                <input name="do" value="process" type="hidden">
   <span class="dluk_header_customnavsearch_span_container"><span class="buttoncontainer"><span><input class="searchbutton" src="../_imgs/_custom/downloadsUK_srchDev_01a.png" name="submit" onclick="document.getElementById('navbar_search').submit;" tabindex="100" type="image"></span></span>
                <span class="textboxcontainer"><span><input value="" name="query" class="textbox" tabindex="99" type="text"></span></span>
   </span>                
            </form>
            </div>
        
   
    <!-- DLUK CUSTOM SEARCH END -->

</div>



<div class="ad_global_header">
	 
	 
</div>

</div><!-- closing div for above_body -->
Can someone help me!?! this is driving me nuts. I can't work out if the template is generated elsewhere, or the parser sees the header call, but some how re-writes it at the top of the page?!

It's really driving me bonkers.

See my site here for the example of the code in action.
Reply With Quote
  #2  
Old 08-04-2010, 01:46 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You can move the facebook, or other variables, elsewhere. All you have to do is preregister the variable for use in the new template. Cellarius wrote a really good article that you may be interested in - [vB4] Rendering templates and registering variables - a short guide

I very much doubt you want to be modifying GENERIC_SHELL, because, well, it's generic and just not used on most any page you will be looking at. To find the template to modify, do this - vboptions > General Settings > Add Template Name in HTML Comments > set to Yes . Then go back to your page and view the source code and you will see the name of the template called around your part of the code. (Sometimes the template is the one mentioned at the very top of the page source.)
Reply With Quote
  #3  
Old 08-04-2010, 02:11 PM
downloadsuk downloadsuk is offline
 
Join Date: Jul 2010
Location: China
Posts: 64
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok thanks for pointing me in the right direction.

I can see how now (brown cow) I might be able to move the facebook variable and therefore move all the header stuff to the navbar, which might solve my problem.

If it does, then Lynne, you're a freaking genius. However, on the flip side, if I wanted to move the navbar to the header. How does that all work?

I mean, building the navbar, the "HOME" tab is built inside vbCMS_navbar_link, but then somehow dropped into the navbar template, as far as I can tell. But in the navbar template, it doesn't call that vbcms_navbar_link template anywhere. How does it get added to it!?!

The only place it seems to work is if the navbar is in the navbar template. What if I wanted to moved the navbar to say, the footer, for experiments sake? If you move it out of the navbar template (the navbar generating code, it "loses" the home tab?!). I'm not asking you to write my code Lynne, just give me a technical explanation and I can investigate further.

Your help is greatly appreciated.

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

Also, a second point. How would I register that facebook variable elsewhere?

It wouldn't be a custom variable, its a big old vbulletin variable. and I think the other template that gets called is dependent on it too.

Code:
$vboptions['enablefacebookconnect']
is the one?

I have read the guide, but it talks about rendering templates? Surely I don't need to render a template? just register that vbulletin variable elsewhere? but to register it, I need to access it's values, can I access them from my own code?!

If you catch my drift...
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 11:15 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.04506 seconds
  • Memory Usage 2,244KB
  • Queries Executed 13 (?)
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
  • (3)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (3)post_thanks_box
  • (3)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (3)post_thanks_postbit_info
  • (3)postbit
  • (3)postbit_onlinestatus
  • (3)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
  • 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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete