HTML helper function in Drupal
Hi all, does Drupal have some helper function for creating HTML tags, like it exists in Rails (and I think cakePHP)? somethin that could be called like this: $output = tag("h1", $node->title, array('class' => ''title)); best, Bojan
Quoting Bojan Mihelac <bmihelac@gmail.com>:
Hi all, does Drupal have some helper function for creating HTML tags, like it exists in Rails (and I think cakePHP)?
somethin that could be called like this:
$output = tag("h1", $node->title, array('class' => ''title));
You mean something like http://api.drupal.org/api/function/theme Earnie -- http://for-my-kids.com/ -- http://give-me-an-offer.com/
On 20.2.2008, at 18:26, Earnie Boyd wrote:
Quoting Bojan Mihelac <bmihelac@gmail.com>:
Hi all, does Drupal have some helper function for creating HTML tags, like it exists in Rails (and I think cakePHP)?
somethin that could be called like this:
$output = tag("h1", $node->title, array('class' => ''title));
You mean something like http://api.drupal.org/api/function/theme Earnie, thanks for your answer.
Well, I was looking for some easy way to create HTML code from custom module. I would like to be able to call template file and send some variables to it for styling. Something like: $output = template("my_template_name", $vars_to_pass). Is there function for this? To create HTML directly from module, without calling template is also option and I am aware about helper functions for creating links, lists, tables but I didn't found helpers to avoid inserting HTML in PHP code. Bojan
Earnie -- http://for-my-kids.com/ -- http://give-me-an-offer.com/
-- [ Drupal support list | http://lists.drupal.org/ ]
Bojan Mihelac ha scritto:
On 20.2.2008, at 18:26, Earnie Boyd wrote:
Quoting Bojan Mihelac <bmihelac@gmail.com>:
Hi all, does Drupal have some helper function for creating HTML tags, like it exists in Rails (and I think cakePHP)?
somethin that could be called like this:
$output = tag("h1", $node->title, array('class' => ''title));
You mean something like http://api.drupal.org/api/function/theme
Earnie, thanks for your answer.
Well, I was looking for some easy way to create HTML code from custom module. I would like to be able to call template file and send some variables to it for styling. Something like: $output = template("my_template_name", $vars_to_pass). Is there function for this?
Like this: function _mw_blog() { //Prendo l'ultimo blog //echo "èèèèèè"; //print_r("pippo"); $query = "select nid from {node} where type = 'blog_programmazione' and status = 1 and promote = 1 order by nid desc limit 0,1"; $nid = db_result(db_query($query)); $node = node_load($nid); //dvr($node); $var = array(); $var['title'] = $node->title; $var['body'] = $node->teaser; $var['link'] = "/".$node->path; $var['image'] = "/".$node->field_forum_img[0]['filepath']; //dvr($var); return _phptemplate_callback('blog-front',$var); } blog-front.tpl.php: <div class="hpBox2"> <H3>Dal Blog</H3> <div class="mid"> <img src="<?php echo $image ?>" width="90" height="65"/> <p class="titolinoBox"><?php echo $title ?></p> <p><?php echo $body ?></p> <p class="boxLink"><a href="<?php echo $link ?>">Leggi l'articolo</a></p> </div> <div class="fine"></div> </div> M. -- Michel 'ZioBudda' Morelli michel@ziobudda.net Consulenza sistemistica in ambito OpenSource. Sviluppo applicazioni web dinamiche (LAMP+Ajax) Telefono: 0200619074 Telefono Cell: +39-3939890025 -- Fax: +39-0291390660 http://www.ziobudda.net ICQ: 58351764 http://www.ziobuddalabs.it Skype: zio_budda http://www.ajaxblog.it MSN: michel@ziobuddalabs.it JABBER: michel@gmail.com
participants (3)
-
Bojan Mihelac -
Davide Michel 'ZioBudda' Morelli -
Earnie Boyd