| | I want my site (with PHP) to enable PRINT command. The usual print, with printer as output I mean. So, how can I do it? I've seen my college site use ASP and they can give me a PRINT xommand box, when I click it the printer will print the page. |
|
|
wee then we are all happy then, and since .hack//GU is not really taking part, I guess we solved his problem somewhere along the line. If so, why the hell are we discussing this?
Take a look at the Printer Functions reference. These apparently only work on certain versions of Windows, and require additional PECL extensions (I have not tested any of these functions, and therefore cannot really comment).
There's an example on the print() function listing for sending output to a printer (note that the print() function simply displays output), apparently taken from Tufat.com. This example is also on Windows, and at a glance, appears to utilize Acrobat Reader, Microsoft Word or Microsoft Excel to do the actual printing.
isnt is easier to have it in javascript? (you can always escape it into a PHP echo if you really insist)..
HTML <a href="java script:window.print()">Print</a> nothing wrong with simple stuff
Yes, doing that in javascript would be a lot easier considering you can add javascript above or below your
<?php tag. That's the great thing about php. You could also make it print with a button, not just a link.
The example in the print() command reference calls a COM event to trigger the printing, which is similar to how JavaScript operates - however, PHP is server-side, JavaScript is not. I don't think .hack//GU simply wants to print the current page rendered by the browser.
You push ctrl p or for apple the little wierd sign with the apple next to it then p.
The example in the print() command reference calls a COM event to trigger the printing, which is similar to how JavaScript operates - however, PHP is server-side, JavaScript is not. I don't think .hack//GU simply wants to print the current page rendered by the browser. That is why I mentioned escaping into PHP... as in CODE <?php echo "<a href=\"java script:window.print()\">Print</a>; ?> or what ever way of returning you happen to want to use...
Ok, now let's review what that does: causes the script to output a simple JavaScript statement in plaintext which the visitor's browser will then interpret as it will, which is exactly the same as adding it in the HTML. It isn't going to execute anything at the server's end, and solves little.
I think one (or more?) of us is misunderstanding .hack//GU's problem here. I'm assuming he wants to send output to the printer at the server, not the client. JavaScript has no control over the server whatsoever. All the window.print() function will do is cause the browser the visitor is using (assuming it supports JavaScript) to print the current webpage, with nothing happening at the server's end whatsoever. I don't know why you would want to use PHP to print anything in the first place, but as .hack//GU posted it in the PHP programming forum, I'm assuming that is what he is after. The usual print, with printer as output I mean. I take that as wanting the user to be able to print - with a printer - the page he is viewing. Perhaps .hack//GU would like to correct me? The reason I would do it in PHP is that then you can have it inside a logic syntax, which is rather handy... but then I am probably just too noobish to understand your advanced methods of thinking, arn't I? Also about escaping in PHP - dont use heredoc syntax, even if it is easier... This: CODE <?php echo '<a href="java script:window.print()">Print</a>'; ?> Will produce the exact same result as simply placing: CODE <a href="java script:window.print()">Print</a> Somewhere in the HTML. All your code is doing is outputting the text. It doesn't use PHP to print at all. Just JavaScript. No PHP. JavaScript only. PHP is not being used. JavaScript is. PHP does nothing here. JavaScript does everything. Outputing code as text does not cause it to be executed in any form; you cannot combine JavaScript and PHP to operate together at a server-level as JavaScript is client-side, and only operates from within the user's browser (if it supports JavaScript, of course). Just to re-iterate: what you are suggesting does not use PHP at all. [edit] For some reason (security?), the IPB code parser is insisting that 'javascript' become 'java script'. There should not be a space in the link.
Latest Entries
wee then we are all happy then, and since .hack//GU is not really taking part, I guess we solved his problem somewhere along the line. If so, why the hell are we discussing this?
I seem to remember suggesting how to physically print with PHP in the first post I made in this thread - the only post which, might I point out, actually addressed the problem exactly as .hack//GU described it.
I'm not saying there is never a benefit to dynamically displaying JavaScript code. If you read my previous post, I said 'In this case, there is absolutely no benefit...'. Yet you continue to insist there is. I'm glad you find my refusal to agree with pointlessly wasting time and inability to build an empty argument on that 'hilarious'. I share a similar view of your inability to grasp logic and reason.
lol, doesnt have to be double quotes, if you insist - but I dont think that one line of code will greatly influence parsing time unless you have a freaking slow server and a 5 bps server.
But say you have this huge page of code, with a switch on $page_id, and heredoc constructs for page output. Obviously, if you put the JS as plain html, it will appear on every single page which the switch concerns - This may not be very desirable, so you would then put it in PHP. Please, try to look from a different point of view. I am not saying that the result is any different from just plain html, or that PHP would be the one doing the printing. All I am saying - and ask Moldboy, who seems to understand my point - is that there is a benefit in putting it inside PHP. Even though PHP would not do the actual printing. And even though it could be done with just plain html/JS... I agree that this is getting silly, but I still find it hilarious that you have not grasped the point yet. But is .hack//GU even following this post? In the time we have spent arguing, he has most likely finished his site and started selling like heill... I really would like to finish my own, you know.... Moldboy, you obviously did not read the whole thread properly. But Spectre, you did not answer my question: Do you have a better PHP way of doing it?
*Sigh. Here we go again. Despite saying my previous post would be my last in this topic..
moldboy, please don't argue just for the sake of arguing. This is getting ridiculous and childish. Outputting JavaScript via PHP involves PHP doing nothing outside of sending the data as output; it has absolutely no influence over nor is it all influenced by how the outputted JavaScript operates. Obviously, having PHP send output is using PHP; I was referring to the fact that it is not using PHP to instigate whatever operation the JavaScript will then execute. In this case, there is absolutely no benefit in having PHP send JavaScript as output over simply having it contained staticly within a file - quite the opposite in fact, it will result in further processing power being required in order to have the PHP output a non-dynamic piece of plaintext, especially if you use doublequotes as elrohir suggested. Illogical, pointless things frustrate me no end.
No offence, but you two are nuts, you're not even arguing and yet seem to think that you are. One says you can't print with PHP (atleast not for the client) And the other one say that PHP doesn't parse javascript code. Both very good points, and very true, however they don't confict.
Now QUOTE Echoing JavaScript with PHP does not use PHP at all yes it does, if you do something with php it uses php when you write echo "some JS code"; it uses php, it just does. QUOTE I don't know why you would even suggest outputting JavaScript from PHP as a method that uses PHP, because it doesn't. again if you use php to echo something then you DO use php, and why, perhapse elrohir felt it would be a good idea if .hack//GU knew you could enclose javascript inside the echo statement, and perhapse then bu knowing that .hack//GU would be able to have something which would only offer the print command to users who were signed in soCODE //set user logged in state $loggedin = TRUE; //determin output based on previous decision if ($loggedin ==TRUE){ echo "the print command (I don't do JS)"; } else { echo "I'm sorry the print option is only available to registered users" }
Similar Topics
Keywords : make, print, command
(0) /biggrin.gif" style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif" /> The Best (2) I am trying to get a hosted account. Even though my previous attempt WAS denied I got this msg: (1) I want to tell to everyone who want to make IT team is very dificult if each member has another (0) Over-exercising can increase the risk of injury. Here are ways on how you can avoid this. Eat up Discussion about probable ntebook from apple (1) http://3.bp.blogspot.com/_UxH6ENd1Fpk/SM84...00-h/OLPc+2.jpg Ok so here is the concept of the new Learn how to make money online as an affiliate. (0) Hey all: Here is a 10 day e-Course about affiliate marketing. It is a broad subject and one of the (7) /biggrin.gif" style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif" /> The Best (4) But not sure were to start, have some knowledge about C++ and VB but have read that there are You can make money over here (11) Hello, guys! I found several web-sites which pay you for downloads of your files. It was (16) I'd like to start a website that offers a free service, yet in order to keep this service going Ever wanted to make your own java web-based game, but not had the time (10) Right, this is the first post of hopefully many in this thread. Basically the idea is to get many (28) Hello, all and thank you for taking a moment to read. I wonder if it is really possible for a how do i make a profile website (14) Ok this is my idea: I am making a website about anime. Its function is add anime, review anime, make and model? :D (30) I was curious on what kinda car people have o.o; I have a 91' Eagle Talon TSi AWD it has a 6 Command Prompt on right click menu (3) With this registry edit you can easily open the current folder in prompt without going through any She knows how! I don't! (6) Well the girlfriend I currently have is my first girlfriend ever. But I am not her first boyfriend, How to make your own private server and make runescape cash with it :) (76) First off you need a source: You can download one of these. QUOTE Cheezscape 80 - CS 1.6 Dedicated Server with Admin Mod and Stats Me (18) How to make a Counter Strike 1.6 Dedicated server What do we need ? HLDSupdatetool -> (13) 1.) this is the first.... go run nature runes then fletch yew longs and alch them for money you can (22) If you see these "make money online" things that say stuff envelopes, read emails or anything and you can never do that (7) an interesting thing that you never exprienced it@ try to create a file or folder named con in (21) Well, I don't think this is the right place to ask tis question but I need help. I have no idea Does It Really Make Sense?? (1) It's a fairly new question that is becoming more and more common, and it is a question that can Does anyone know how to do it? (7) I want to make an MMOG (Massively Multiplayer Online Game) similar to that of Utopia or OGame. Does Tell Me (30) Me and a friend started a conversation over a place called mugglenet, and it states on the site that Reason why u cant make some folder names in win os (9) Guys try to make con folder in win os can u??? yes ??? no??? Answer is No, bcoz their few names Learn how to make a complete signature (27) Signature Tutorial Hello. A friend of mine made this tutorial for his site, and he (19) Does anyone know any software for making exe files, I want to make simple programs not propper How to make a slideshow in JavaScript (4) JavaScript Slideshow Tutorial I'm going to show you how to make a impressive JavaScript Looking for make, print, command
|
![]() Question: Anybody Know How To Make Print Command? |
| ADD REPLY / Got an Opinion! | a humble request :-) | RAPID SEARCH! | Free Hosting | [X] |
|
Express your Opinions, Thoughts or Contribute your information that might help someone here. Ask your Doubts & Queries to get answers.. "Together, We enlight each other!" |
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP. | 500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE |
|