I had the same problem when I wanted to include google Maps via
symfony.
I wrote a custom solution (is not perfect at alle, but works for now):
you will need a new yml file in apps/APPNAME/config called
"externalScripts.yml"
This should look like this:
files:
keyToUseInViewYmlFile: http//urlOfYoureXTERNALjs
Then you will need to create a new filter under apps/APPNAME/lib
called "externaljsFilter.class.php"
<?PHP
class externaljsFilter extends sfFilter
{
public function execute($filterChain)
{
$loadExternalJs = "";
$html = "";
$filterChain->execute();
$externalScriptFiles = sfYaml::load(sfConfig::get('sf_app_dir').'/
config/externalScripts.yml');
$sf_context = sfContext::getInstance();
$sf_response = $sf_context->getResponse();
$javascripts = $sf_response->getJavascripts();
$html = $sf_response->getContent();
foreach($externalScriptFiles["files"] as $key => $path){
if(in_array($key, $javascripts)){
//remove the normal js from the code
$html = str_ireplace('<script type="text/javascript" src="/
js/'.$key.'.js"></script>', '', $html);
$loadExternalJs .= '<script type="text/javascript" src="'.
$path.'"></script>';
}
}
$sf_response->setContent(str_ireplace('</head>',
$loadExternalJs.'</head>', $html));
}
}
?>
Then change your apps/APPNAME/config/filters.yml to this:
rendering: ~
web_debug: ~
security: ~
# generally, you will want to insert your own filters here
externaljs:
class: externaljsFilter
param:
external_scripts: googleMaps
condition: %APP_ENABLE_REMEMBER_ME%
cache: ~
common: ~
flash: ~
execution: ~
After this, you will be able to load external js by including the key
from the externalScripts.yml in the javscripts part in the view.yml
Hope, this helps,.
Cheers,
Andy
On Jun 8, 8:06 am, Kiril Angov <[EMAIL PROTECTED]> wrote:
> What Florian is talking about is making Ajax requests from one server to
> another and that is considered cross domain scripting (if I am not
> mistaken). As far as I know you cannot do that as it is considered
> dangerous by the browsers. Anybody correct me if I am wrong.
>
> So the answer to the original question will be yes, you can put absolute
> addresses to specify the location of your tinymce installation or no,
> you cannot. Unfortunately, I do not know the answer :)
>
> Kupo
>
> Dan Grossman wrote:
> > More than 90% of all webpages contain JavaScript that resides on another
> > server. That's how Google AdSense, every web tracker/hit counter, and
> > virtually all 3rd party ad network works.
>
> > Florian Klug wrote:
>
> >> hi,
>
> >> On Thursday 07 June 2007 19:02, Eno wrote:
>
> >>> Our javascript files live on another server (along with all of our
> >>> images) and Im trying to integrate a rich text editor into our
> >>> application.
>
> >> I don't think that's a symfony issue, because afaik browsers don't execute
> >> javascript from any other server than the one which serves the page.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---