print.css - needing pointers on how to use

Get help with installation and running phpwcms here. Please do not post bug reports or feature requests here.
User avatar
jsw_nz
Posts: 907
Joined: Fri 2. Apr 2004, 02:42
Location: New Zealand

print.css - needing pointers on how to use

Post by jsw_nz » Thu 17. May 2007, 03:33

OK, although I have been around awhile with wcms
- have not really studied the print options that much
- and am confused about substituting/swapping frontend.css with print.css
(JUST WANT TO Have print.css TO CONTROL FINE-TUNED PRINT OUTPUT)
- basically looking at this for the first time
- so pointers on how some have done this appreciated

Right now the frontend.css stylesheets are being used
when I click the print button and the content opens in new window....

embarassed
:?

User avatar
Oliver Georgi
Site Admin
Posts: 9599
Joined: Fri 3. Oct 2003, 22:22
Location: Moscow, Russia
Contact:

Post by Oliver Georgi » Thu 17. May 2007, 10:18

in my eyes print and normal display are different things. You can add special @print css beside of phpwcms' print function. But the you will have to use a lot of display:hidden and such stuff.

Oliver
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон

pepe
Posts: 3954
Joined: Mon 19. Jan 2004, 13:46

Post by pepe » Thu 17. May 2007, 11:57

what do you think off something like this?
<!-- ...../template/inc_default/print.tmpl revision: 2007.05.15
====================================================================
pepes "print.tmpl" used by the PRINT-RT of "phpwcms_130..."
====================================================================
//-->

<!-- If you don't want to use the default print_layout.css - in versions lt. 1.3.3 - load another stylesheet: print.css -->
<style type="text/css">
<!-- @import url("template/inc_css/print.css"); //-->
</style>


<div style="START of your print-wrapper here">

<div>Your header-text and/or imag here please.</div>


<!-- Output of - phpWCMS-content { CONTENT } -->
<div>{CONTENT}</div>

<!-- And if you need it...: It's possible, to print out other Fields - like the sidebars - too!
<div>{ LEFT}</div>
<div>{ RIGHT}</div>
<div>{ JOHNS_CUSTUM_BLOCK}</div>
//-->

<!-- Output of - URL -->
<div style="text-align:center; margin:10px 0;">URL of this page: {CURRENT_URL}</div>


<div>Your footer-text goes here.</div>

</div><!-- END of print-wrapper -->
Now there is the 2. css-file, to have an influence of the way, your output will look.

i allways make a copy of my frontend.css, fill in some display:none; /* <<< */ and throw away, what is not needed for the printout version of my pages.

That's MY solution of the "print problem" :wink: Not that elegent.... but works :D
Last edited by pepe on Thu 17. May 2007, 12:37, edited 1 time in total.

User avatar
jsw_nz
Posts: 907
Joined: Fri 2. Apr 2004, 02:42
Location: New Zealand

Post by jsw_nz » Thu 17. May 2007, 12:35

Thanks Oli
for the suggestions AND template file

and
Thanks Pepe
for the further suggestions

Starting to understand - hehe
:D

been modifying the content.func.inc.php file - to use a custom block as print template - similar in concept - another approach - but a hack:
Basically any named custom block: PRINT_ARTICLE
is adressed using $block['customblock_PRINT_ARTICLE']

Code: Select all

if($content['all']) {
				$content["all"]	= str_replace('{CURRENT_URL}', PHPWCMS_URL.'index.php'.returnGlobalGET_QueryString('htmlentities'), $content["all"]);
				$content["all"]	= str_replace('{CONTENT}', $block['customblock_PRINT_ARTICLE'], $content["all"]);
			} else {
				$content["all"]	= str_replace('{CONTENT}', $block['customblock_PRINT_ARTICLE'], $content["all"]);
			}
Clearly using the provided print template is the better way - the reason I am using the other custom block approach is I am using two css layouts - one for list and one for full article - thus the need for two print templates...

pepe
Posts: 3954
Joined: Mon 19. Jan 2004, 13:46

Post by pepe » Thu 17. May 2007, 14:39

since 1.2.9? we are working with special List-templates!!!
With its own Classes! Default and custom as well !


So what, if you throw out all inline-styles, fill in your own special classes and then you are able to make all the formatting job inside your frontend.css and print_layout.css.

Using some sub-classes, it MUST be possible, to reach your target without any "code-cracking"!

And because you can choose different news-list.tmpl files inside the article basicinformation of the backend... you will start up to the moon :wink:


But it would be great, if OG would add an "additional argument" to th RT

{PRINT}PRINT{/PRINT}

something like:

{PRINT:MyOWNprint.tmpl}PRINT{/PRINT}

So we could choose different templates with its own print-solution...

User avatar
Oliver Georgi
Site Admin
Posts: 9599
Joined: Fri 3. Oct 2003, 22:22
Location: Moscow, Russia
Contact:

Post by Oliver Georgi » Thu 17. May 2007, 17:26

sorry, print is just a comfortable way for customers to print the MAIN content of a page. There is no need for multiple templates! Why should? Nobody will print overview pages or such useless information. Only articles are interesting - Logo, link, headline, content section...

I will not support multiple print templates.

Oliver
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон

User avatar
Oliver Georgi
Site Admin
Posts: 9599
Joined: Fri 3. Oct 2003, 22:22
Location: Moscow, Russia
Contact:

Post by Oliver Georgi » Thu 17. May 2007, 17:32

and remember: sections which should not be printed can be wrapped in

Code: Select all

