Reply to Re: "Show Source" button

Your name:

Reply:


Posted by Joe on 10/02/05 05:41

"JDS" <jeffrey@example.invalid> wrote in message
news:pan.2005.10.02.00.32.50.479356@example.invalid...
> On Sat, 01 Oct 2005 16:10:20 +0000, Joe wrote:
>
>>>>Joe said the following on 01/10/2005 15:02:
>>>>> Does anyone know if a show source button exists written in php? I want
>>>>> to
>>>>> add this button to a web page so by a click of a button the source
>>>>> code
>>>>> of
>>>>> that page is displayed.
>>>>> I found several but they use javascript which I want to stay away from
>>>>> because I don't want the button code itself to appear when viewing the
>>>>> source.
>>>>>
>>>>
>>>>Do you mean the HTML source, or the PHP source?
>>>>
>>>>For HTML, the user can just click on View->Page Source (or the
>>>>equivalent).
>>>>
>>>>For PHP source, if you save a file with a .phps extension, you can
>>>>configure your server to get PHP to highlight these files on request,
>>>>e.g. with Apache, add the following line to config file:
>>>>
>>>> AddType application/x-httpd-php-source .phps
>>>
>>> Also:
>>> http://us2.php.net/manual/en/function.highlight-file.php
>>
>> My bad... Sorry.
>> I want to view the html code, not the php. I know you can do it through
>> the
>> browser but I need it for a 'convenience' situation (long story). Any
>> ideas??
>
> You can use a server header to serve the page as plain text. This won't
> work in MSIE, though, because MSIE is a piece of sheaht, but anyways, here
> is the example:
>
> // print this first if the "Show Source" button is clicked:
> if ($_GET['show_source'] ){
> header("Content-type: text/plain");
> }
> // ...rest of page...
>
>
> In proper browsers, the page will now be displayed as text.
>
> later...
> --
> JDS | jeffrey@go.away.com
> | http://www.newtnotes.com
> DJMBS | http://newtnotes.com/doctor-jeff-master-brainsurgeon/
>

JDS,

Thanks for your input, however this needs to work in IE.

Appreciated...

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация