Open a file when click on article

  • Posted by TemplatePlazza (5195) Offline
Or you can also make condition based on module id
$urls = json_decode($item->urls);
if($module->id == xxx) {
    $urla = $urls->urla;
}else{
    $urla = $item->link;
}
1 year 6 months ago #7 by TemplatePlazza
The topic has been marked as resolved.
thanks for both solutions

in the statement <a href="/<?php echo $urla; ?> "target =" _ blank " is it possible to open in a new window only if a URL is set or by indicating the module ID?

thanks
Luca
1 year 6 months ago #8 by Luca
The topic has been marked as resolved.
  • Posted by TemplatePlazza (5195) Offline
Yes of course, simply add the condition :
<?php if($item->urls) { ?>target ="_blank" <?php } ?>
or
<?php if($module->id == xxx) { ?>target ="_blank" <?php } ?>
1 year 6 months ago #9 by TemplatePlazza
The topic has been marked as resolved.
Thanks a lot for your help.

surely I am wrong something in this command, but I hope to get the result
Thanks again
<a href="<?php echo $ scream; ?> "<? php if ($ module-> id == 132) {?> target =" _ blank "<? php}?>
1 year 6 months ago #10 by Luca
The topic has been marked as resolved.
  • Posted by TemplatePlazza (5195) Offline
Yes that's correct.
You just missing closing mark and you don't need the trailing /

<a href="<?php echo $ scream; ?>"<? php if ($ module-> id == 132) {?> target =" _ blank "<? php}?> >
1 year 6 months ago #11 by TemplatePlazza
The topic has been marked as resolved.
Links are correctly opened on a new page, but this also happens for articles that do not contain links and which should be open on the same page
$urls = json_decode($item->urls);
if($item->urls) {
	$urla = $urls->urla;
}else{
	$urla = $item->link;
}
......
if($default_thumbnail_mode == 0) {
	// Show Thumbnail - Position before title
	if(($default_thumbnail_position == "top")||($default_thumbnail_position == "left") || ($default_thumbnail_position == "right")) { ?>
		<a href="<?php echo $urla; ?>" <?php if($item->urls) { ?>target ="_blank" <?php } ?> class="mfp_thumb_pos_<?php echo $default_thumbnail_position; ?>" itemprop="url"><?php echo $thumb_img[0]; ?></a>
<?php }
} ?>


Luca
1 year 6 months ago #12 by Luca
The topic has been marked as resolved.
Powered by Kunena Forum