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-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
  #2  
Old 08-07-2012, 01:18 PM
final kaoss final kaoss is offline
 
Join Date: Apr 2006
Posts: 1,314
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What they mean by this is that the JS should be at the very bottom of the page. In otherwords in your footer at the very bottom. I suggest moving them to the bottom (footer, not the bottom of headinclude_bottom) and applying the async attribute.

Also you can try vb supercharged which should help a bit but can be buggy with some vbulletin mods. I myself haven't had an issue with it yet.
Quote:
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.
Reply With Quote
Благодарность от:
mathforum
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 09:55 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.03859 seconds
  • Memory Usage 2,211KB
  • 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
  • (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
  • (2)post_thanks_box
  • (1)post_thanks_box_bit
  • (2)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (2)post_thanks_postbit_info
  • (2)postbit
  • (2)postbit_onlinestatus
  • (2)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_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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete