-- Christian Sanchez <[EMAIL PROTECTED]> wrote
(on Wednesday, 23 July 2008, 11:30 PM -0500):
> 2008/7/23 Matthew Weier O'Phinney <[EMAIL PROTECTED]>:
>     -- Christian Sanchez <[EMAIL PROTECTED]> wrote
>     > ?>
>     >
>     > <html>
>     >
>     >     <head>
>     >         <?php
>     >         echo $this->headTitle();
>     >         echo $this->headMeta();
>     >         echo $this->headLink();
>     >         echo $this->headStyle();
>     >         ?>
>     >             <?php if ($this->dojo()->isEnabled()):
> 
>     You don't need to do the conditional here -- just echo the helper. If
>     it's not enabled, nothing will be rendered.
> 
> Ok, I just commented that line.
> 
> 
>     One technique I've used is to do the setup below:
>      
> 
> 
>     >               
> $this->dojo()->setLocalPath('/scripts/dojo_f/dojo/dojo.js')
>     >               ->addStyleSheetModule('dijit.themes.tundra');
> 
> Do you use it like that in your bootstrap?
> I suggest that the documentation should include the part of the bootstrap that
> took me a while to figure out... Setting the view helper like this:
> 
> $view = new Zend_View();
> $view->addHelperPath('Zend/Dojo/View/Helper/', 'Zend_Dojo_View_Helper');
> $viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer();
> $viewRenderer->setView($view);
> Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
> 
> Is this snippet correct?

Yes. An alternative that shortens it up slightly:

    $viewRenderer = 
Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer');
    $viewRenderer->initView();
    Zend_Dojo::enableView($viewRenderer->view);

but that only eliminates two lines. :)

>     in my bootstrap, and then disable the helper until I explicitly enable
>     it in a view script. (I should probably put that in the manual.)
> 
>     >               echo $this->dojo();
>     >            endif;
>     >         ?>
>     >         <?php
>     >             echo $this->headScript();
>     >          ?>
>     >     </head>
>     >
>     >     <body class="tundra">
>     >         <h1><?php echo $this->placeholder('title') ?></h1>
>     >         <?php echo $this->layout()->content ?>
>     >
>     >         <br />
>     >         <br />
>     >     </body>
>     >
>     > </html>
> 
>     So, now my question is: is something not working for you here?
> 
> 
> I just set an explicit localpath:
> 
> $this->dojo()->setLocalPath('http://localhost/dev/example/html/scripts/dojo_f/
> dojo/dojo.js')
>               ->addStyleSheetModule('dijit.themes.tundra');
> 
> but still doesn't work... I'll attach some pics to explain myself a little
> better though.

Your local path is still incorrect.

Let's say you're using the standard application layout, and have dojo
under public/scripts/dojo_f:

    application/
        controllers/
        views/
    library/
        Zend/
    public/
        .htaccess
        index.php
        scripts/
            dojo_f/
                dojo/
                    dojo.js

Your vhost is pointing the DocumentRoot at your public directory. So,
you need so specify the local path as starting at that directory:

    $this->dojo()->setLocalPath('/scripts/dojo_f/dojo/dojo.js');

Basically, the value you give to setLocalPath() should be the value of
the script's src attribute:

    <script src="/scripts/dojo_f/dojo/dojo.js"
        type="text/javascript"></script>

Make sense?


> In dojopic1 is the original example from dojo docs without using ZF at all. 
> The
> button is bigger and nicer...
> Well, dojopic2 is the result with the localpath set like: 
> /scripts/dojo_f/dojo/
> dojo.js You can see the button there (a standard one...), but firebug shows
> that the the dojo.js wasn't found, 

This tells me that you probably don't have the path right. What happens
when you go to /scripts/dojo_f/dojo/dojo.js on your site? Does it
actually resolve, or does it give you a 404?

> so I changed the localpath to: http://
> localhost/dev/example/html/scripts/dojo_f/dojo/dojo.js the result is in the
> dojopic3... But no button at all (?!?!?!?!?) when I check for the source code
> of the page (dojopic4) the code has the button in it... :S So I'm quite
> confused... I'm at work now, but I use a portable XAMPP It's the same
> implementation like the one I use at home... So I still can't explain myself
> what is going on there...
> 
> BTW thanks for helping matt... I know u are really busy :-)
>  
> 
> 
> 
> 
>     > 2008/7/23 Matthew Weier O'Phinney <[EMAIL PROTECTED]>:
>     >
>     >     -- Christian Sanchez <[EMAIL PROTECTED]> wrote
>     >     (on Wednesday, 23 July 2008, 01:02 PM -0500):
>     >     > Ok, changing that makes the button appear :-) but not in the 
> tundra
>     theme
>     >     way
>     >     > :-(
>     >
>     >     Did you place a 'class="tundra"' on a container that has the dijits?
>     >
>     >     Typically, I place it in my <body> tag, just to be safe:
>     >
>     >        <body class="tundra">
>     >
>     >     but the only requirement for tundra to be applied is that it is on 
> an
>     >     element that contains dijits:
>     >
>     >        <div class="tundra">
>     >            <?= $this->form ?>
>     >        </div>
>     >
>     >     Try that out.
>     >
>     >
>     >     > I have the following code for the button:
>     >     >
>     >     > <?php  $this->dojo()->enable()
>     >     >              ->setDjConfigOption('parseOnLoad', true)
>     >     >              ->requireModule('dijit.form.Button');
>     >     >       ?>
>     >     >
>     >     > <button dojoType="dijit.form.Button" id="helloButton">
>     >     >         Hello World!
>     >     >         <script type="dojo/method" event="onClick">
>     >     >            alert('You pressed the button');
>     >     >         </script>
>     >     >     </button>
>     >     >
>     >     > 2008/7/23 Matthew Weier O'Phinney <[EMAIL PROTECTED]>:
>     >     >
>     >     >     -- Christian Sanchez <[EMAIL PROTECTED]> wrote
>     >     >     (on Wednesday, 23 July 2008, 12:37 PM -0500):
>     >     >     > Hi guys!
>     >     >     > Well I'm trying to implement the Hello world example with 
> the
>     >     ZF_1.6_RC1,
>     >     >     after
>     >     >     > an hour of frustration my guess is that, since I'm not using
>     an
>     >     exact
>     >     >     address
>     >     >     > to send the localpath
>     >     >     >
>     >     >     > $this->dojo()->setLocalPath('../html/scripts/dojo_f/dojo/
>     dojo.js')
>     >     >
>     >     >     LocalPath should be the path relative to the document root --
>     i.e.,
>     >     the
>     >     >     path that would occur in your script's href tag:
>     >     >
>     >     >        
> $this->dojo()->setLocalPath('/scripts/dojo_f/dojo/dojo.js');
>     >     >
>     >     >     This should appropriately set the rest of it.
>     >     >
>     >     >     Let me know your results; regardless, I'll try to make this
>     clearer
>     >     in
>     >     >     the manual.
>     >     >
>     >     >     >               ->addStyleSheetModule('dijit.themes.tundra');
>     >     >     >               echo $this->dojo();
>     >     >     >
>     >     >     > the error is in the import that tries to get the library 
> from
>     the
>     >     same
>     >     >     address:
>     >     >     >
>     >     >     > @import "../html/scripts/dojo_f/dijit/themes/tundra/
>     tundra.css";
>     >     >     >
>     >     >     > When it should be:
>     >     >     >
>     >     >     > @import "http://localhost/dev/example/html/scripts/dojo_f/
>     dijit/
>     >     themes/
>     >     >     tundra/
>     >     >     > tundra.css";
>     >     >     >
>     >     >     > Maybe I'm wrong but it still does not work :'-(
>     >     >     >
>     >     >     > --
>     >     >     > Christian S nchez A.
>     >     >
>     >     >     --
>     >     >     Matthew Weier O'Phinney
>     >     >     Software Architect       | [EMAIL PROTECTED]
>     >     >     Zend Framework           | http://framework.zend.com/
>     >     >
>     >     >
>     >     >
>     >     >
>     >     > --
>     >     > Christian S nchez A.
>     >
>     >     --
>     >     Matthew Weier O'Phinney
>     >     Software Architect       | [EMAIL PROTECTED]
>     >     Zend Framework           | http://framework.zend.com/
>     >
>     >
>     >
>     >
>     > --
>     > Christian S nchez A.
> 
>     --
>     Matthew Weier O'Phinney
>     Software Architect       | [EMAIL PROTECTED]
>     Zend Framework           | http://framework.zend.com/
> 
> 
> 
> 
> --
> Christian S nchez A.






-- 
Matthew Weier O'Phinney
Software Architect       | [EMAIL PROTECTED]
Zend Framework           | http://framework.zend.com/

Reply via email to