By Crackall on
Hello, I need to create a link with the class' use-ajax ", but I need inside the link an image, I tried to do with the function l() but prints the link address.
Hello, I need to create a link with the class' use-ajax ", but I need inside the link an image, I tried to do with the function l() but prints the link address.
Comments
What does your code look
What does your code look like?
I'm creating a block which
I'm creating a block which has some images and in the onclick event of one of these I need an ajax call. This is my code implementing hook_block_view($delta):
case 'mymodule':
$nodes = entity_load('node', FALSE, array('type' => 'some'));
$html = "
foreach ($nodes as $node){
$dir = file_create_url($node->field_image['und'][0]['uri']);
$html .= "< a href = 'fbf/$node->nid'> < div id ='div$node->nid'> < img src='$dir'>".'< /div> < /a>';
$cont++;
}
$html .= '< /div>';
$block['content'] = $html;
'html' (default FALSE) make it true will work for you
There might be some syntax mistake in code. Important thing is $text(first parameter of l function ) is not sanitized if 'html' is TRUE.
Pushpinder Rana #pushpinderdrupal
Acquia Certified Drupal Expert
Thanks, with that parameter I
Thanks, with that parameter I solved the problem