Local or Remote Assets (jQuery, Bootstrap, etc) - Which do you prefer?

460 views
Skip to first unread message

Andrew

unread,
Feb 8, 2013, 11:11:44 AM2/8/13
to php-form-bu...@googlegroups.com
This post piggy backs off another - https://groups.google.com/forum/?fromgroups=#!topic/php-form-builder-class/xhFvpQXB0bI.

Which do you prefer (and why), hosting js/css assets locally or referencing them remotely from a CDN?  In PFBC, this specifically applies to jQuery, jQuery UI, and Bootstrap.  

The current version of PFBC serves up these assets remotely from ajax.googleapis.com and netdna.bootstrapcdn.com.  There's also a prevent property which can be passed as an array to the Form's configure method to prevent these assets from being readded if you're already referencing them in your site.

- Andrew

roberc

unread,
Feb 8, 2013, 11:28:05 AM2/8/13
to php-form-bu...@googlegroups.com
I vote for local resources.
> --
> You received this message because you are subscribed to the Google
> Groups "php-form-builder-class" group.
> To unsubscribe from this group and stop receiving emails from it,
> send an email to php-form-builder-...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out
> [1].
>
>
>
> Links:
> ------
> [1] https://groups.google.com/groups/opt_out

jdp

unread,
Feb 8, 2013, 3:44:48 PM2/8/13
to php-form-bu...@googlegroups.com


On Friday, February 8, 2013 11:11:44 AM UTC-5, Andrew wrote:
This post piggy backs off another - https://groups.google.com/forum/?fromgroups=#!topic/php-form-builder-class/xhFvpQXB0bI.

Andrew -- Thanks for the responding. I should have added more information to the email.

I have looked at the code and I saw that there were allowances for local access. That was the hint that resulted in this request.

I prefer to reference all assets locally. There are a few reasons for this: 1) Performance. I live in a rural area (30 miles from DC) and the only internet service provider is satellite based (hughes.net). It sucks. It is slow and there are timing issues. For example I often need to reload in order for the date selection fields to work properly. 2)  Control. I have absolutely no comfort with our complete reliance on what Google does with the software that PFBC relies on. It may seem unlikely that nothing would change to screw up PFBC but far more unlikley things have happened. 3) Access. My desktop is our development server. My satellite service in addition to being slow, is non-existent during heavy cloud cover, snow storms, etc. This hampers any testing or development work because the remote components are not available. In short, I simply want to ensure to the extent possible that our system is stable and that we have as much control over it as we can. As I mentioned, we use these PHP scripts for everything: invoicing, payroll, job tracking, etc.

The only reason I have sought help here is that I do not have adequate time to learn how to do this myself. Hell, I'm lucky I was able to cobble together our system in the first place. I am barely competent to write PHP code.

I want to pay someone to assist me in putting the necessary software on my development and production servers and make any necessary changes to PFBC itself or to provide instructions so I can do it myself.

I sincerely appreciate the work you have put into this class.

-Doug



Andrew

unread,
Feb 11, 2013, 11:49:51 PM2/11/13
to php-form-bu...@googlegroups.com
r606 - 612 (http://code.google.com/p/php-form-builder-class/source/list) have moved bootstrap, jquery, and jqueryui assets locally.  This will be included in the next version release, but you can pull down the source with svn checkout http://php-form-builder-class.googlecode.com/svn/trunk/ pfbc3.x-php5.3.

- Andrew

jdp

unread,
Mar 12, 2013, 7:24:34 PM3/12/13
to php-form-bu...@googlegroups.com
This information has been helpful. I have been working at this for two days now with only little success however. Passing array elements preventJQueryLoad => "true" and prevent JQueryUILoad => "true" appears to do what is needed. I do not know how to provide the location of the jquery and jqueryui libraries to PFBC.

 I had some success by referencing the local versions in function renderCSS. Everything worked but PFBC does not find the local copy of jquery-ui.css even if when I used the full pathname to /php-forms-builder-class/libs/jqueryui/1.8.1/themes/softness/jquery-ui.css   Note: I'm using v1.1.2 because it works well for us except for the google hosted resources.

Any advice on how to get PFBC to use only local resources would be greatly appreciated.

Cheers,

do...@danceads.com




On Friday, February 8, 2013 11:11:44 AM UTC-5, Andrew wrote:

TheSin

unread,
Mar 27, 2013, 3:18:09 PM3/27/13
to php-form-bu...@googlegroups.com
I'd also prefer local, but even better would be default to local but have a way to specify in the config, I not only use local but I use server global locals with apache includes.

e.g.: Notice the global stuff looks like a hardcoded local path but really /javascripts is in /usr/share/

<script src="/javascript/jquery/jquery.min.js" type="text/javascript"></script>
<script src="/javascript/jquery-mousewheel/jquery.mousewheel.js" type="text/javascript"></script>
<script src="/javascript/jquery-easing/jquery.easing.js" type="text/javascript"></script>
<script src="/javascript/jquery-fancybox/jquery.fancybox.js" type="text/javascript"></script>
<script src="http://localhost/~justin/insidearctic2/modules/system/js/loading.js" type="text/javascript"></script>
<script src="http://localhost/~justin/insidearctic2/modules/system/js/pageset.js" type="text/javascript"></script>

Be nice to be able to add it to the config like

/* Default form config */
$formConfig = array(
        'prevent'       => array(
                'bootstrap',
                'jQuery',
        ),
        'ResourcesPath' => SITE_URL . '/plugins',
        'errorView'     => new PFBC\ErrorView\Custom,
        'scripts'       => array(
                'jQuery' => '/javascript/jquery/jquery.min.js',
        ),
);

Of course this is just my opinion but I like to make things very user configurable :D
Reply all
Reply to author
Forward
0 new messages