Navigate
Home
ArticleWiki
Forum
Newsletter
Links
Tech News
Welcome Guest.
Username:

Password:

Remember me

Share your PHP Code... the EASY way
Welcome, Guest. Please login or register.
February 07, 2012, 07:07:49 AM
11513 Posts in 1262 Topics by 496 Members
Latest Member: Beerdernill
Experts Round Table Network  |  Bits and Bytes  |  Tips, Tricks, Snippets, Tidbits And General Pearls Of Wisdom  |  Share your PHP Code... the EASY way « previous next »
Pages: [1]
Author Topic: Share your PHP Code... the EASY way  (Read 1319 times)
fedoracore

Offline Offline

Posts: 35



« on: February 16, 2007, 09:03:54 PM »

Have you ever wanted to share you PHP code w/ someone, but realized it's not as easy as "just go here and view source"? right, because the PHP is parsed, server-side, so no one will ever actually see the PHP source code (which comes in handy for hiding e-mail address from spam bots, by the way...)

But what happens when you want to share that code w/ a friend or forum?

Never fear-- P H P S is here!

the PHPS file extension (if and only if the hosting server is setup to accomodate it) will not only display the source-code w/out parsing it, but it should display it with highlighting, making it very easy to separate the html, comments, strings, reserved words, etc. for enhanced ease of viewing.

check out the page at FileXt.com for details
Logged

"...In search of my inner Joomla"
CrYpTiC_MauleR
Site Builder

Offline Offline

Posts: 501



WWW
« Reply #1 on: February 16, 2007, 10:34:25 PM »

You can enable this option by adding to your httpd.conf file or .htaccess file the following:

AddType application/x-httpd-php-source .phps

That way any file that ends in .phps will be color coded and formatted for source viewing.
Logged

[x] Fight | www.crypticmauler.com
"You must be
VGR
Mentor

Offline Offline

Posts: 724



WWW
« Reply #2 on: February 17, 2007, 01:47:15 AM »

yes, and that's why I never turn this on. I prefer to make a copy under extension .txt and in a special directory (as efficient) so that I can master which source will be exposed and which ones will not ;-)
this is a lot easier than modifying httpd or .htaccess each time for allowing access to this and that but not that to that person etc
Logged

techie overlord, answers all kind of questions on http://www.europeanexperts.org
fedoracore

Offline Offline

Posts: 35



« Reply #3 on: February 17, 2007, 05:49:52 AM »

You can enable this option by adding to your httpd.conf file or .htaccess file
cool, so it's just as simple as that, huh?

that's good to know. i had no idea about the phps extension until only a few days ago. i've no immediate use for it, but i have definitely done the ol' html < pre > bit in the past for sharing php publicly (as appropriate w/ non private stuff...)
Logged

"...In search of my inner Joomla"
VGR
Mentor

Offline Offline

Posts: 724



WWW
« Reply #4 on: February 18, 2007, 01:59:06 AM »

be warned also against this annoying possibility :

pretty-printed (highlighted, if you prefer ;-) code in the browser which would be copy-pasted to a text editor supporting single-byte-end-of-lines (ie, wordpad and not notepad) would perhaps end with text formatting in RTF format. I'm not sure. You would have to "save as..." and choose pure plain text to get rid of the formatting (colours).

This would be annoying.

personnally, I still find complete text files ready for downloading (and/or packed in a ZIP/TAR/GZ/RAR etc) far more convenient. This doesn't prevent you from showing parts of the code in syntax-coloured form, of course, but only for educationnal purposes IMHO.

regards
Logged

techie overlord, answers all kind of questions on http://www.europeanexperts.org
rdivilbiss
Governing Council Member
*
Offline Offline

Posts: 424



WWW
« Reply #5 on: November 04, 2009, 12:29:41 AM »

(ie, wordpad and not notepad) would perhaps end with text formatting in RTF format. I'm not sure.

Notepad: Save As type txt, UTF-8 is my solution and it works well except for code with annoying line numbers on the left.  I use Excel for those.
Logged

Rod
Pages: [1]
« previous next »
    Jump to: