Print Link using Icon
Posted: Wed Sep 18, 2013 9:11 pm
Hello Community,
there are some templates that (want to) use an icon to display the link to the print view. By using the function printlink() this is not possible. Instead you can define an own function and call it appropriately. Just add the following function definition somewhere at the top of template.htm:
Instead of
now you can use the following for HTML 4.01 and 5 templates:
resp. the following for (X)HTML conforming templates:
Christoph
PS: I have already suggested to add a respective function to CMSimple_XH 1.6.
PPS: I have fixed the wrong function name in the first code division.
PPPS: For compatibility reasons I have replaced function XH_hsc() with htmlspecialchars() (XH_hsc() was introduced with CMSimple_XH 1.5.8 only)
there are some templates that (want to) use an icon to display the link to the print view. By using the function printlink() this is not possible. Instead you can define an own function and call it appropriately. Just add the following function definition somewhere at the top of template.htm:
Code: Select all
<?php
function tpl_printurl() {
global $f, $search, $file, $sn, $tx;
$t = '&print';
if ($f == 'search')
$t .= '&function=search&search=' . htmlspecialchars(stsl($search), ENT_COMPAT, 'UTF-8');
else if ($f == 'file')
$t .= '&file=' . $file;
else if ($f != '' && $f != 'save')
$t .= '&' . $f;
else if (sv('QUERY_STRING') != '')
$t = htmlspecialchars(sv('QUERY_STRING'), ENT_COMPAT, 'UTF-8') . $t;
return $sn . '?' . $t;
}
?>
Code: Select all
<?php echo printlink();?>
Code: Select all
<a href="<?php echo tpl_printurl();?>"><img src="..." alt="<?php echo $tx['menu']['print'];?>"></a>
Code: Select all
<a href="<?php echo tpl_printurl();?>"><?php echo tag('img src="..." alt="' . $tx['menu']['print'] . '"');?></a>
PS: I have already suggested to add a respective function to CMSimple_XH 1.6.
PPS: I have fixed the wrong function name in the first code division.
PPPS: For compatibility reasons I have replaced function XH_hsc() with htmlspecialchars() (XH_hsc() was introduced with CMSimple_XH 1.5.8 only)