Flux rss

How to easily display PHP/HTML codes in your webpages

Published by aakai1056, last update on Monday November 3, 2008 05:01:59 PM by aakai1056

How to easily display PHP/HTML codes in your webpages






If you want your visitors to be able to see the source codes of your webpage, there is a very easy way to do so. Normally, all you have to do in a HTML file using IE is to go in the View option on your taskbar and then select Source.
Another simple way to do that is to insert the codes below in the PHP or HTML file so that those who wish to get the codes to build their own website or alter their websites’ display.

What code to use?


If you want to display the code of your index file (index.php), all you have to do is to insert
highlight_file(index.php);
in the body of the document.

One other way to do it is to use the constant __FILE__. You should however use the exit function to avoid displaying the rest of the script. This is very helpful to avoid displaying a protected document enclosing a username and password.

Here is a full code that you can make use of to be able to display the code correctly. You can insert it after your body tag:

afficher_code_php function ()
(
if (isset ($ _GET [ 'source']))
(
echo '<a <p> href="',$_SERVER['PHP_SELF'],'"> Back </ a> </ p>';
echo '<p> This is the code php file: </ p>';
$ page = highlight_file ($ _SERVER [ 'SCRIPT_FILENAME'], TRUE);
$ page = str_replace (
array ( '<code>', '/ code>', '','</ are >','< font color ="'),
array ( '<pre style="padding:1em;border:2px solid black;overflow:scroll">', '/ pre>', '','</ span >','< span style = "color:' ), $ page);
echo $ page;
echo '<a <p> href="',$_SERVER['PHP_SELF'],'"> Back </ a> </ p>';
echo '</ body> </ html>';
exit;
)
)
Html code in shell script.......... Hello, I want to share one of article of a recent magazine to write html code in shell script.......... any title Our content information goes here this is written in shell script as... en.kioskea.net/forum/affich-17105-html-code-in-shell-script
NEED A HTML CODE Hello, I NEED A HTML CODE FOR SEND MAIL TO A email ADDRESS FROM MY OWN WEB SITE..... I MEAN TO CREATE A WEB SITE..... en.kioskea.net/forum/affich-19341-need-a-html-code
Create CSS easilyCreate CSS easily Easy links CSS is a short term for Cascading Style Sheets. CSS is used to alter the display of the HTML coded environment. For example, using CSS can change the appearance of your scroll bar, the color, headings... en.kioskea.net/faq/sujet-593-create-css-easily
Useful links for PHPUseful links for PHP Introduction to PHP Starting with PHP Home website PHP source codes Below are some useful links for PHP : Introduction to PHP http://www.php.net/tut.php Starting with PHP http://www.php-learn... en.kioskea.net/faq/sujet-1006-useful-links-for-php
PhpMyAdmin - Access denied for user root’@localhostPhpMyAdmin - Access denied for user root’@localhost To reset the rights of the root user Insert the host and password Beginners may face the problem of accessing MySql by the root user. This issue happens when the root requires you to... en.kioskea.net/faq/sujet-673-phpmyadmin-access-denied-for-user-roota-localhost
Html converterHi, i want to make a jpg become an html code so as i can post in comment box what do i have to do ? en.kioskea.net/forum/affich-36344-html-converter
HTML QuestionDear sir, I am a software developer but i know how can send a message by asp but i want to know how can i send a message by html code en.kioskea.net/forum/affich-32488-html-question
Html coding neededHello, I need a code to be able to open pages on Iframe. Plz help en.kioskea.net/forum/affich-13080-html-coding-needed
Download Web Cal PlusWeb call plus is a generator of calendar in the format HTML conceived for schools, scouts, churches, synagogues. You only have to enter your events and application generates the html code. Application inserts calendars: Hebrew, Islamic and manage... en.kioskea.net/telecharger/telecharger-1450-web-cal-plus
Download MIRCmIRC is a shareware IRC client, allowing the user to use so called Internet Relay Chat servers. Its specific features includes a powerful scripting language (scripting is typically a somewhat less powerful and less complex variation of programming),... en.kioskea.net/telecharger/telecharger-912-mirc
Download Notepad2Notepad2 is a notepad without free installation with advanced syntax. Features: Syntax for the following languages: HTML, XML, PHP, ASP (JScript, VBS), CSS, JavaScript, VBScript, C / C + +, C #, Resource Script, Makefiles, Java, Visual Basic,... en.kioskea.net/telecharger/telecharger-1762-notepad2
BlackBerry vows to keep messages secret after India seeks codeA Research In Motion employee displays a BlackBerry at a product launch in Mumbai in 2007. The Canadian maker of BlackBerry, involved in a security scrap with India, has promised customers it will not allow New Delhi to read text messages sent on its... en.kioskea.net/actualites/blackberry-vows-to-keep-messages-secret-after-india-seeks-code-10406-actualite.php3
HTML - Frames You can display multiple HTML pages in different areas at once. These areas are called frames. Frames are not found in the specifications of HTML 3.x, so the Document Type Declaration must show the page as having been written in HTML 4.0. To create... en.kioskea.net/html/htmlframes.php3
CSS - Declaring a style sheet Style sheets are not directly integrated into the W3C's HTML recommendations. For this reason, you need to include elements in the HTML code indicating both the type of document, meaning the version of the HTML and CSS recommendations used by the... en.kioskea.net/css/cssimplant.php3
HTML 4.0 - Positioning elements Using style sheets along with the and tags, you can specify the location of text or images down to the pixel. This is possible with versions 4 and higher of Netscape and Internet Explorer; however, the technique is still problematic and... en.kioskea.net/css/cssposition.php3