Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

change printer-icon section in print popup 7 years 4 months ago #17879

  • Bluefox
  • Bluefox's Avatar Topic Author
  • Offline
  • Moderator
  • Moderator
  • Posts: 4525
  • Thank you received: 492
If you wondering how to change the layout in the print popup then here some information.

Let's say we have a printer icon in the eventslist-view


and when pressed it will be looking like this image


so how did i change the icon part?


did add this code in the default_events_table.php
<div id="printer_icon">
<div class="printer_icon center">
<?php 
$text = JHtml::_('image', 'com_jem/printer.png', JText::_('COM_JEM_PRINT'), 'title="Afdrukken"', true);
$desc = JText::_('Klik om het overzicht af te drukken');
$title = JText::_('Afdrukken');
$tip = JHtml::tooltipText($title, $desc, 0);
$url = '#';
$attribs = array();
$attribs['title']   = $tip;
$attribs['class'] = '';
$attribs['onClick']   = 'window.print();return false;';
$output = JHtml::_('link', JRoute::_($url), $text, $attribs);
echo $output;
?>
</div></div>

did add this code in jem.css
 div#jem div#printer_icon {
 	display:none;
 }
doing so will hide the div when a visitors views eventslist normally.

did add this code in print.css
div#jem div#printer_icon {
 	display:block;
 	margin-top: 10px;
 	margin-bottom: 10px;
 	height: 40px;
 }
doing so will show the div when a visitor clicks at the print-icon.


i know it ain't perfect but it gives an idea.
and yes i'm hardcoding language strings at the moment and as i'm not using different languages it ain't a problem for me.
(won't respond to PM)
==================================================================
running: pre-alpha JEM 4.x (custom version) + Joomla 4.0.0-beta7 + PHP 7.3
Attachments:

Please Log in or Create an account to join the conversation.

Last edit: by Bluefox.

change printer-icon section in print popup 7 years 4 months ago #17880

  • Hoffi
  • Hoffi's Avatar
  • Offline
  • Platinum Member
  • Platinum Member
  • Posts: 2279
  • Thank you received: 449
Hm... I don't understand the use-case. :unsure:

On normal page you will have a button which opens the print preview popup.
In this popup a slightly different layout is shown with a completely different button to send this page to a printer.
So there is no need to hide any button because there should be only one of these two buttons present.

It should be useful to add a line "$this->print = $print;" in the view.html.php files where missing to make it easier within the template but then I would check this flag to decide how to construct the content.
Pessimists are optimists with experience!

Please Log in or Create an account to join the conversation.

change printer-icon section in print popup 7 years 4 months ago #17881

  • Bluefox
  • Bluefox's Avatar Topic Author
  • Offline
  • Moderator
  • Moderator
  • Posts: 4525
  • Thank you received: 492
well it's was more about hiding/showing a block.

basicly it's possible to show anything in the print.css (not only the printer icon). The code for the printer-icon in the output class is indeed looking for the print variable so guess i should have made a better example :)
(won't respond to PM)
==================================================================
running: pre-alpha JEM 4.x (custom version) + Joomla 4.0.0-beta7 + PHP 7.3

Please Log in or Create an account to join the conversation.

change printer-icon section in print popup 7 years 4 months ago #17882

  • Hoffi
  • Hoffi's Avatar
  • Offline
  • Platinum Member
  • Platinum Member
  • Posts: 2279
  • Thank you received: 449
Ok, then let's make a very little css lesson. ;)

#whatever { display: none; }
will completely hide the element with id whatever, also not taking any space for that as if it wouldn't exist.

#whatever { show: hidden; }
instead will also hide the element with id whatever, but takes space as if the element would be shown.

In most cases "display: none" is the best choice but if things should be toggled dynamically, e.g. depending on user selections "show: hidden" could be useful to prevent jumping elements.
Pessimists are optimists with experience!
The following user(s) said Thank You: Bluefox

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Time to create page: 0.477 seconds

Donate

If you find JEM useful and if you use it on your site, please consider a donation to the project.

Private Messages

You are not logged in.

Follow us......