TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 01-23-2008, 08:21 AM   #1 (permalink)
The Frequenter
 
Join Date: Dec 2007
Location: In my basement
Posts: 386
Thanks: 47
Aaron is on a distinguished road
Default 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.
Send a message via MSN to Aaron
Aaron is offline  
Reply With Quote
Old 01-23-2008, 09:13 AM   #2 (permalink)
Orc
The Prestige
 
Orc's Avatar
 
Join Date: Dec 2007
Posts: 1,044
Thanks: 193
Orc is on a distinguished road
Default

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...?
__________________
VillageIdiot can have my babbies ;d
Orc is offline  
Reply With Quote
Old 01-23-2008, 09:38 AM   #3 (permalink)
The Frequenter
 
Join Date: Dec 2007
Location: In my basement
Posts: 386
Thanks: 47
Aaron is on a distinguished road
Default

no, the coder is putting the code on the page.
Send a message via MSN to Aaron
Aaron is offline  
Reply With Quote
Old 01-23-2008, 09:39 AM   #4 (permalink)
Orc
The Prestige
 
Orc's Avatar
 
Join Date: Dec 2007
Posts: 1,044
Thanks: 193
Orc is on a distinguished road
Default

Quote:
Originally Posted by Aaron View Post
no, the coder is putting the code on the page.
The coder is putting the source code on the page? ???

You mean like apps where a user saves some code and its put into a database, and it displays it on the main page?
__________________
VillageIdiot can have my babbies ;d
Orc is offline  
Reply With Quote
Old 01-23-2008, 09:40 AM   #5 (permalink)
The Acquainted
 
EyeDentify's Avatar
 
Join Date: Nov 2007
Location: Sweden
Posts: 106
Thanks: 13
EyeDentify is on a distinguished road
Default

maybe this is what your looking for:

highlight_string():
PHP: highlight_string - Manual

highlight_file():
PHP: highlight_file - Manual

Good luck!

/EyeDentify
__________________
Of course the whole point of a doomsday machine, would have been lost if you keep it a secret.
EyeDentify is offline  
Reply With Quote
The Following User Says Thank You to EyeDentify For This Useful Post:
Aaron (01-31-2008)
Old 01-23-2008, 09:48 AM   #6 (permalink)
The Frequenter
 
Join Date: Dec 2007
Location: In my basement
Posts: 386
Thanks: 47
Aaron is on a distinguished road
Default

That isn't it... I guess I was wrong about the function.

I can always say "copy and paste into a textarea" :/
Send a message via MSN to Aaron
Aaron is offline  
Reply With Quote
Old 01-23-2008, 09:50 AM   #7 (permalink)
Orc
The Prestige
 
Orc's Avatar
 
Join Date: Dec 2007
Posts: 1,044
Thanks: 193
Orc is on a distinguished road
Default

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)
__________________
VillageIdiot can have my babbies ;d
Orc is offline  
Reply With Quote
Old 01-23-2008, 11:38 AM   #8 (permalink)
The Acquainted
 
sjaq's Avatar
 
Join Date: Nov 2007
Location: Netherlands
Posts: 113
Thanks: 11
sjaq is on a distinguished road
Default

Maybe you mean some kind of in-browser command line interface? That's pretty easy to make with AJAX and php..
sjaq is offline  
Reply With Quote
Old 01-23-2008, 12:14 PM   #9 (permalink)
The Frequenter
 
Join Date: Dec 2007
Location: In my basement
Posts: 386
Thanks: 47
Aaron is on a distinguished road
Default

Quote:
Originally Posted by Aaron View Post
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 don't know how much clearer I can get. If you don't understand that I am screwed.
Send a message via MSN to Aaron
Aaron is offline  
Reply With Quote
Old 01-23-2008, 01:38 PM   #10 (permalink)
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Default

My answer to that would be exactly the same as EyeDentify's answer. That displays source code, PHP and all.
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
Old 01-23-2008, 02:01 PM   #11 (permalink)
The Acquainted
 
Gareth's Avatar
 
Join Date: Jan 2008
Posts: 136
Thanks: 4
Gareth is on a distinguished road
Default

You could change the extension to .phps ??
Gareth is offline  
Reply With Quote
The Following User Says Thank You to Gareth For This Useful Post:
Aaron (01-31-2008)
Old 01-24-2008, 04:38 AM   #12 (permalink)
The Addict
 
sarmenhb's Avatar
 
Join Date: Jan 2008
Location: los angeles
Posts: 309
Thanks: 44
sarmenhb is on a distinguished road
Default

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:
<style type="text/css">

div {
	height: 30em;
	width: 25em;
	padding: 1em 1em 0 1em;
	overflow: auto;
	background: #fff;
	border: 1px solid #999;
    }

</style>


<body>

<div>

<pre>
the text in here will be displayed in a box with scroll bars
</pre>

</div>

</body>
the <pre> tag is what allows you to display code to the page.
__________________
no signature set
sarmenhb is offline  
Reply With Quote
Old 01-24-2008, 11:45 PM   #13 (permalink)
The Acquainted
 
wGEric's Avatar
 
Join Date: Nov 2007
Posts: 166
Thanks: 0
wGEric is on a distinguished road
Default

Quote:
Originally Posted by Aaron View Post
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.
highlight_file will do what you want. Create a page with your tutorial and then whenever you have source code, create a separate file for the source code. Use that function to put the source code in your tutorial and have a link to see the file run.

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.
__________________
Eric
wGEric is offline  
Reply With Quote
The Following User Says Thank You to wGEric For This Useful Post:
Aaron (01-31-2008)
Old 01-30-2008, 02:36 PM   #14 (permalink)
The Contributor
 
DeMo's Avatar
 
Join Date: Jan 2008
Location: Brazil
Posts: 77
Thanks: 14
DeMo is on a distinguished road
Default

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.
Send a message via ICQ to DeMo Send a message via MSN to DeMo Send a message via Skype™ to DeMo
DeMo is offline  
Reply With Quote
The Following User Says Thank You to DeMo For This Useful Post:
Aaron (01-31-2008)
Old 01-30-2008, 02:45 PM   #15 (permalink)
Alan @ CIT
Member of the Month
The Frequenter
Member of the Month Top Contributor 
 
Alan @ CIT's Avatar
 
Join Date: Apr 2005
Location: South UK
Posts: 483
Thanks: 51
Alan @ CIT is on a distinguished road
Default

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
Send a message via MSN to Alan @ CIT
Alan @ CIT is offline  
Reply With Quote
The Following User Says Thank You to Alan @ CIT For This Useful Post:
Aaron (01-31-2008)
Old 01-30-2008, 02:48 PM   #16 (permalink)
The Contributor
 
DeMo's Avatar
 
Join Date: Jan 2008
Location: Brazil
Posts: 77
Thanks: 14
DeMo is on a distinguished road
Default

Looking at the source one can see that there's no secret, they're using the highlight_php() function too. :)
Send a message via ICQ to DeMo Send a message via MSN to DeMo Send a message via Skype™ to DeMo
DeMo is offline  
Reply With Quote
The Following User Says Thank You to DeMo For This Useful Post:
Aaron (01-31-2008)
Old 01-31-2008, 11:29 AM   #17 (permalink)
The Frequenter
 
Join Date: Dec 2007
Location: In my basement
Posts: 386
Thanks: 47
Aaron is on a distinguished road
Default

Thanks! :P When you said highlight_file, it didn't sound familiar, but I guess it was the thing that I was looking for.
Send a message via MSN to Aaron
Aaron is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 09:19 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design