obamaself Posted May 14, 2012 at 10:09 AM Report #455335 Posted May 14, 2012 at 10:09 AM Boas, é possível imprimir em php só uma tabela, em vez do documento todo?
KTachyon Posted May 14, 2012 at 10:21 AM Report #455337 Posted May 14, 2012 at 10:21 AM Como assim? Tu em PHP podes imprimir o que quiseres, independentemente de ser HTML ou não. “There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.” -- Tony Hoare
obamaself Posted May 14, 2012 at 10:23 AM Author Report #455338 Posted May 14, 2012 at 10:23 AM mas como é que faço isso?
KTachyon Posted May 14, 2012 at 10:25 AM Report #455339 Posted May 14, 2012 at 10:25 AM (edited) Continuo sem perceber o que queres fazer exactamente, mas aqui vai: echo "o que quer que queiras imprimir"; Edited May 14, 2012 at 10:26 AM by KTachyon “There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.” -- Tony Hoare
obamaself Posted May 14, 2012 at 10:29 AM Author Report #455342 Posted May 14, 2012 at 10:29 AM (edited) 🙂 nao e isso, imprimir para impressoras. Eu uso: <a HREF="javascript:window.print()">Imprimir pagina</a> mas isto imprime a página inteira, eu quero apenas uma tabela. Edited May 14, 2012 at 10:29 AM by obamaself
KTachyon Posted May 14, 2012 at 10:34 AM Report #455345 Posted May 14, 2012 at 10:34 AM Lol. Nesse contexto já faz mais sentido. Mas essa dúvida não tem nada a haver com PHP. Aquilo que podes fazer é definir um stylesheet (css) específico para impressão: <link rel="stylesheet" href="print.css" type="text/css" media="print" /> “There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.” -- Tony Hoare
obamaself Posted May 14, 2012 at 10:38 AM Author Report #455347 Posted May 14, 2012 at 10:38 AM e o que tem nesse stylesheet? não tem a haver com php porquê?
KTachyon Posted May 14, 2012 at 10:53 AM Report #455353 Posted May 14, 2012 at 10:53 AM (edited) Porque o PHP é server-side. Quando a página chega ao browser, já não existe PHP. Na stylesheet colocas o que quer que seja necessário para que a impressão saia da forma como queres. Se tiveres a página bem estruturada, só tens que esconder as componentes que não queres que sejam imprimidas. Por exemplo: <div id="header">...</div> <div id="tabela">...</div> <div id="coisas">...</div> <div id="footer">...</div> print.css: #header, #coisas, #footer { display: none; } Apenas a div tabela irá aparecer na impressão. Edited May 17, 2012 at 01:06 PM by brunoais Passar a usar o geshi “There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.” -- Tony Hoare
obamaself Posted May 14, 2012 at 11:54 AM Author Report #455367 Posted May 14, 2012 at 11:54 AM (edited) já funciona, obrigada 🙂 Edited May 14, 2012 at 11:56 AM by obamaself
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now