SunQuest
 
           PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
  #1  
Old June 2nd, 2004, 02:05 AM
bala_kumar2k4 bala_kumar2k4 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 12 bala_kumar2k4 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Post passing file contents to frames

Sir,actually my task is having three frames.In the left frame,I have a select box that displays the dir folders and when clicking the select box folders,it will dynamically displays the files retreived from the database.In the other 2 frames I want to display the output and the source code respectively.
Here everything is perfect,but the only problem is how to display the source code corresponding to each files.
My coding is :
This page containing 4 frames.one frame is for displaying the folders and the corresponding files by dynamically selecting the select box.and the other 3 frames displays the output,source and comment's about the file respectively.
The only problem is how to display the source code to the specified frame as it is.
This is the Main page
<frameset cols="20%,80%">
<frame src="left_files.php" name="files">

<frameset rows="50%,40%,10%">

<frame src="output.php" name="output">
<frame src="source.php" name="source">
<frame src="comment.php" name="comment">
</frameset>
</frameset>



The left page displays the folders and the corresponding files.
For example: if there is a file called "array.php" and if u click this,the corresponding output,source and comment will display automatically.
Here we can easily display the output.But the problem is how to display the source code as it is.

Can u help me.....
Thank u.

Reply With Quote
  #2  
Old June 2nd, 2004, 03:37 PM
laidbak laidbak is offline
you know how we do
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jun 2002
Location: In Tha IE -- San Bernardino COUNTY
Posts: 788 laidbak User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 4 m 2 sec
Reputation Power: 7
Send a message via ICQ to laidbak Send a message via AIM to laidbak Send a message via MSN to laidbak Send a message via Yahoo to laidbak
A good way to start is using the highlight_file function. In a PHP file, you could do:

PHP Code:
 highlight_file($_SERVER["PATH_TRANSLATED"]); 
This would print the current php script's source code and it will be highlighted.

You can replace the $_SERVER["PATH_TRANSLATED"] part with a path to another file to show that file's source.

Make sure you have read permission on the file you intend to show.
__________________
__________________________________________________ _
Wil Moore III, MCP | Integrations Specialist | Senior Consultant
Are You Listed...? | DigitallySmooth Inc.

Reply With Quote
  #3  
Old June 2nd, 2004, 11:22 PM
bala_kumar2k4 bala_kumar2k4 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 12 bala_kumar2k4 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Arrow

sir I'm new to PHP,So,please can u show me an example for 'file_translated( )".....

Anyway I'm going to try that on ur way,after I'll reply u.....
Thank u sir.....

Reply With Quote
  #4  
Old June 2nd, 2004, 11:38 PM
bala_kumar2k4 bala_kumar2k4 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 12 bala_kumar2k4 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Arrow

Thank u sir.

The source code is displayed as it is.Thank u so much.But the problem is how to pass it to another frame and how to display it in to that frame....can u help me sir..

Reply With Quote
  #5  
Old June 3rd, 2004, 05:01 AM
Archemides Archemides is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 25 Archemides User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to Archemides Send a message via AIM to Archemides Send a message via Yahoo to Archemides
I too am a beginner. Perhaps this could help a little.

http://forums.devarticles.com/t8500/s.html

I am new to this message board. I have tried a few private messages, but no one seems to answer. My profile contains my AOL AIM contact as well as ICQ #. I do hope I may make a few friends interested in helping others learn PHP.



I download mIRC client and joined the #phpfreaks channel. I did get a couple of excellent explanations there to a few of my questions. If you google search on PHPFREAKS MIRC, you will find a page that explains how to do all this. Do be careful to download mIRC only from the link on that page, as I suspect that there are some bogus copies of mIRC floating around.

The channel is : irc.freenode.net


Here is the link to download mIRC

http://www.mirc.com/



I am only a beginner, teaching myself, but perhaps this crude code of mine below (my first attempts) can help a little.

===========

<hr>

disp_disp_createcontact is a sample of the code I use to read in a .PHP file and display it in a text box, so visitors to my site may cut and paste it into their own applications.



<?php



$fp = fopen("createcontact.PHP", "r");



$dialogue = fread($fp, 100000);

/*

Notice that the fread command, which is designed to read only a specified number

of bytes from a file, is told to read 100,000 bytes in order to trick it

into reading the entire file. Perhaps I should have made it bigger than 100,000

but that will become obvious if you ever use this code but do not see all of

a program displayed

*/

$ampersand_LT_semicolon = "&-l-t-;";

$ampersand_LT_semicolon = str_replace("-","",$ampersand_LT_semicolon);

$ampersand_GT_semicolon = "&-l-t-;";

$ampersand_GT_semicolon = str_replace("-","",$ampersand_GT_semicolon);

