[support] Include JS file

bharani kumar bharanikumariyerphp at gmail.com
Fri Aug 1 08:29:02 UTC 2008


*Parse error*: syntax error, unexpected T_STRING in *
E:\WorkingProjects\site\modules\mEvents\mEvents.module* on line *27*

On Fri, Aug 1, 2008 at 1:53 PM, <rolf at openusource.com> wrote:

> In drupal_add_js you will have to specify the path and name to your js
> file.
>
> If you are calling drupal_add_js in a module and the js file is located
> within the module directory, you should call the function like this:
>
> drupal_add_js(drupal_get_path('module', 'my_module').'/my_javascript.js');
>
> If know the absolute path to the file, you should call the function like
> this:
>
> drupal_add_js('some/path/my_javascript.js');
>
> Note that if you are working with some special modules it might be
> necessary to add $base_url to the absolute path, like this:
>
> global $base_url;
> drupal_add_js($base_url.'some/path/my_javascript.js');
>
> Regards,
> rolfington
>
>
> > Am using drupal 5.7
> >
> > i created the custom events display,
> >
> > in that i added the search event ,
> >
> > for that search , i written the validation ,
> >
> > I include the JS file,...
> > in the top of the search form,
> >
> > But no use...
> >
> > drupal_add_js("event_search.js")
> > strSearch = "";
> >     for(i=0;i<arrSearch.length;i++){
> >         strSearch+=arrSearch[i]+"+";
> >     }
> >     if(strSearch!=""){
> >         strSearch = strSearch.substr(0,(strSearch.length-1));
> >         //alert(strSearch);
> >     }
> >  window.location.href="/site1/?q=search/node/event/"+strSearch; return
> > false;}</script>';
> >  $block['content'].= '<form action="/site1/?q=search/node/event"
> > name="frm_search_event"  accept-charset="UTF-8" method="post"
> > id="search-form" class="search-form"  onsubmit="return
> > event_search_validation();">';
> >  $block['content'].= '<div><div class="form-item">';
> >
> >  $block['content'].= '<div class="container-inline"
> > style="margin-right:100px;"><div class="form-item">';
> >  $block['content'].= '<input type="text" maxlength="255" name="keys"
> > id="edit-keys" name="txt_search_event"  size="25" value=""
> > class="form-text"/>';
> >  $block['content'].= '</div>';
> >  $block['content'].= '<input type="image"
> > src="files/images/btn-search-events.jpg" align="middle" width="96"
> > height="21 name="ops" id="edit-submits" value="Events Search"
> > class="form-submit" onClick="javascript:return goToEventSearch();" />';
> >  $block['content'].= '</div>';
> >  $block['content'].= '</div>';
> >  $block['content'].= '<input type="hidden" name="form_token"
> > id="edit-search-form-form-token" value="29ae915e9bd7e3eb6d8a484b7095fed5"
> > />';
> >  $block['content'].= '<input type="hidden" name="form_id"
> > id="edit-search-form" value="search_form"  />';
> >  $block['content'].= '</div></form>';
> >
> > Thanks u
> >
> >
> >
> >
> >
> >
> > On Fri, Aug 1, 2008 at 11:56 AM, <rolf at openusource.com> wrote:
> >
> >> Hi,
> >>
> >> That's the way to do it!
> >>
> >> >From which file do you call drupal_add_js? Make sure that the PHP file
> >> is
> >> part of your running installation.
> >>
> >> Which version of drupal are you using?
> >>
> >> Regards,
> >> Rolfington
> >>
> >> > Hi
> >> >
> >> >
> >> > How to include the JS file ,
> >> >
> >> > I tried drupal_add_js ,
> >> >
> >> > but file not included
> >> >
> >> > Any idea
> >> > --
> >> > [ Drupal support list | http://lists.drupal.org/ ]
> >>
> >>
> >> --
> >> [ Drupal support list | http://lists.drupal.org/ ]
> >>
> > --
> > [ Drupal support list | http://lists.drupal.org/ ]
>
>
> --
> [ Drupal support list | http://lists.drupal.org/ ]
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20080801/59a50761/attachment-0001.htm 


More information about the support mailing list