|
|
| Author |
Message |
|
| vim |
Posted: Thu Nov 27, 2008 8:02 am |
|
|
|
User
Joined: 01 Oct 2008
Posts: 19
|
i'm using yaws, and i was trying to set some of the resources to other directories, till now with no success.
for example, i want all the graphics to be on another directory, so i tried "../img/mypic.jpg"
another use i need, is to share an include file with the backend server, so i tried
Code: <erl> -include("../include/shared.hrl"). </er>
few more details: i run yaws on embedded mode, and my directory structure is:
ebin/
include/
src/
www/
where my yaws pages are on the www/ directory |
|
|
| Back to top |
|
| hao |
Posted: Fri Nov 28, 2008 4:11 pm |
|
|
|
User
Joined: 20 Aug 2007
Posts: 18
Location: Uppsala, Sweden
|
[First question] Since you put your yaws pages under www/ directory, do you set yaws docroot to www/ as well? Assume that you did so, one correct way to organize directories will be:
www/your_yaws_pages.yaws
......../include/img/mypic.jpg
..................../css/mycss.css
..................../js/myjs.js
Therefore, in the html or yaws pages, if you want to use mypic.jpg image, write e.g. src="/include/img/mypic.jpg".
[Second question] I don't think the -include statement would work inside <erl> tags in a .yaws file. <erl></erl> should only contain out/1 function which looks like
Code:
<erl>
out(Arg) -> do_sth_here_and_return_predefined_types_of_data.
</erl>
But you could do it in another way:
Code:
<erl>
out(Arg) -> somemodule:somefunc(Arg).
</erl>
In somemodule, use -include("../include/shared.hrl") and make sure somefunc/1 return same types of data as out/1. |
|
|
| Back to top |
|
| vim |
Posted: Fri Nov 28, 2008 11:15 pm |
|
|
|
User
Joined: 01 Oct 2008
Posts: 19
|
|
| Back to top |
|
| hao |
Posted: Sat Nov 29, 2008 12:17 pm |
|
|
|
User
Joined: 20 Aug 2007
Posts: 18
Location: Uppsala, Sweden
|
You are welcome. Put further posts if you encounter any related problems. Good luck.  |
|
|
| Back to top |
|
|
|
All times are GMT
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
|
|
|