1

I have trouble getting the absolute path with cakephp while using a shell. Shell do not load all the files like normal www files do. So i think is a file i need to load but i don't know which...

What have i done already

  1. I have tried echo $this->Html->image($this->Html->url('/pluginName/image.gif',true));, normally this would work but not this time... it appears as if the true is not there and a relative path is set.
  2. define('FULL_BASE_URL','http:/domain'); this one works but is not portable, i need a solution that is portable since this shell may run from different servers that have different images absolute path (same name but the domain changes.

What i need

  1. It needs to be portable.
  2. It needs to give me the full url.
  3. It has to work within a shell.

Thanks in advance

1 Answer 1

2

The problem is that there is no web request when running a shell. The generated URLs are always relative to which URL the app was invoked with. On the shell, there is no URL to be relative to, and there can't be a default URL since the app could be invoked from any number of URLs. You'll need to hard-code the URL to be available in the shell.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.