Displaying Code In New Window - Help

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Henry N
Forum Newbie
Posts: 2
Joined: Sun Feb 26, 2012 4:47 am

Displaying Code In New Window - Help

Post by Henry N »

Hi,

How do you create a hyper link that opens in another
window and displays your source code in text format??
The following example doesn't work:

<a href="filename.txt" target="_blank" width="600" height="400"> link </a>

The above code doesn't display the source code
It interprets it even though my filename is .txt (dot txt)

Any help will be much appreciated
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: Displaying Code In New Window - Help

Post by social_experiment »

Strange; the target="_blank" is the correct method for opening a new window in the browser. Do you have an .htaccess file set up; maybe it is causing certain file types to be processed as .php (i'm guessing your refering to php code here)
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
litebearer
Forum Contributor
Posts: 194
Joined: Sat Mar 27, 2004 5:54 am

Re: Displaying Code In New Window - Help

Post by litebearer »

Henry N
Forum Newbie
Posts: 2
Joined: Sun Feb 26, 2012 4:47 am

Re: Displaying Code In New Window - Help

Post by Henry N »

@social-exp:
What is an htaccess file? I'm relatively new
in this so please bear with me guy..

@litebearer:
Thanks for the link. But now the text file
should be filename.txt (dot txt) - the examples only deal
with .php (dot php) files
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: Displaying Code In New Window - Help

Post by social_experiment »

http://www.javascriptkit.com/howto/htaccess.shtml
This url will explain about .htaccess
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
Post Reply