<!--NO_PRINT_START//-->
<this will not be printed when selecting phpwcms "print">
<!--NO_PRINT_END//-->
You can use NO_PRINT wrapper as often as you need/like.

Oliver
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон

User avatar
StudioZ
Posts: 802
Joined: Fri 28. May 2004, 19:57
Location: Québec, Canada
Contact:

Post by StudioZ » Thu 17. May 2007, 18:08

Coming a bit late in the subject but...
Here's what I only have in my print_layout.css file :
Ex. Ref.: logotypes.ca

@import url("frontend.css");

body {
font-family: "Lucida Grande", Verdana, Helvetica, sans-serif;
font-size: 11px;
color: #4D4D4D;
margin: 15px 40px 40px 40px;
background-color: #FFFFFF;
}


All I needed was the special control on margins when printed.
All other formating comes from frontend.css

Hope it helps :roll:

Yves
Image
PhpWCMS Evangelist, -- iRoutier.com Running phpWCMS 1.4.2, r354 -> Great Version!!!!

User avatar
jsw_nz
Posts: 907
Joined: Fri 2. Apr 2004, 02:42
Location: New Zealand

Post by jsw_nz » Thu 17. May 2007, 18:22

Cheers Oliver - i do understand - actually makes sense

could I ask a related question - I raised this a while back - basically the ability to have separate pagelayout templates for article listing vs full article. I have a need for this for a research project - basically needing nearly full width of page for full article (no left or right column content) I was attracted to this as part of Wordpress.

I did discuss this in a raw fashion in this thread. I do have a hack working

http://www.phpwcms.de/forum/viewtopic.p ... ght=#69605


- wanted to ask if you see the logic in this - any plans to implement...this is a designers dream capability: please say yes(ja) - at some stage.

:)

User avatar
Oliver Georgi
Site Admin
Posts: 9599
Joined: Fri 3. Oct 2003, 22:22
Location: Moscow, Russia
Contact:

Post by Oliver Georgi » Thu 17. May 2007, 19:24

regarding you switching template - hm maybe I don't really understand. Sceenshots would help a bit better.

There is a special article listing template - can be used to place any additional stuff you like before or after listing - same for article.

template/inc_default/article_summary_list.tmpl

Oliver
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон

User avatar
jsw_nz
Posts: 907
Joined: Fri 2. Apr 2004, 02:42
Location: New Zealand

Post by jsw_nz » Thu 17. May 2007, 20:21

Hi Oliver -
do appreciate your time - with all the other stuff you do and have to manage-

Here are the two screenshots - top one is article list pagelayout template
and the bottom is full article pagelayout - the principle is to offer this choice of page layouts themselves.....


ARTICLE LIST PAGELAYOUT TEMPLATE

Image


FULL ARTICLE PAGELAYOUT TEMPLATE


Image

this is content.func.inc.php modification
(using custom blocks)

Code: Select all

case 2: //create the page layout based only on the content of main block
				//$content["all"]	= $block["maintext"];//
				// break;
				// modification jsw_nz
				$int_val_count = intval($GLOBALS['content']["article_list_count"]);
				global $article_listmode;
				if ($int_val_count > 1){
					// show listing only
					$article_listmode = 1;
					$content["all"] .= $block['customblock_LIST_ARTICLE'];
				}else{
					// show full article
					$article_listmode = 0;
					$content["all"] .= $block['customblock_FULL_ARTICLE'];
				}
				$content["all"] .= $block["footertext"];
				break;
cheers
:)

User avatar
Oliver Georgi
Site Admin
Posts: 9599
Joined: Fri 3. Oct 2003, 22:22
Location: Moscow, Russia
Contact:

Post by Oliver Georgi » Fri 18. May 2007, 00:16

this is pretty easy with the template and little CSS

use default templates and absolute/relative positioned divs.

But I would recommend usage of frontend_render. Inline PHP code is no good solution.

Oliver
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон

User avatar
jsw_nz
Posts: 907
Joined: Fri 2. Apr 2004, 02:42
Location: New Zealand

Post by jsw_nz » Fri 18. May 2007, 00:42

thanks - I think I am missing something -

if <div class="calendar">...</div> exists in pagelayout template,
-- using frontend.css stylesheet .calendar {display:block; etc; etc;}
the pagelayout template is a common 'wrapper' to both article-list and full-article scenarios,

then in Full Article template
display:block could be overriden by using
imported (@import) css statement that declares:

.calendar {
display:none:
}

The same strategy would be applied to <div class="back">...</div>,
i suppose

Is this what you are referring to - ? - never tried that....
seems confusing to me - would prefer two separte textareas in template section - easier to keep track of....

User avatar
Oliver Georgi
Site Admin
Posts: 9599
Joined: Fri 3. Oct 2003, 22:22
Location: Moscow, Russia
Contact:

Post by Oliver Georgi » Fri 18. May 2007, 11:12

I have thought about listing and article detail view again. I will implement new section tags:

Code: Select all

<!--IF_LIST_MODE_START//-->
--> will be shown when in article listing mode
--> everything wrapped in ELSE_LIST_MODE will be deleted
<!--IF_LIST_MODE_END//-->

Code: Select all

<!--ELSE_LIST_MODE_START//-->
--> will be shown when in article detail mode
--> everything wrapped in IF_LIST_MODE will be deleted
<!--ELSE_LIST_MODE_END//-->
Oliver
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон

User avatar
jsw_nz
Posts: 907
Joined: Fri 2. Apr 2004, 02:42
Location: New Zealand

Post by jsw_nz » Fri 18. May 2007, 12:16

sounds excellent

Post Reply