CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • how to reduce the loading amount of online registration page?
Pages: [1]

Author Topic: how to reduce the loading amount of online registration page?  (Read 2448 times)

aeszq

  • I post occasionally
  • **
  • Posts: 53
  • Karma: 0
how to reduce the loading amount of online registration page?
June 22, 2009, 05:49:15 pm
Hi guys,

I have a drupal page which has a link of a civievent online registration page on it.
I noticed that it takes quite long time(30s) to load the online registration page (about 2MB).It caused by the huge size of js(most of them are jquery and dojo) files linked to the registration page. Is there anyway to reduce the loading amount?

The civievent register page is on another website, which means that it has different domain name from the drupal page.


Cheers,
Geoerge

desert_rider

  • Guest
Re: how to reduce the loading amount of online registration page?
June 24, 2009, 05:46:21 pm
Hey Geoerge,

I found the same thing - those JS files have a lot more in them than required for a simple event registration/contribution!

I haven't done this yet but I'm planning to in the next few days. The answer is to create a custom template for the pages you wish to reduce the loading for. That way you can decide what js to include. Or make your own.

The same question was posed here:
http://forum.civicrm.org/index.php/topic,5759.0.html

And there are lots of posts on these forums on how to customise the templates. This is a link to the CiviCRM documentation:
http://wiki.civicrm.org/confluence/display/CRMDOC/Customize+Built-in%2C+Profile%2C+Contribution+and+Event+Registration+Screens

Let me know how you go, I'll be doing the same soon.

Cheers,
matt

aeszq

  • I post occasionally
  • **
  • Posts: 53
  • Karma: 0
Re: how to reduce the loading amount of online registration page?
June 24, 2009, 09:07:27 pm
Thanks Matt. I'll let know how I go with the custom_template.

aeszq

  • I post occasionally
  • **
  • Posts: 53
  • Karma: 0
Re: how to reduce the loading amount of online registration page?
June 25, 2009, 06:25:53 pm
Hi Matt,

I think i made it. I'm using Drupal as CMS, so it's a little bit different from what ken did in Joomla.

Basically, You can remove some useless jquery files by customizing template /CRM/common/jquery.tpl.
For "event online register", only
<script type="text/javascript" src="{$config->resourceBase}packages/jquery/jquery.js"></script>
<script type="text/javascript">var cj = jQuery.noConflict(); $ = cj;</script>
are used by the page.
To remove dojo js files, you need to modify the civicrm.module file.

Because I only want these js files not to appear on "event register" page, so i added php code to see if it's the register page.
This maybe useful, what it does is check if the url requested match the patten
if ( preg_match("/\/civicrm\/event\/register\?id=[0-9]+&reset=1/",$_SERVER['REQUEST_URI']))
{.......}
Probably you will have better solution for this than mine.

Cheers,
George


 

yogibear

  • I post occasionally
  • **
  • Posts: 66
  • Karma: 0
    • Byron Yoga
  • CiviCRM version: 4.1
  • CMS version: 6.2
  • MySQL version: 5.0
  • PHP version: 5.2
Re: how to reduce the loading amount of online registration page?
August 31, 2009, 03:45:02 pm
Hi George, having same issue here, 20 seconds to load event info and sometimes 50 seconds to load event registration page. Dojo and commonwidgets seem to be making the page more than a megabyte of code.

I cant quite understand how to implement your suggestion, could you possibly describe exactly the changes to make please? (I'm not adept at coding yet :( ).

Thanks.

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: how to reduce the loading amount of online registration page?
August 31, 2009, 05:02:47 pm
you might want to tweak your apache config to:

1. use caching (mod_expires) for the js/html/css/images

2. use compression (mod_deflate) for all pages

doing the above 2 gives you a pretty significant speedup after the first page load. If you are not aware of the above, please do a search on the web server docs

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

ken

  • I live on this forum
  • *****
  • Posts: 916
  • Karma: 53
    • City Bible Forum
  • CiviCRM version: 4.6.3
  • CMS version: Drupal 7.36
  • MySQL version: 5.5.41
  • PHP version: 5.3.10
Re: how to reduce the loading amount of online registration page?
August 31, 2009, 07:04:58 pm
lobo,

Thanks for the suggestion. It's useful for repeat visits. But for lots of folks, visiting the event registration page is the first time they 'hit' CiviCRM, and it takes a long time for the page to load.

I use Joomla and I've adjusted my common/joomla.tpl to check the value of $config->userFrameworkFrontend to decide whether to suppress the JS (it's not needed by me on the front-end). I notice that this parameter is only set to a non-false value for the Joomla implementation, so this approach doesn't work for Drupal or Standalone.

Ken

yogibear

  • I post occasionally
  • **
  • Posts: 66
  • Karma: 0
    • Byron Yoga
  • CiviCRM version: 4.1
  • CMS version: 6.2
  • MySQL version: 5.0
  • PHP version: 5.2
Re: how to reduce the loading amount of online registration page?
September 01, 2009, 02:30:21 am
Thanks Lobo and Ken.

Ken that is exactly the problem and why I didn't notice it for so long because I did have those files in my browser cache and the pages load quickly, but if it is your first visit to the page it is very slow, to the point I think a lot of people will think the site has stopped responding and move on. I know if I go to a site and it takes 20 or more seconds to get a page I move on.
A slightly unfortunate part of the page load delay is that the browser displays a completely blank white screen while the dojo script is being pulled down by the browser, as opposed to either some of the old page or some of the new page still being visible while the code is downloading, but a totally white page is another cause of uncertainty for the end user in my opinion.

If I could get some tips about how to selectively exclude dojo from pages that would be greatly appreciated.

I am wondering though if these are scattered incidents or if this fairly uniform behavior? I have php set 96mb of memory and Drupal is nice and quick...

yogibear

  • I post occasionally
  • **
  • Posts: 66
  • Karma: 0
    • Byron Yoga
  • CiviCRM version: 4.1
  • CMS version: 6.2
  • MySQL version: 5.0
  • PHP version: 5.2
Re: how to reduce the loading amount of online registration page?
September 17, 2009, 04:10:13 pm
(Note that this is applicable for CiviCRM Version 2.2.7)

If you are concerned about event info and event registration pages being very slow to load here is a workaround.

The basic issue (as Ken mentions here http://forum.civicrm.org/index.php/topic,5259.msg23184.html#msg23184 where he also supplies a Joomla workaround) is that some large javascript files (dojo) which are required for fancy calendar and other functions in the backend of CiviCRM (but not necessarily for all front end info or registration pages) are quite hefty to download the first time your browser encounters them.

Note that after the dojo files are in your browser cache you will have quick response times for those pages so you may not notice how slow the pages are. I would recommend checking your event info and registration pages with a clean browser cache (for Chrome this means manually deleting files, Chrome still held onto dojo js files after cleaning my cache) as this is what your visitors will have as far as your site is concerned.

If event info and registration pages take 30 to 50 (or even more) seconds to load I believe there is a strong possibility of lost opportunities as people will move on either thinking the site has stopped responding or just in frustration.

(Note: my event registration pages were doubly impacted by the dojo js files as I have Drupal secure pages module redirecting all "event/registration" URI's to HTTPS and then all the dojo files have to come down again, and this time even larger and slower as they are encrypted! Sloooow.

Page load times have gone from:

for HTTP - event/info - 17 seconds down to 5 seconds
for HTTPS - event/registration 30 seconds (or even as much as 60) down to 6 seconds

Enough yabbering, here is the code a friend made up.
(you can put whatever section of a url you want to exclude dojo files from loading in the "needle1" or "needle2" variables)

File to modify is Drupal's civicrm.module
(I did this on CiviCRM Version 2.2.7, this file is in the following location: sites/all/modules/civicrm/drupal/civicrm.module)

//    replace this original code at line 52-58   
//
//    include the below files ONLY if needed, since they are heavy weight ( i.e only for civicrm pages)
//    $includeCommon = false;
//    if ( arg(0) == 'civicrm' ) {
//        $includeCommon = true;
//    } else {
//        $config->includeDojo = 0;
//    }


With this

// begin workaround for excluding dojo from certain pages

   $haystack = ($_SERVER['REQUEST_URI']);
   $needle1   = "civicrm/event/info";
   $needle2   = "civicrm/event/register";
   $pos1 = strpos($haystack, $needle1);
   $pos2 = strpos($haystack, $needle2);
   if ($pos1 > 0 || $pos2 > 0) {
      // found it
      $includeCommon = false;
      $config->includeDojo = 0;
   } else {
      $includeCommon = true;
   }
   
// end workaround for excluding dojo from certain pages


I would think this will work for contribution and other pages as well
Maybe not ideal but it is a nice feeling when those pages load in a timely fashion

HTH’s someone.

Matt.   

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • how to reduce the loading amount of online registration page?

This forum was archived on 2017-11-26.