Print template for spicific page.
Moderator: mikey
Print template for spicific page.
I administer a page of a restaurant. There is adjusted a script publishing a daily menu every day at a specific time. The menu looks like this and is called into the newsbox on the right at the specified time.
I would like to have a "print button" on the page thet would print the very page with some unique styling (e.g. banner, logo, footer, blank background, another font sizes etc.).
The direct link .../?!!!_denne_menu&print doesn't work as expected (400). It must be written as .../?%21%21%21_denne_menu&print. Evidently some setting is wrong. But how to set the styling for "print" only for this only page?
I would like to have a "print button" on the page thet would print the very page with some unique styling (e.g. banner, logo, footer, blank background, another font sizes etc.).
The direct link .../?!!!_denne_menu&print doesn't work as expected (400). It must be written as .../?%21%21%21_denne_menu&print. Evidently some setting is wrong. But how to set the styling for "print" only for this only page?
CMSimple.sk
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.
Re: Print template for spicific page.
That's expected behavior, since the exclamation mark (!) is a reserved character according to RFC 3986, and as such must be escaped. You can use urichar_org/new to remove all exclamation from the URL.
It's a bit tricky to style the printview of individual pages. Maybe the simplest solution is to link a separate stylesheet on the newspage, for instance:Tata wrote: ↑Fri Jun 29, 2018 5:05 amI administer a page of a restaurant. There is adjusted a script publishing a daily menu every day at a specific time. The menu looks like this and is called into the newsbox on the right at the specified time.
I would like to have a "print button" on the page thet would print the very page with some unique styling (e.g. banner, logo, footer, blank background, another font sizes etc.).
Code: Select all
#CMSimple $hjs .= '<link rel="stylesheet" href=" . $pth['folder']['template'] . 'mystyle.css">';#
Christoph M. Becker – Plugins for CMSimple_XH
Re: Print template for spicific page.
Thanks, Chris!
I think that renaming the page would be much simpler and safer.cmb wrote: ↑Fri Jun 29, 2018 9:51 amThat's expected behavior, since the exclamation mark (!) is a reserved character according to RFC 3986, and as such must be escaped. You can use urichar_org/new to remove all exclamation from the URL.
There is a problem with the editor though. Inserting the code after the page title there remains after saving onlycmb wrote: It's a bit tricky to style the printview of individual pages. Maybe the simplest solution is to link a separate stylesheet on the newspage, for instance:(not sure if TinyMCE likes that, though)Code: Select all
#CMSimple $hjs .= '<link rel="stylesheet" href=" . $pth['folder']['template'] . 'mystyle.css">';#
Code: Select all
#CMSimple $hjs .= '';#
CMSimple.sk
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.
Re: Print template for spicific page.
Please try:Tata wrote: ↑Fri Jun 29, 2018 10:09 amThere is a problem with the editor though. Inserting the code after the page title there remains after saving onlyCode: Select all
#CMSimple $hjs .= '';#
Code: Select all
#CMSimple $hjs .= chr(60) . 'link rel="stylesheet" href="' . $pth['folder']['template'] . 'mystyle.css"' . chr(62);#
Last edited by cmb on Fri Jun 29, 2018 12:11 pm, edited 1 time in total.
Reason: Fixed code snippet
Reason: Fixed code snippet
Christoph M. Becker – Plugins for CMSimple_XH
Re: Print template for spicific page.
Auch eine Möglichkeit, einzufügen in template.htm.
„Bevor du den Pfeil der Wahrheit abschießt, tauche die Spitze in Honig!“ Ludwig's XH-Templates for MultiPage & OnePage
Re: Print template for spicific page.
XHdebug:
Parse error: syntax error, unexpected 'link' (T_STRING) in /Users/msereday/webpages/ukastelana-aktual/cmsimple/functions.php(183) : eval()'d code on line 1
CMSimple.sk
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.
Re: Print template for spicific page.
That wouldn't work for the print view, though, since the print view doesn't use template.htm (but an own minimal built-in template instead).
Oops! I've fixed the code snippet above now.
Christoph M. Becker – Plugins for CMSimple_XH
Re: Print template for spicific page.
Half way good.
The stylesheet "mystyle.css" is accepted and works fine. But for the "daily menu" page it works all the time (&normal or &print).
The stylesheet "mystyle.css" is accepted and works fine. But for the "daily menu" page it works all the time (&normal or &print).
CMSimple.sk
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.
Re: Print template for spicific page.
The print view sets class print for the body element, which you can use to apply the styles only to the print view, e.g.
Code: Select all
body.print p {font-size: 2em}
body.print a {text-decoration: none}
Christoph M. Becker – Plugins for CMSimple_XH
Re: Print template for spicific page.
Super" It works this way wonderful.
CMSimple.sk
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.