Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
  #1  
Old 08-05-2012, 11:08 PM
mathforum mathforum is offline
 
Join Date: Nov 2005
Posts: 165
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Forcing load order for header

Optimizing my site has been my biggest goal for a good while now and while at first I found lots of great info, I now see that this is almost impossible to fully accomplish. There seem to be inherent issues with vBulletin that analysis sites like webpagetest.org that cannot be fixed without significant recoding.

Just some basic info about my configuration:

1)All attachments, avatars and css should be stored as files outside the database
2)Not using a CDN yet
3)Have decently compressed all images related to my custom theme
4)Tried experimenting with rearranging headinclude template with no change for better or worse
5)All other settings should be aligned with standard optimal vb settings, but if I'll post more if more info is needed

I don't think I'd be allowed to paste the entire headinclude template so I'll leave out bits that can be referenced without code. Here's how it looks now.

PHP Code:
<meta http-equiv="Content-Type" content="text/html; charset={vb:stylevar charset}" />
<
meta id="e_vb_meta_bburl" name="vb_meta_bburl" content="{vb:raw vboptions.bburl}" />
<
base href="{vb:raw basepath}" /><!--[if IE]></base><![endif]-->
<
meta name="generator" content="vBulletin {vb:raw vboptions.templateversion}" />

<
link href='http://fonts.googleapis.com/css?family=Passion+One' rel='stylesheet' type='text/css'/>
<
link href='http://fonts.googleapis.com/css?family=Wellfleet' rel='stylesheet' type='text/css'/>
<
link href='http://fonts.googleapis.com/css?family=Francois+One' rel='stylesheet' type='text/css'/>


<
vb:if condition="$stylevar['favicon']">
    <
link rel="Shortcut Icon" href="{vb:stylevar favicon}" type="image/x-icon" />
</
vb:if>
<
vb:if condition="$show['threadinfo']">

<
vb:elseif condition="$show['foruminfo']" />
        <
meta name="keywords" content="{vb:raw foruminfo.title_clean}, {vb:raw vboptions.keywords}" />
        <
meta name="description" content="<vb:if condition="$pagenumber 1">{vb:rawphrase page_x, {vb:raw pagenumber}}-</vb:if>{vb:raw foruminfo.description_clean}" />
<
vb:else />
        <
meta name="keywords" content="{vb:raw vboptions.keywords}" />
        <
meta name="description" content="{vb:raw vboptions.description}" />
</
vb:if>

<
vb:if condition="$show['fb_opengraph']">
    {
vb:raw facebook_opengraph}
</
vb:if>

[
YUI JAVASCRIPT CODE HERE]

<
script type="text/javascript" src="{vb:raw vboptions.bburl}/clientscript/vbulletin-core.js?v={vb:raw vboptions.simpleversion}"></script>
{
vb:raw template_hook.headinclude_javascript}

<
vb:if condition="$vboptions['externalrss']">
    <
link rel="alternate" type="application/rss+xml" title="{vb:raw vboptions.bbtitle} {vb:rawphrase rss_feed}" href="{vb:raw vboptions.bburl}/external.php?type=RSS2" />
    <
vb:if condition="$show['foruminfo'] OR $show['threadinfo']">
        <
link rel="alternate" type="application/rss+xml" title="{vb:raw vboptions.bbtitle} - {vb:raw foruminfo.title_clean} - {vb:rawphrase rss_feed}" href="{vb:raw vboptions.bburl}/external.php?type=RSS2&amp;forumids={vb:raw foruminfo.forumid}" />
    </
vb:if>
</
vb:if>

<
vb:if condition="$vboptions['storecssasfile']">
    {
vb:cssfile main-rollup.css}
        {
vb:raw template_hook.custom_css_links}
<
vb:else />
    {
vb:cssfile bbcode.css,editor.css,popupmenu.css,reset-fonts.css,vbulletin.css,vbulletin-chrome.css,vbulletin-formcontrols.css{vb:raw template_hook.custom_css_list}}
</
vb:if>
    <!--[if 
lt IE 8]>
    {
vb:cssfile popupmenu-ie.css,vbulletin-ie.css,vbulletin-chrome-ie.css,vbulletin-formcontrols-ie.css,editor-ie.css}
    <![endif]-->
{
vb:raw template_hook.headinclude_css
1) I think that the three inline CSS links should be added to additional.css if possible but I don't know how to do that.

2) I have a JS file that must be run on every page to render math equations, however I read that JS should be handled last since it stops the loading of other elements. For that reason I put it in the headinclude_bottom template, which looks like this for me now. Then hasn't changed the order in which things load.

PHP Code:
{vb:cssfile additional.css}
{
vb:raw template_hook.headinclude_bottom_css}

<
script type="text/x-mathjax-config">
  
MathJax.Hub.Config({
    
extensions: ["tex2jax.js"],
    
jax: ["input/TeX""output/HTML-CSS"],
    
tex2jax: {
       
inlineMath: [ ['$','$'], ['\\(','\\)'] ],
      
processEscapestrue
    
}
  });
</
script>
<
script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>

<
script type="text/javascript" src="mobiquo/tapatalkdetect.js">
</
script
There are over 100 header requests to load my home page and it often goes back and forth between javascript and css, which isn't ideal. Has anyone had success with smoother loading? I've seen references to minimizing this and that, combining files, delaying javascript execution and lots of other things but really no decent explanations for them.

Any help or comment is greatly appreciated and I plan on improving upon some of the optimization articles here already since they've helped me a lot but are missing pieces!

Thank you.
Reply With Quote
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 03:52 AM.


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.03039 seconds
  • Memory Usage 2,254KB
  • Queries Executed 11 (?)
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
  • (2)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)showthread_list
  • (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_threadedmode.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids_threaded
  • showthread_threaded_construct_link
  • 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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete