473,909 Members | 2,200 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Best way to share PHP code

I've been working on some php scripts that I want to release under the
GPL and I'm looking for the best way to share the code with everyone.
I always liked websites that had a <textfield> and put the source into
the field, it allowed for easy copy and pasting as well as the ability
to read the code without having to download a file, save it somewhere,
then open it up, and lastly it preserves formatting. So on my page
that shows source I have...

<form>
<br>Source of makenews.html<b r>
<textarea cols=80 rows=30><?php $filename='make news.html.sourc e';
if(is_readable( $filename)) if (readfile($file name) == false) echo
'error reading '.$filename; ?></textarea>

<br>Source of makenews.php<br >
<textarea cols=80 rows=30><?php $filename='make news.php.source ';
if(is_readable( $filename)) if (readfile($file name) == false) echo
'error reading '.$filename; ?></textarea>

...several other documents here, you get the idea
</form>

Which works great, except if inside of the sourcefile somewhere there
is a "</textarea>". When it runs into this, my page actually closes
the text box there and the rest of the source spills out into the html
document just as plain text would have. Is there any way I can custom
define the escape character for an html <textarea> such that, for
example, to terminate it I would have to say </textarea-source> or
something similar?

If not, or if you think you have a better way: how do you all share
your source? I could just make links to download the actual files but
I much prefer having all the source on the webpage.

Sorry, I guess this is more of a html question than php but I'm also
willing to hear any php solutions that you guys may have.

You can see an example of my problem here:
http://www.cse.msu.edu/~meyerro3/pro...ces.broken.php
Notice it works fine for shownews.php and main.css, however for
makenews.html my textarea gets closed then my div (which gives the
light blue background) gets closed and a submit button is sitting
outside of the source box. For makenews.php the problem is even worse,
you can see in that link how bad it gets.

Oct 21 '05 #1
2 2551
<xmp>

<plaintext>

/f3l
http://www.geocities.com/kyoosho/

Oct 21 '05 #2
Robizzle wrote:
I've been working on some php scripts that I want to release under the
GPL and I'm looking for the best way to share the code with everyone.
I always liked websites that had a <textfield> and put the source into
the field, it allowed for easy copy and pasting as well as the ability
to read the code without having to download a file, save it somewhere,
then open it up, and lastly it preserves formatting. So on my page
that shows source I have...

<form>
<br>Source of makenews.html<b r>
<textarea cols=80 rows=30><?php $filename='make news.html.sourc e';
if(is_readable( $filename)) if (readfile($file name) == false) echo
'error reading '.$filename; ?></textarea>

<br>Source of makenews.php<br >
<textarea cols=80 rows=30><?php $filename='make news.php.source ';
if(is_readable( $filename)) if (readfile($file name) == false) echo
'error reading '.$filename; ?></textarea>

...several other documents here, you get the idea
</form>

Which works great, except if inside of the sourcefile somewhere there
is a "</textarea>". When it runs into this, my page actually closes
the text box there and the rest of the source spills out into the html
document just as plain text would have. Is there any way I can custom
define the escape character for an html <textarea> such that, for
example, to terminate it I would have to say </textarea-source> or
something similar?

If not, or if you think you have a better way: how do you all share
your source? I could just make links to download the actual files but
I much prefer having all the source on the webpage.

Sorry, I guess this is more of a html question than php but I'm also
willing to hear any php solutions that you guys may have.

You can see an example of my problem here:
http://www.cse.msu.edu/~meyerro3/pro...ces.broken.php
Notice it works fine for shownews.php and main.css, however for
makenews.html my textarea gets closed then my div (which gives the
light blue background) gets closed and a submit button is sitting
outside of the source box. For makenews.php the problem is even worse,
you can see in that link how bad it gets.


On my site, I use this:
<div class="example" >
<?php highlight_file( 'filename.php') ; ?>
</div>

Then I use CSS to stylize the rest.

You could also do something along the lines of:

<textarea><?p hp echo htmlentities(fi le_get_contents ('filename.php' ))
?></textarea>

--
Justin Koivisto, ZCE - ju****@koivi.co m
http://koivi.com
Oct 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1467
by: Ares Lagae | last post by:
Suppose one is writing a library behavior the classes A1, A2 and A3, which share some common behavior. Some applications will only use one of the classes, while other applications will use all of them. Because the classes share common behavior, the library designed has to choose wether to introduce an abstract base class A, or not. Introducing an ABC has the advantage of run time flexibility, but efficiency suffers (virtual functions &...
3
1994
by: kyle.tk | last post by:
So I have a central list of python objects that I want to be able to share between different process that are possibly on different computers on the network. Some of the processes will add objects to list and another process will be a GUI that will view objects in the list. I want this all to happen in real-time (e.g once a processes adds an object to the list the GUI will see it.) What would be the best way to accomplish this. Some of...
136
9503
by: Matt Kruse | last post by:
http://www.JavascriptToolbox.com/bestpractices/ I started writing this up as a guide for some people who were looking for general tips on how to do things the 'right way' with Javascript. Their code was littered with document.all and eval, for example, and I wanted to create a practical list of best practices that they could easily put to use. The above URL is version 1.0 (draft) that resulted. IMO, it is not a replacement for the FAQ,...
1
1264
by: Chua Wen Ching | last post by:
Hi there, I had a scenario here. I had many tonnes of C codes in my office. Each C codes are used in low level stuff. Like connecting to smart card readers or even the OS itself. I was being hired to push .NET into it and fully object oriented. I had some questions to ask.
5
4203
by: Schoo | last post by:
I have some program constants that I need to set and I thought it would be best to set them all up in a central location so that I can change them quickly when we go from development to production. What is the best way to do that? Should I put them in web.config? Should I create a special class for these settings? Wherever it is best to write them, can you give me a line or 2 of code to show the best way to set a constant string? ...
6
2977
by: tendim | last post by:
G'day group. Currently our organization us using VB6 based applications, and I am trying to push forward and migrate some of the smaller things to VB.NET, eventually migrating all applications from VB6 and other legacy languages/systems (Pure VBScript, DataEase, etc.) over to .NET. Currently, *all* user data is stored on network shares. When a user logs in to a workstation, their home drive is mounted from one share, all of their...
13
2346
by: frk.won | last post by:
I am interested in learning how to use the VS 2005 code snippets. However, I wish to know what are the best ways to source control the code snippets? Are there any source safe/subversion add-ons for this purpose? If not, any urls which demonstrates code snippets management?
6
1434
by: Jack | last post by:
I have a set of functions to wrap a library. For example, mylib_init() mylib_func() mylib_exit() or handle = mylib_init() mylib_func(handle)
0
10037
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9879
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11348
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10921
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
11052
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10540
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9727
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8099
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
2
4336
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.