[cgiapp] CGI::Application + javascript + http server + icons
Hello, I have an instance script (app.cgi) and corresponding application module (App.pm) in *cgi-bin/*. For my application I also use HTML templates, located in *cgi-bin/Templates/*. One of templates (s01.html, for start mode) has lot of javascript in it, which I have isolated in a.js file, kept in *htdocs/ *(Apache server root) directory. In a.js javascript file I use some icons (various types of bullets), which are stored in *htdocs/app-images/* directory. I refer to *bullet.gif* file in js code as to *app_images/bullet.gif* When I am running my application, it does not see the image files. Firefox plugin shows that the following file is requested: * URL_base/cgi-bin/app-images/bullet.gif* I.e., my application sees *cgi-bin* instead of *htdocs*. I tried also other ways of referring to the image files in js code, such as: */app-images/bullet.gif*,* htdocs/app-images/bullet.gif*, but none of them worked. Putting the images under *cgi-bin* (bad idea by itself) didn't work also, as httpd server recognised the image files as scripts and tried to execute them. Any clue? Thanks in advance, Arsen. P.S. Inadvertently sent this e-mail to cgiapp-request, sorry. # CGI::Application community mailing list #### ## To unsubscribe, or change your message delivery options, ## ## visit: http://www.erlbaum.net/mailman/listinfo/cgiapp## #### ## Web archive: http://www.erlbaum.net/pipermail/cgiapp/ ## ## Wiki: http://cgiapp.erlbaum.net/ ## ####
Re: [cgiapp] CGI::Application + javascript + http server + icons
Arsen Hayrapetyan wrote: When I am running my application, it does not see the image files. Firefox plugin shows that the following file is requested: * URL_base/cgi-bin/app-images/bullet.gif* I.e., my application sees *cgi-bin* instead of *htdocs*. This is an apache configuration issue not really related to C::A. You might get more help on an apache specific mailing list. But just for kicks, what does you httpd.conf file look like? I tried also other ways of referring to the image files in js code, such as: */app-images/bullet.gif*,* htdocs/app-images/bullet.gif*, but none of them worked. If your document root is in htdocs/ then that's where all of your media assets belong (image files, css, js and .html). And you reference it without mentioning the document root using an absolute path (like /images/bullet.gif). This should work and if it isn't then something's amiss in your apache configuration. Putting the images under *cgi-bin* (bad idea by itself) didn't work also, as httpd server recognised the image files as scripts and tried to execute them. That's probably because you have it set up to execute anything in cgi-bin/ which is probably not what you want anyway. -- Michael Peters Plus Three, LP # CGI::Application community mailing list #### ## To unsubscribe, or change your message delivery options, ## ## visit: http://www.erlbaum.net/mailman/listinfo/cgiapp## #### ## Web archive: http://www.erlbaum.net/pipermail/cgiapp/ ## ## Wiki: http://cgiapp.erlbaum.net/ ## ####
Re: [cgiapp] CGI::Application + javascript + http server + icons
2008/11/19 Michael Peters [EMAIL PROTECTED] Arsen Hayrapetyan wrote: When I am running my application, it does not see the image files. Firefox plugin shows that the following file is requested: * URL_base/cgi-bin/app-images/bullet.gif* I.e., my application sees *cgi-bin* instead of *htdocs*. This is an apache configuration issue not really related to C::A. You might get more help on an apache specific mailing list. May be, I don't know. But just for kicks, what does you httpd.conf file look like? It ScriptAlias-es */cgi-bin/* to appropriate directory and document root is set to *htdocs/*. Do you need any other details? I tried also other ways of referring to the image files in js code, such as: */app-images/bullet.gif*,* htdocs/app-images/bullet.gif*, but none of them worked. If your document root is in htdocs/ then that's where all of your media assets belong (image files, css, js and .html). Yes, everything is as you say at the moment. And you reference it without mentioning the document root using an absolute path (like /images/bullet.gif). This should work and if it isn't then something's amiss in your apache configuration. No, it doesn't. Putting the images under *cgi-bin* (bad idea by itself) didn't work also, as httpd server recognised the image files as scripts and tried to execute them. That's probably because you have it set up to execute anything in cgi-bin/ which is probably not what you want anyway. Why not? I indeed want cgi-bin/ to contain cgi applications only (BTW, that is the default httpd configuration.) Here are some more details: Application module: === sub s01 : StartRunmode { my $self = shift; my $q = $self-query( ); my $tmpl = $self-load_tmpl( ); return $tmpl-output; } === Corresponding template (relevant part only): == head titleKnowledgebase/title link href=/kb.css rel=stylesheet type=text/css script src=/kb.js type=text/javascript/script /head === Java Script file (relevant parts only): === var imdir = 'app_images/'; // or */app_images*, does not work either var bulletRight = new Image(); bulletRight.src = 'bullet_right.gif'; ... img_name = imdir + bulletRight.src; // that is: * app_images/bullet_right.gif* (or */app_images/bullet_right.gif*) a.innerHTML = 'img src=' + img_name + ' width=10 height=10 border=0 valign=middle alt= /nbsp;' img tag causes donload of the image file from the server, but instead of fetching *http://myserver.com/app_images/bullet_right.gif*, the browser fetches *http://myserver.com/cgi-bin/**app_images/bullet_right.gif* Arsen. = === -- Michael Peters Plus Three, LP # CGI::Application community mailing list #### ## To unsubscribe, or change your message delivery options, ## ## visit: http://www.erlbaum.net/mailman/listinfo/cgiapp## #### ## Web archive: http://www.erlbaum.net/pipermail/cgiapp/ ## ## Wiki: http://cgiapp.erlbaum.net/ ## #### # CGI::Application community mailing list #### ## To unsubscribe, or change your message delivery options, ## ## visit: http://www.erlbaum.net/mailman/listinfo/cgiapp## #### ## Web archive: http://www.erlbaum.net/pipermail/cgiapp/ ## ## Wiki: http://cgiapp.erlbaum.net/ ## ####