Hi
Using "$this->base" is probably better.
It's a property that's available in both controllers and views, and
which contains the root cake path...
Then your url would look like this :
contentUrl: "<? echo $this->base ?>/generals/view"+viewId
It's better because you won't need to change it all the time in case
you move your cake install or decide to call your app "store" instead
of "inventory" (for example)
See also $html->url() (for Cake 1.1) or Router::url() (Cake 1.2)
They're useful.
+++++++
clément
On Jan 21, 2008 6:06 PM, ryoungsma <[EMAIL PROTECTED]> wrote:
>
> Thank you so much for the help. With your guidance I was able to work
> this out. If interested here is the what it looks like.
>
> <script type="text/javascript">
> function createNewWindow(id)
> {
> var host ='<?php echo $_SERVER['HTTP_HOST']; ?>';
> var viewId = id;
> var newWindowModel = new DHTMLSuite.windowModel(
> {windowsTheme:false,id:'newWindow',
> title:'New dynamically created window',
> xPos:200,yPos:200,minWidth:null,minHeight:null } );
> newWindowModel.addTab({ id:'myTab',htmlElementId:'myTab',tabTitle:'tab1',
> contentUrl:"http://"+host+"/inventory/generals/view/"+viewId} );
> var newWindowWidget = new DHTMLSuite.windowWidget(newWindowModel);
> newWindowWidget.init();
> }
> </script>
>
> I now pass an 'id' to the script as well.
>
> Thank you.
>
> On Jan 21, 10:58 am, hydra12 <[EMAIL PROTECTED]> wrote:
> > OK, a couple of things. First, I've never used DHTML Suite, but this
> > works for me using extjs. I think it will work for you, too.
> >
> > First, try hard-coding your url:
> >
> > contentUrl: 'http://localhost/myapp/vendor/view/107'//or whatever
> > your url is :-)
> >
> > Note: if you put localhost in, you have to call the site from
> > localhost in your browser or you get permission denied errors on your
> > ajax call. For example, my dev laptop is named tc-mark-lap. If I put
> > localhost in my js code but try to call the code
> > withhttp://tc-mark-lap/myapp/vendor/view/107in my browser, it won't work.
>
> >
> > This will (I hope) fix your problem. You can check firebug to see
> > what your ajax call returns (to make sure that your ajax is working
> > even if there is a problem with your js code). In my code, I define a
> > javascript variable in my default layout like this:
> >
> > <script>
> > var host = '<?php echo $_SERVER['HTTP_HOST']; ?>';
> > </script>
> >
> > In my javascript code, I put this for my ajax url: contentUrl:
> > 'http://'+host+'/myapp/vendor/view/107'
> >
> > I hope that helps some.
> >
> > hydra12
> >
> > On Jan 21, 9:38 am, ryoungsma <[EMAIL PROTECTED]> wrote:
> >
> > > Here is the js code to generate the window
> >
> > > <script type="text/javascript">
> > > function createNewWindow()
> > > {
> > > var newWindowModel = new DHTMLSuite.windowModel(
> > > {windowsTheme:false,id:'newWindow',
> > > title:'New dynamically created window',
> > > xPos:200,yPos:200,minWidth:400,minHeight:600 } );
> > > newWindowModel.addTab({ id:'myTab',htmlElementId:'myTab',tabTitle:'tab1',
> > > contentUrl:'vendor\view\107' } );\\this is the URL to load
> > > var newWindowWidget = new DHTMLSuite.windowWidget(newWindowModel);
> > > newWindowWidget.init();}
> >
> > > </script>
> > > <a href="#" onclick="createNewWindow();return false">Create window</A>
> >
> > > On Jan 21, 9:51 am, hydra12 <[EMAIL PROTECTED]> wrote:
> >
> > > > Can you show the relevant js code? Specifically, how are you
> > > > inputting the url?
> >
> > > > On Jan 21, 7:29 am, ryoungsma <[EMAIL PROTECTED]> wrote:
> >
> > > > > I am looking at using the DHTML Suite (dhtmlgoodies.com) with my
> > > > > application. I am using their Window Widget to retrieve some
> > > > > information via AJAX. The issue is that it uses the URL as a
> > > > > parameter when when you create the window from Javascript. Cake
> > > > > always seems to return a message that it is looking for a different
> > > > > controller.
> >
> > > > > For example, the URL entered into the parm field is '\vendors\view
> > > > > \105'
> >
> > > > > Here is what Cake is reporting for an error.
> > > > > <?php
> > > > > class VendorsController extends AppController {
> >
> > > > > var $name = 'Vendors';
> >
> > > > > function viewG() {
> >
> > > > > }
> >
> > > > > }
> >
> > > > > ?>
> >
> > > > > Any thoughts? Have I provided enough information? Thank you!
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" 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/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---