cforms II User Forum

Registration is currently disabled.
Guest

FAQs

Login form protected by Login LockDown.


Lost password?
Advanced Search

— Forum Scope —

  

— Match —

   

— Forum Options —

    

Wildcard usage:
*  matches any number of characters    %  matches exactly one character

Minimum search word length is 4 characters - maximum search word length is 84 characters

Topic RSS
load file css where necessary
December 7, 2007
10:47 am
dam
Guest

Your URL: www.sdamy.com

  • The browser used: firefox
  • cforms version: 6.41
  • Your Wordpress version: 2.3

 The plugin cforms run correctly but It's possible load the file css only in the page where I put a contact forms to reduce bandwitch on the server web?

The files loaded on every pageg:

…/wp-content/plugins/contactforms/styling/cforms.css

…/wp-content/plugins/contactforms/styling/calendar.css 

…/wp-content/plugins/contactforms/js/cforms.js 

 total= 23kb

 

thanks 

December 7, 2007
6:42 pm
Oliver
Munich, Germany
Admin
Forum Posts: 6400
Member Since:
March 6, 2005
Offline

There is no elegant way of solving your requirement, since the header is being written far earlier than the content is being searched for possible forms. There is simply no way for the plugin to know beforehand…

However, you can certainly hard code an if(…) into cforms.php just before the stylesheets get added and check for your specific page, e.g. via $_SERVER[REQUEST_URI]

January 15, 2008
2:04 am
mxrider
Guest

What about if we have a seperate template page designed just for the the contact page? I know how to do this, but I'm having a bit of a hard time finding what part of the plugin adds the stylesheets and javascript to *all* the pages (into header.php I presume). If I can just find that, then I can add it manually to my conact page to prevent it from being loaded on all the other pages that don't use cforms. Thanks!

January 15, 2008
7:31 am
Oliver
Munich, Germany
Admin
Forum Posts: 6400
Member Since:
March 6, 2005
Offline

That won't help because even if you use a different page template, the header is still the same.

The easiest way would be to install a plugin (forgot what the name was) that allows you to run certain plugins only on certain pages of you blog, very easy to configure.

January 15, 2008
10:12 pm
mxrider
Guest

Good point, but I could just copy and paste the contents of the header file into the template. I know I would have to change the page every time I changed the header, but that would be practically never and I could live with that. I found the functions I need (cforms_style(); and cforms_insert();) but I haven't tried them on a template page yet. Thanks for the help, and great plugin. Very extensive.

January 21, 2008
6:24 am
Ben
Guest

Hey Oliver,

 I'm really interested in this plugin that you speak of….can you remember what it's called because i can't find it by searching through the wordpress plugins? is it WP-Cache?

my site would perform so much better with this plugin!

January 21, 2008
8:00 am
Oliver
Munich, Germany
Admin
Forum Posts: 6400
Member Since:
March 6, 2005
Offline

Nope, WP-Cache only *caches* your WP pages in a static format.

I've tried searching google but can't seem to find it anymore…I'll look more and if I find it, I'll post it here.

January 21, 2008
8:34 am
Ben
Guest

that would be GREATLY appreciated!

thanks 

January 21, 2008
8:05 pm
Oliver
Munich, Germany
Admin
Forum Posts: 6400
Member Since:
March 6, 2005
Offline

Ben said:

that would be GREATLY appreciated!

thanks 


I think I remember…something like "headspace" or so.

January 21, 2008
9:41 pm
ben
Guest

 yeh i found it here – http://urbangiraffe.com/plugins/headspace2/

 i'll try it out, thanks so much for the help Oliver! I'm surprised this plugin isn't more popular?

January 21, 2008
11:15 pm
ben
Guest

Well after trying out the plugin, it's actually harder than it sounded. You have to uninstall the plugin and then go to the pages that you want to use the plugin and choose to run the plugin…..sounds straight forward but it didn't work at all when i tried doing it.

 I've read in another forum that i should try putting a conditional statement in the cforms code like:

if ( is_page('contact') ) {
// load css and js
}
 would this work? and what exactly should the code be? 

 

January 21, 2008
11:24 pm
Oliver
Munich, Germany
Admin
Forum Posts: 6400
Member Since:
March 6, 2005
Offline

If you do it manually, like you described it, yes it will work.

Unfortuntely this can't be done by the plugin, since it can't know on which pages it will eventually be shown.

But I could think of a an configuration field in cforms that would allow you to enter all page IDs for which to load the cforms header…perhaps in the next release…

January 22, 2008
5:42 am
ben
Guest

Hey Oliver,

 Sorry to be such a noob, but where exactly should i put the code manually? i can't seem to find where i would put it in the cforms.php file?

January 22, 2008
7:29 am
Oliver
Munich, Germany
Admin
Forum Posts: 6400
Member Since:
March 6, 2005
Offline

I would simply wrap it around this line (at the bottom):

add_filter('wp_head', 'cforms_style');

e.g. (might want to include the next one too, while you're at it):

if( is_page('XXXXX') ){
add_filter('wp_head', 'cforms_style');
add_filter('the_content', 'cforms_insert',10);
}

 

January 23, 2008
5:48 am
ben
Guest

Hey Oliver,

cheers for the help….

tried doing it but couldn't get it working. I get it loading no script or css but then i couldn't get it loading on my contact page? i tried both:

 
if( is_page(’contact’) ){
add_filter(’wp_head’, ‘cforms_style’);
add_filter(’the_content’, ‘cforms_insert’,10);
}

&

if( is_page(’/contact’) ){
add_filter(’wp_head’, ‘cforms_style’);
add_filter(’the_content’, ‘cforms_insert’,10);
}

the testing url of my contact page is http://www.13thbeachboardriders.com/new/contact

 am i skipping something obvious?

Forum Timezone: Europe/Berlin

Most Users Ever Online: 959

Currently Online:
22 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

tracedef: 43

mores: 21

Gyrus: 20

frozenwaste: 18

asuffredini: 15

photoworks: 14

Member Stats:

Guest Posters: 3762

Members: 1463

Moderators: 3

Admins: 2

Forum Stats:

Groups: 1

Forums: 4

Topics: 5359

Posts: 18741

Newest Members: juredujmovic, dreamkeeper, rajattyagi, wrokaa, lukass

Moderators: Paul (421), cnymike (8), sonika (95)

Administrators: Oliver (6400), Nicky (3)