![]() |
Display pages php code?
Isn't there a function to display a page's source code, PHP and all? I know I've heard about it, but what is it?
I am going to try to use it for a tutorial, like one of those "type this code" things, so when you go in the browser you can see the php code and the output at the same time. |
Err.. What do you mean by that? You cannot view PHP pages source code without an actual FTP, or anything like that.. Considering it's Server Side, I don't know what you want.. Do you want to get the contents of page? ???
Wait.. Is this remote? Or...? |
no, the coder is putting the code on the page.
|
Quote:
You mean like apps where a user saves some code and its put into a database, and it displays it on the main page? |
maybe this is what your looking for:
highlight_string(): PHP: highlight_string - Manual highlight_file(): PHP: highlight_file - Manual Good luck! /EyeDentify |
That isn't it... I guess I was wrong about the function.
I can always say "copy and paste into a textarea" :/ |
I still don't understand what you're trying to accomplish, and I'm asleep here(I say that a lot cause well, time is too fast :P)
|
Maybe you mean some kind of in-browser command line interface? That's pretty easy to make with AJAX and php..
|
Quote:
|
My answer to that would be exactly the same as EyeDentify's answer. That displays source code, PHP and all.
|
You could change the extension to .phps ??
|
if your making a tutorial and want to display a peice of code in like a scroll bar you can just use good 'ol html. something like this
Code:
|
Quote:
If you want this all in the same file then where you want to have the code displayed you'll have to write out the code so it can be displayed. Where you want the results to be displayed, then you write the code so that it is executable and it outputs the results. |
I think I know what he is talking about...
Go to php.net, scroll the page all the way down to the footer and you'll see this link: show source, click it and it will show the source code of that page. This link is clickable in all pages of the site. |
And if anyone wants to do the same on their site, it even gives you the source for the source viewer :-) PHP: Show Source
Alan |
Looking at the source one can see that there's no secret, they're using the highlight_php() function too. :)
|
Thanks! :P When you said highlight_file, it didn't sound familiar, but I guess it was the thing that I was looking for.
|
| All times are GMT. The time now is 05:29 AM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0