I've had this problem before, the issue is that the javascript is using
a relative urls in the the URL to link to the to the icons.  The only
way I was able to fix the problem was to actually make the js into a
template, then I used h.url_for(...) for all the relative links in the
js file.  I then had to make a controller that would  return the
template (with the correct header) and add an entry in my routes so that
a call to the js file would call my controller.  I can dig up the exact
code if you need to see an example.
Jose

Gabriel Gellner wrote:
> I am a beginning pylons (and web programming in general), I have been
> playing around with making a simple blog style program, and want to
> add the openWYSIWYG controls to some of my textboxes.
> I have the html in place, but the path to the icons that openWYSIWYG
> expects are all wrong.
>
> This is what my mako template looks like:
>
> <html>
> <head>
> <script language="JavaScript" type="text/javascript" 
> src="/javascript/wysiwyg.js"></script> 
> </head>
> <body>
> <h1>Update blog post</h1>
> ${h.start_form(h.url(action='update', id=c.blog_post.id))}
> Headline:<br />
> ${h.text_field('headline', value=c.blog_post.headline)}<br />
> Text:<br />
> ${h.text_area('text', c.blog_post.text, id='edit_textarea')}<br />
> <script language="JavaScript">
>     generate_wysiwyg('edit_textarea');
> </script>
> ${h.submit(value='Update')}
> ${h.end_form()}
> ${h.link_to('Back', h.url(action='list'))}
> </body>
>
> The public folder is as follows:
> public/
>     -> javascript/
>         -> icons/
>         -> popups/
>         -> styles/
>
> My routes are
> map = Mapper(directory=os.path.join(root_path, 'controllers'))
> map.connect('error/:action/:id', controller='error')
> map.connect('', controller='frontpage', action='index')
> map.connect('blog', controller='main', action='list')
> map.connect(':controller/:action/:id')
> map.connect('*url', controller='template', action='view')
>
> When I look display the path to one of the missing icons I have:
> http://localhost:5000/main/edit/icons/redo_on.gif
>
> When I want it to point to (I think . . .):
> http://localhost:5000/javascript/icons/redo_on.gif
>
> If anyone can help point me in the right direction I would be very thankful.
>
> Gabriel
>
>
> >
>
>   

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" 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/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to