Drupal: Inserting fivestar widget in an external php file -


I am trying to load the forester module and showing the rating widget of the selected node in an external php file. I have received the rating widget displayed on the page but it only displays the degraded version of the widget (non-javascript, dropdown widget, and "rate" button), I looked in the source code of the page but javascript was not loaded for the Favestar module Was there. I tried to load javascript using the following functions but it was not destined:

fivestar_add_js (); $ Path = drupal_get_path ('module', 'favestar'); Php file has the following code:

         // bootstrap Requires include_once 'include / bootstrap.inc'; // Load Drupal drupal_bootstrap (DRUPAL_BOOTSTRAP_FULL); Fivestar_add_css (); // I have used one of the following two functions at one time for testing: i fivestar_add_js (); $ Path = drupal_get_path ('module', 'favestar'); Drupal_add_js ($ path. '/ Js / fivestar.js', 'inline', 'footer'); $ Book = $ _GET ["book"]; $ Arc = $ _GET ["chapel"]; $ Prob = $ _GET ["prob"]; $ String = $ book '/'. $ Chap '/'. $ Prob; $ Query = "Select ctcr.nid from ctcr WHERE ctcr.field_problem_value = '" as content_type_comments_ratings. $ String "'"; $ Result = db_query ($ query); $ Line = db_fetch_array ($ result); If (isset ($ line ['net'])) {$ nid = $ row ['nid']; Node_load (FALSE, NULL, TRUE); $ Fivestar = node_load ($ nid, NULL, TRUE); If (function_exists ('fivestar_widget_form')) print fivestar_widget_form ($ fivestar); }  

If you can point me or direct me to read something on the web, then I appreciate it. Thanks so much in advance.

By doing this all on 'external' page / file, you can use Drupal theming system - drupal_add_js ( ) (and failing fivestar_add_js () , because it is just experimenting in the end) do not output script tags themselves, but only make sure that they $ Script will be included in the variable page.tpl.php , which will be responsible for printing that variable content. As you do not go through the page template, you do not get a script tag.

You can print drupal_get_js () in your external file; code> drupal_add_js () as a quick fix, but note that it will also output all the default Drupal JS files, which can be higher than you need (but simultaneously by FeverStar Other scripts required, such as jQuery). Alternatively, you have to make the necessary script tags yourself.

As an indication for reading, you are difficult to talk about something special, but you may want to read normally.


Comments