Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to concretely display any kind of content within a drupal module
    primarykey
    data
    text
    <p>this will be my first question on the site, I hope I'll be clear!</p> <p>So I'm working on adapting a regular php/html/js website to a drupal site. There are some specific things a can't do with the available modules, so a need to create some. I've been wandering a lot on the web, watch and read some tutorials but I dont get exactly how to display simple html/js/php with a block module for instance. </p> <p>For example, I want to display this in a block module : </p> <pre><code>`&lt;script type="text/javascript" src="jquery-min.js"&gt;&lt;/script&gt; &lt;div class="myDiv"&gt;&lt;/div&gt; &lt;script&gt; $(".maparea").append('&lt;p class='myText'&gt;Hello there!&lt;/p&gt;'); &lt;/script&gt;` </code></pre> <p>On the other hand I have my block_view function:</p> <pre><code>`function my_module_block_view($delta = '') { $block = array(); $block['subject'] = 'my Module title'; $block['content'] = 'some content'; return $block; }` </code></pre> <p>If i replace that 'some content' with my raw code, well first I don't think it is the best way, a overall it doesn't work so well. Besides, I would like to use the drupal API to insert js (drupal_add_js), but how? </p> <pre><code>`block['content'] .= drupal_add_js(drupal_get_path('module', 'my_module').'/myScript.js');` </code></pre> <p>Finally, I found some information about theme system, and templates. So it seems I have to implement my_module_template.tpl.php, and implement hook_theme in my_module.module.</p> <p>It's pretty blurry, so I really need some help to understand the basics.</p> <p>Thanks in advance! </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload