0
Welcome Guest! Login
0 items Join Now

Where to post a question that would relate to any template? + print style

  • Where to post a question that would relate to any template? + print style

    Posted 17 years 8 months ago
    • Hi,
      I didn't find any posts when I searched for the general words "print style" or "print css" or "custom print stylesheet" and this subject might be of use to members regardless of the template. My apologies if there an umbrella general template issues section, I did not see one.

      Question 1. Can you add a print style sheet to a rocketheme template?

      Goal: To have the client's logo on the printed content and have the site font switch to Times Roman when the Joomla! print button is clicked on.

      Here is a site I would like to do this on that uses Colormatic, (but isn't this going to be the same answer whatever template?)
      www.bbvh.com/index.php

      Question 2: How to add a general print style sheet to any templated joomla site?

      I am wondering where you would put a print style sheet that would apply when people hit their print button in their browser rather than the print button in the page -- as people will do :(

      I realize this will not give them the nice clean print version of the main page content but it would at least switch the font and maybe even hide the menu if the style had something akin to #menu {display: none}

      Can one follow the same procedure as on a non-templated site and add something like this to the header?
      (source: alist apart - www.alistapart.com/articles/goingtoprint/  ; )

      <style type="text/css" media="all">
      @import "nucss2.css";
      </style>

      <link rel="stylesheet"
      type="text/css"
      media="print" href="print.css" />

      ....and if so how and where would it go -- into the template index page, the root index page, the index 2 page or an index2 page in the template's or....?


      If anyone else has had to consider print style issues I would appreciate hearing your solutions.
      Thanks!
      Julie
    • Last Edit: 17 years 8 months ago by Julie Vetter.
    • GollumX's Avatar
    • GollumX
    • Elite Rocketeer
    • Posts: 2817
    • Thanks: 0

    Re: Where to post a question that would relate to any template? + print style

    Posted 17 years 8 months ago
    • Try making a copy of template_css.css and renaming it print.css. Then change the elements you want eg:
      Change font-family from:
      font-family: Arial, Helvetica, sans-serif;
      to..
      font-family: "Times New Roman", serif;

      I'd also:
      • Remove the background image and set bg color to #fff.
      • Hide the menu with either div#horiz-menu {display: none;} (hides the menu) or div#horiz-menu {visibility: hidden;} (hides menu but shows the space it would normally occupy.
      • Change background of dv#section1 and div#section2 to just #fff.
      • Change font-size from 12px to 12pt

      Link to the stylesheet with:
      <link href="http://www.bbvh.com/templates/rt_colormatic7/css/print.css" rel="stylesheet" type="text/css" media="print" />

      Maybe during the testing phase remove template_css.css from index.php and set the media type of print.css to screen. Then hack away until It looks cleaner... at which point change it back to media="print" and test with a printer.

      I need to do a bit more research on Question 2 myself :)
    • Say no to Internet Explorer 6.
      twitter.com/mark_up
  • Re: Where to post a question that would relate to any template? + print style

    Posted 17 years 8 months ago
    • Thanks for the tips! I will give that a try.
      Embarrassing question:
      Do you know which file and where I put the link to the print.css? I am not quite sure and don't see the reference to the template css where it would usually be in a non-cms site.

      Julie
    • GollumX's Avatar
    • GollumX
    • Elite Rocketeer
    • Posts: 2817
    • Thanks: 0

    Re: Where to post a question that would relate to any template? + print style

    Posted 17 years 8 months ago
    • Open up your template index.php file (/templates/[template_name]/index.php) and enter the line:
      <link href="<?php echo $mosConfig_live_site;?>/templates/<?php echo $mainframe->getTemplate(); ?>/css/print.css" rel="stylesheet" type="text/css" media="print" />

      Immediately before the line..
      <link href="<?php echo $mosConfig_live_site;?>/templates/<?php echo $mainframe->getTemplate(); ?>/css/template_css.css" rel="stylesheet" type="text/css" />


      Save your print css file in the /templates/[template_name]/css/ directory
    • Say no to Internet Explorer 6.
      twitter.com/mark_up
    • GollumX's Avatar
    • GollumX
    • Elite Rocketeer
    • Posts: 2817
    • Thanks: 0

    Re: Where to post a question that would relate to any template? + print style

    Posted 17 years 8 months ago
    • Further research indicates that this method only works for the browser print button, and not the Joomla print button. You can either turn off the Joomla print button, or dig into the joomla forums on how to fix the Joomla print css. Apparently you have to create a separate index2.php file in your template folder, but I have not ventured there before so can't help ya. sorry.
    • Say no to Internet Explorer 6.
      twitter.com/mark_up
  • Re: Where to post a question that would relate to any template? + print style

    Posted 17 years 8 months ago
    • Thank you for the specifics, adding the print style sheet to the template index file did just as you described, it was applied to the browser print and print preview buttons but not the joomla print button central content area.

      I found a workaround for that in joomla.com after several earlier fruitless hunting trips, here is one workaround if anyone else has the same sort of problem. This does work for adding a logo to the joomla print button results (I have not made it live yet at bbvh.com but it works)

      Here is the post in joomla.com forum which also separates the print and email style sheets:
      forum.joomla.org/index.php/topic,134845....60533.html#msg960533

      Here is the code that I got to work, in Joomla 1.0.x, by modifying the joomla root index2.php file
      (maybe it should be an index2.php file in the template root instead?
      but this worked)

      around line 140 in Joomla 1.0.x root index2.php

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
      <html xmlns=" www.w3.org/1999/xhtml ">
      <head>
      <?php echo $mainframe->getHead(); ?>
      <link rel="stylesheet" href="templates/<?php echo $cur_template;?>/css/print_css.css" type="text/css" />
      <link rel="shortcut icon" href="<?php echo $mosConfig_live_site; ?>/images/favicon.ico" />
      <meta http-equiv="Content-Type" content="text/html; <?php echo _ISO; ?>" />
      <meta name="robots" content="noindex, nofollow" />
      <?php if ($my->id || $mainframe->get( 'joomlaJavascript' )) { ?>
      <script language="JavaScript" src="<?php echo $mosConfig_live_site;?>/includes/js/joomla.javascript.js" type="text/javascript"></script>
      <?php } ?>
      </head>
      <body class="contentpane">
      <!-- print logo & address details for print header -->
      <table width="700" border="0">
      <tr>
      <td width="694"><div align="left"><img name="" src="images/logo_lg.gif" width="348" height="80" alt="sitename" /></div></td>
      </tr>
      <tr>
      <td><p class = "address">California Street<br />
      San Francisco | California 94111<br /></p>
      </td>
      </tr>
      <tr>
      <td> </td>
      </tr>
      </table>

      <table width="100%" ></table>
      <?php mosMainBody(); ?>
      </body>
      </html>
      <?php
      }
      } else {
      mosMainBody();
      }
      doGzip();
      ?>
    • GollumX's Avatar
    • GollumX
    • Elite Rocketeer
    • Posts: 2817
    • Thanks: 0

    Re: Where to post a question that would relate to any template? + print style

    Posted 17 years 8 months ago
    • Great to hear you got it working, and thanks for sharing how.

      Joomla first checks whether an index2.php exists in "/templates/[template_name]/" and if it finds none it uses the main joomla index2.php, hacks of which you have described above. I think your method requires less work lol.
    • Say no to Internet Explorer 6.
      twitter.com/mark_up

Time to create page: 0.073 seconds