Re: [Cppcms-users] How to specify the file path or image in web page
Brought to you by:
artyom-beilis
From: 陈抒 <csf...@gm...> - 2011-08-05 10:41:49
|
Thanks. Do you mean that I should build up a static file(*.css,*.jpg,etc.) server using nginx? 陈抒 Best regards http://blog.csdn.net/sheismylife On Fri, Aug 5, 2011 at 6:09 PM, kpeo <sla...@ya...> wrote: > Hello, > > maybe it will help: > > when you put <img src="/resources/images/logo.gif"/> - web-frontend use url > with current URL (http://site.org/resources/images/logo.gif) > and get file relatively of your document-root in web-frontend > (nginx/lighttpd/apache - usually /var/www) - so path is: > /var/www/resources/images/logo.gif > > As for code: > You can use project.resource from configuration: > { > "project" : { > "resource" : "/resource", > } > } > > in code of page: > void page::init(content::page &c){ > c.resource = settings().get<std::string>("project.resource"); > } > > in template: > <img src="<% resource %>/img/test.jpg" /> > > so your final path is - http://project.org/resource/img/test.jpg (it can > be overwrited by web-frontend like nginx/lighttpd to /img/test.jpg) > > directory /resource must exist in your document-root of web-frontend. > > in css it may be like (/resource/css/style.css): > background: white url(../img/test.jpg) no-repeat; > 05.08.2011, 12:50, "陈抒" <csf...@gm...>: > > Hello, > I want to show some images in my web page ,but I don't know where I > should put my image file? > > <img src="resources/images/logo.gif"/> > Any document or example? > > 陈抒 > Best regards > http://blog.csdn.net/sheismylife > > > ------------------------------------------------------------------------------ > BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA > The must-attend event for mobile developers. Connect with experts. > Get tools for creating Super Apps. See the latest technologies. > Sessions, hands-on labs, demos & much more. Register early & save! > http://p.sf.net/sfu/rim-blackberry-1 > > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > > ------------------------------------------------------------------------------ > BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA > The must-attend event for mobile developers. Connect with experts. > Get tools for creating Super Apps. See the latest technologies. > Sessions, hands-on labs, demos & much more. Register early & save! > http://p.sf.net/sfu/rim-blackberry-1 > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > > |