cancel
Showing results for 
Search instead for 
Did you mean: 

How to link HTML documents with style-sheets or images?

greglenain
Champ in-the-making
Champ in-the-making
Hi,

In order to provide Alfresco users with nice looking HTML documents, I'd like to allow the web client to deal with fully relative URLs.

But Alfresco doesn't seem able to.

Its DownloadContentServlet only allows URL to be solved along path of the form:
    <IMG src="../43f9bb8b-6624-11ca-89da-4926508e/My_Image.gif"/>

where the smart code is the My_Image.gif resource UID in Alfresco.

How to link HTML documents with style-sheets or images using true relative URLs?

For example:
   <IMG src="../Resources_Folder/My_Image.gif"/>

Thanks.
8 REPLIES 8

gavinc
Champ in-the-making
Champ in-the-making
Hi,

There's no reason why you can't use relative paths in the web client. However, there are a couple of things to consider…you can only reference files in the WAR file, to point to files in the repository you will need to use the download servlet.

Also if you plan to make your application available in a portal you will need the absolute URL as often the files/images are in a completely different web context (the reason why we use absolute URLs).

Or were you meaning something else?

greglenain
Champ in-the-making
Champ in-the-making
Hi,

I intend to use relative URLs to point files in the repository from files equally in the repository.

Let's suppose that our workspace looks like:
  • Company_home
    • Resources_folder
      • My_Image.gif
      • Another_Image.gif
    • Style_sheet_folder
      • My_CSS.css
    • HTML_docs_folder
      • My_HTML_doc.html
      • Another_HTML_doc.html
I'd just like linking images to My_HTML_doc.html such as:
<HTML>
   <BODY>Bla, bla
       <IMG SRC="../Resources_Folder/My_Image.gif"/>
     bla, bla</BODY>
</HTML>

Thanks.

gavinc
Champ in-the-making
Champ in-the-making
OK, I see what you mean now…

Unfortunately, no, we don't have support for this right now. We planning on adding web content management features some time next year.

For now you will either have to use the content servlet in conjunction with the UID or alternatively you could try using WebDAV URLs as this will at least eliminate ids. For example you could refer to the image file as follows:

http://localhost:8080/alfresco/webdav/Resources_folder/My_Image.gif

Hope this helps,

greglenain
Champ in-the-making
Champ in-the-making
Hi,

I just tried your Webdav tip but unfortunately I got an HTTP error 500.

Alfresco logs tell me that:
14:10:47,817 ERROR [alfresco.webdav.protocol] No root node for request

Logs don't give more information.

Furthermore, when starting, Alfresco's console shows that:
WARN [alfresco.webdav.protocol] No default root node for WebDAV, using home node only

How to set a root node?

Thanks.

gavinc
Champ in-the-making
Champ in-the-making
Hmm, strange, you should not have to configure anything for WebDAV to work Smiley Sad

Have you changed the "Company Home" definition in any of the other config files?

greglenain
Champ in-the-making
Champ in-the-making
No, the "Company Home" definition remains unchanged.

I run Alfresco on a W2000 server; except CIFS, all works fine.

Can my OS prevent the WebDav protocol to be used?

gary_spencer
Champ in-the-making
Champ in-the-making
Hi,

What filesystem(s) do you have defined in the Filesystems section of the file-servers.xml file ?.

Cheers

Gary

greglenain
Champ in-the-making
Champ in-the-making
Hi,

No change too.

<config evaluator="string-compare" condition="Filesystems">
      <filesystem name="Alfresco">
         <store>workspace://SpacesStore</store>
         <rootPath>/app:company_home</rootPath>
      </filesystem>
</config>

Bye.