/*

Here you can see how to place comments in your PHP code, sandwiching them

between SLASH-ASTTERISK and ASTERISK-SLASH

The str-replace command (below) is designed to substitute

ampersandltsimicolon (& l t for all LESS-THAN (left arrow) signs

and ampersandgtsemicolon (& g t for all GREATER-THAN (right arrow)

signs, so that code may be displayed in the browser without having

the bracketed tags actually execute.

Unfortunately, what you will see is str_replace("<","<", $dialogue)

and not str_replace("<","&_l_t_;", $dialogue)

I have attempted to remove some of this ambiguity by using

$ampersand_GT_semicolon and $ampersand_LT_semicolon

*/

$dialogue = str_replace("<", "$ampersand_LT_semicolon", $dialogue);

$dialogue = str_replace(">", "$ampersand_GT_semicolon", $dialogue);

echo '<FORM>';

echo "<P>";

echo '<TEXTAREA name="thetext" rows="20" cols="80">';

echo $dialogue;

echo '</TEXTAREA>';

echo '</P>';

echo '</FORM>';



?>

===============

<hr>



Calling a php script from a link in html and passing arguments to it

Wow! Did I have a hard time getting this new parameter passing code to work! I naievly assumed that I could simple throw some php code into the middle of my HTML. When this did not work, I decided to make the page a PHP page which ECHO's the html as quoted strings. Using this method, suddenly, the parameter passing technique works!



<?php

// http://archives.postgresql.org/pgsq...02/msg00048.php

$value = "countfiles.PHP";



printf("<a href='argpass2.PHP?ARG=%s'>List code for $value </a>", $value);

//to get it on the "current page":

// printf("ARG has value: %s", $ARG);



?>

=========

Passing parameters to a php script through the url

<hr>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<title>PHP Parameter Passing exercise</title>

<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />

<meta name="generator" content="HAPedit 3.0">

</head>

<body bgcolor="#FFFFFF">

<?

echo "path infor = " . $PATH_INFO ;

$firstname = $HTTP_GET_VARS['firstname'];

$lastname = $HTTP_GET_VARS['lastname'];

echo "<p>" . $lastname . ", " . $firstname;

$value = "parmpassing.php";

printf("<p><a href='argpass2.PHP?ARG=%s'>List code for this program, $value </a>", $value);

echo "<hr />\n".

"HAPedit 3.0.11.102 (May 2004 6:46:08 PM)";

?>

<p><a href="parmpassing.php">This url works!</a>

<p><a href="parmpassing.php/one/two">This url does not work!</a>



<p><a href="parmpassing.php?firstname=John&lastname=Smith">Conventional parm passing</a>





<p><a href="http://www.zend.com/zend/spotlight/searchengine.php#8">Original article</a>

<p><a href="http://forums.devshed.com/archive/t-33247">This link helped with the syntax for GET</a>

</body>

</html>



======

<hr>

Beginners should consider a good book on PHP.

Mike McGrath "PHP in easy steps for Widows & Linus " published by Barnes & Noble only $10 or $15

ISBN 0-7607-4786-5

or SAMS "Teach Yourself PHP, MySQL and Apache " by Julie C. Meloni for $30 USD

ISBN 0-672-32620-5



========

<hr>

Note to myself:

I am going to explore the interesting code suggested in this post:



highlight_file($_SERVER["PATH_TRANSLATED"]);
This would print the current php script's source code and it will be highlighted.

You can replace the $_SERVER["PATH_TRANSLATED"] part with a path to another file to show that file's source.


Reply With Quote
  #6  
Old June 3rd, 2004, 05:19 AM
Archemides Archemides is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 25 Archemides User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to Archemides Send a message via AIM to Archemides Send a message via Yahoo to Archemides
Useful tip on highlight_file function

http://www.phpfreaks.com/phpmanual/page/function.highlight-file.html



The highlight_file() function prints out a syntax higlighted version of the code contained in filename using the colors defined in the built-in syntax highlighter for PHP.

If the second parameter return is set to TRUE then highlight_file() will return the highlighted code as a string instead of printing it out. If the second parameter is not set to TRUE then highlight_file() will return TRUE on success, FALSE on failure.

Note: The return parameter became available in PHP 4.2.0. Before this time it behaved like the default, which is FALSE

Note: Care should be taken when using the
show_source() <function.show-source.html> and highlight_file() functions to make sure that you do not inadvertently reveal sensitive information such as passwords or any other type of information that might create a potential security risk.


Reply With Quote
  #7  
Old June 3rd, 2004, 05:28 AM
bala_kumar2k4 bala_kumar2k4 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 12 bala_kumar2k4 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thumbs up

Thank u so much .I got a lot of information's from u.After using this ,I'll reply u

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > passing file contents to frames


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway