Đường dẫn đến file, thật trần ai !!!

Khổ quá, có một cục xương trong cổ họng nói ra chắc anh em sẽ thấy sao mà Thái "chuối" thế, nhưng Thái vẫn phải nhở đến anh em chỉ giáo thôi, bất lực rồi.
Vấn đề là thế này, khi Thái tạo một nội dung nào đó dùng full html, khi dùng thẻ "img" cái thuộc tính đường dẫn "src" lúc nào Thái cũng phải điền một đường dẫn tương đối từ trang index, ví dụ Thái có hình "demo.png" trong thư mục files, thế là Thái muốn đọc nó phải đánh src của tag "img" như vầy : "src='sites/default/files/demo.png'". Khổ cái là cái đường dẫn này chỉ chạy khi url của Thái có dạng http://localhost/[sitename]/*, nên khi vào admin hay search, cấp độ url thay đổi, thì mất luôn cái hình !
Vấn đề này thật nhức nhối Thái không biết làm sao để giải quyết một cách trọn vẹn. Mong anh em giúp đỡ.

Comments

Mình đã giải quyết vấn đề này

Mình đã giải quyết vấn đề này bằng cách dùng đường dẫ trực tiếp, dù là giải pháp tình thế nhưng phần nào giải quyết được vấn đề, xin cảm ơn mọi người đã quan tâm

anh Thái viết bài đọc thu hút

anh Thái viết bài đọc thu hút ghê. "có một cục xương trong cổ họng" hé hé.. tại hạ ngưỡng mộ ghê!

Ban co the dung ham

Ban co the dung ham base_path() de lay duong dan den root cua site (base_path().'sites/default/files/demo.png')

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <sup> <br> <p> <h3>
  • Lines and paragraphs break automatically.
  • Link to content with [[some text]], where "some text" is the title of existing content or the title of a new piece of content to create. You can also link text to a different title by using [[link to this title|show this text]]. Link to outside URLs with [[http://www.example.com|some text]], or even [[http://www.example.com]].
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>. The supported tag styles are: <foo>, [foo]. PHP source code can also be enclosed in <?php ... ?> or <% ... %>.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.