It would be very nice to be able to specify in the code (fairly easily) that for specific content types certain print.node.tpl.php and css files are called. Something like what you can do in template.php would be nice. Maybe a seperate file called print_template.php that is set to call the print.node.tpl.php and print.css by default but has some commented out code that allows others to set the specific tpl and css files.
This is becuase for some node types it is sometimes necessary to put in page breaks after certain elements, logos, etc or but on other content types you wouldn't want this to happen.
If there is an easier way to do this let me know!
Great module and great recent upgrades!
Comments
Comment #1
jcnventuraWell, you are quite active in creating issues today!
I am marking this as a duplicate of http://drupal.org/node/171172. That (and print comments are my planned next developments).
What I will do is enable the following:
look for print.__content__type.tpl.php in:
the current theme folder
the print module folder
if that fails look for print.node.tpl.php in:
the current theme folder
the print module folder
I think this will enable people to do whatever they want with content types and location of the template file (i.e. theme-specific templates would be in the theme folder, and general changes would be in the module folder).
Re-activate this again if the above solution does not address your request.
João
Comment #2
nathanraft commentedYes, pretty pumped about his module. Printing more complicated, tabbed, etc, cck types is just messy with the standard print features. So this module is exactly what is needed!
Looks good...I just am not sure how this would allow one to specify a different css sheet to use... (not much of a coder).
Currently the module includes print.css which is pulled through the print css statement in the tpl file. Would you specify the css sheet to include in the content specific tpl or would this have to be done elsewhere? I would guess we don't want to include many versions of a css (i.e. node-print.css , node-type-print.css). As I need seperate css files in addition to seperate tpls I just don't get how this would be done.
If this is inherently solved in your plan just ignor this post...
Thanks again.
Comment #3
jcnventuraBasically, once you have control (starting from today...) on the template file, you can do whatever you want. You can choose to not use the $print['css'] line and use your own stylesheet..
Since the theme/module-nodetype/generic mechanism is versatile enough to do anything you want, I don't think that it's necessary to provide a way to use different css files via the module (other than the simple method now supported). I assume that if users can find out how to generate their own template files, they can also come up with their own PHP code in them to suit their needs.
Take into account also, that the classes used to select the CSS formatting are also defined in the template file, so you can also keep using the configured CSS file and just alter all the templates to define the necessary set of styles (recommended, since you can then better reuse the styles).
João
Comment #4
nathanraft commentedJust finishished testing it all and it works great.
I had a brain fog and wan't thinking about that fact that in the tpl file for each node type I could simply change the print-content class to print-content-node-type and simply add elemements to my print.css file.
This completely solves my problem of having different printing capabilities on a per node-type basis!
Is this a sponsored module or are you doing this on your own just for S&Gs?
Comment #5
jcnventuraI use Drupal and print in my own (humble) website, and I didn't like the way it was(n't) mantained until recently...
So I decided to give a little back to the community (Drupal in particular and open-source in general)..
However, I do it in my own time, so there may be times where only urgent (and easy to fix) things are updated.
I do test the module for any security leaks (unauthorised access by using the print/ prefix), so I don't think that anything urgent will pop up.
Don't worry about the brain fog.. In reality, I only answered what I did after trying to plan what you asked (per-type CSS) and reaching the conclusion that: a) the code would look ugly and b) it wasn't really needed.
João