Page 1 of 1

print function does not include the print_layout.css

Posted: Tue 15. Aug 2006, 01:21
by silver
Hi everybody,

I've just updated to the 1.2.8 and everything works fine for me.

Now I have a litte trouble with the built-in print function:

First I had to comment out line 62 in switchFontSize.php that has caused an php error when rendering the print page.

Now I found, that the print_layout.css gets not included into the generatet print page and therfore I cannot customize the print layout.

Does Anyone have an idea?
Thanks in advace.

silver

Re: print function does not include the print_layout.css

Posted: Tue 15. Aug 2006, 03:27
by DeXXus
silver wrote:First I had to comment out line 62 in switchFontSize.php that has caused an php error when rendering the print page.
How about listing the "actual" error?

Posted: Tue 15. Aug 2006, 12:30
by silver
Hi DeXXus,

the error when NOT commenting out line 62 was:

Code: Select all

Fatal error: [] operator not supported for strings in /neu/phpwcms_template/inc_script/frontend_render/switchFontSize.php on line 62
After I Had commented it out, the print layout renders, but the print_layout.css is not included. (When I look in the source code of the rendered print layout in my browser, I see, that there is no CSS File included.)

BR

silver

Posted: Tue 15. Aug 2006, 12:34
by kaju74
Just replace

Code: Select all

$block['css'][]  = 'fontSize/'.$newFontSizeCSS;
with

Code: Select all

if(is_string($block['css']))
  $block['css'] = array($block['css']);

$block['css'][]  = 'fontSize/'.$newFontSizeCSS;
and everything seems to work :D

Posted: Tue 15. Aug 2006, 12:47
by silver
Hi kaju74,

Thanks a lot!

That works! :D

Have a good day

silver

Posted: Wed 16. Aug 2006, 20:11
by Oliver Georgi
It's fixed. In content.func.inc.php around line 360 change it to this

Code: Select all

//if print layout should be shown
$block["css"][]	= 'print_layout.css'; //sets css to standard printing layout
Oliver

print_leayout.css not included in v.1.3.3 ?

Posted: Sat 14. Jul 2007, 04:41
by vlado
Is this still missing in v1.3.3 ???

Re: print_leayout.css not included in v.1.3.3 ?

Posted: Sat 14. Jul 2007, 05:18
by DeXXus
vlado wrote:Is this still missing in v1.3.3 ???
The whole "method" was changed right AFTER this thread:
"changelog.txt"
2006-08-17
[FIX] Print CSS file is added as array element now - the original has set $block['css'] back to string which might result in an error.

Posted: Sat 14. Jul 2007, 15:06
by vlado
So how does it work now? It still does not include print_layout.css when I use [PRINT] tag in 1.3.3

Posted: Sat 14. Jul 2007, 21:27
by DeXXus
vlado wrote:So how does it work now? It still does not include print_layout.css when I use [PRINT] tag in 1.3.3
OK, it ~looks~ like this thread answers your question:

http://www.phpwcms.de/forum/viewtopic.p ... int+layout
Wrapping your [PRINT][/PRINT] tags with the <!--NO_PRINT_START//--> and <!--NO_PRINT_END//--> delimiters

BUT that seems to be BECAUSE the coding to apply "print_lauout.css is written like this in "content.func.inc.php":

Code: Select all

// check if print mode - then try to replace "no-print" sections from source
if(strpos($content['all'], 'NO_PRINT')) {
	if($aktion[2] == 1) {

		$content['all'] = replace_tmpl_section('NO_PRINT', $content['all']);
		$block['css']	= array('print_layout.css');

	} else {

		$content['all'] = str_replace(array('<!--NO_PRINT_START//-->', '<!--NO_PRINT_END//-->'), '', $content['all']);

	}
}
It seems to be ONLY "applied" WHEN WRAPPED (using that program logic).
Try changing this portion:

Code: Select all

	} else {

		$content['all'] = str_replace(array('<!--NO_PRINT_START//-->', '<!--NO_PRINT_END//-->'), '', $content['all']);
To this:

Code: Select all

	} else {

		$content['all'] = str_replace(array('<!--NO_PRINT_START//-->', '<!--NO_PRINT_END//-->'), '', $content['all']);
		$block['css']	= array('print_layout.css');

Posted: Sun 15. Jul 2007, 02:01
by vlado
Ok, now I see. So I have two options:

1. include in my print.tmpl <!--NO_PRINT_START//--><!--NO_PRINT_END//-->
this is an only way how content.func.inc.php replaces all other xxxx.css with only one - print_layout.css in page without changing php code.

2. change code in content.func.inc.php
I think more logical than Dexxus way is to add a line under this comment line as Oliver suggested but I want to replace frontend.css not just add print_layout.css:

Code: Select all

//if print layout should be shown 
$block["css"][0]   = 'print_layout.css'; 
In this case you don't need to worry about NO_PRINT tags at all and it will replace only first css (usually frontend.css) by print_layout.css.

Am I correct?