Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+4 votes
990 views
in Q2A Core by
edited by
For better performace I bleive using the cache version is better:

in qa-include\qa-page.php

replace

$qa_content['script_rel']=array('qa-content/jquery-1.7.2.min.js')

with

$qa_content['script_rel']=array('http://code.jquery.com/jquery-latest.min.js')
Q2A version: 1.6.3 or 1.7
by
edited by
This is because the latest version may be incompatible with old version. jQuery values backward compatibility very much, but is not without exception. Therefore, it is risky generally to use jQuery unlike the version that Q2A guarantees.

Another reason (good point) to use local copy:
When CDN fell, we can display site without coming under influence.
by
Got it thanks
by
If you use google as your CDN, it's more likely that your website fails than google :P
by
what do you mean? you mean the website of many people who use google CDN fail? then where to cache it?

1 Answer

0 votes
by

I am using the jquery CDN by google with fallback to local jquery file, this is the code from my advanced theme:

        // override head_script() to insert jquery CDN script
        function head_script() {
            if (isset($this->content['script'])) {
                foreach ($this->content['script'] as $scriptline) {
                    // $this->output_raw($scriptline);
                    if( strpos($scriptline, 'jquery') === false ) {
                        $this->output_raw($scriptline);
                    }
                    else {
                        $this->output_raw('<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js" type="text/javascript"></script>   <script type="text/javascript">window.jQuery || document.write(\'<script src="./qa-content/jquery-1.7.2.min.js"><\/script>\')</script>');
                    }
                }
            }
        }

Maybe that helps.

by
What do you mean by advanced theme?
by
http://www.question2answer.org/themes.php#advanced

File: qa-theme\yourtheme\qa-theme.php
by
Thank you for the info
...