1
   

Save [code] on forum

 
 
Reply Sat 8 Nov, 2003 02:43 pm
I was wondering how one would go about saving the contents inside the (CODE) and (/CODE) attributes on their forum.

I want it to where you can just click a button and it will make the code a .txt file, and then download it.

But I do not want to make ever code a .txt file when its uploaded, I want it to make the code a .txt file as soon as special "save code" button is clicked.
  • Topic Stats
  • Top Replies
  • Link to this Topic
Type: Discussion • Score: 1 • Views: 1,016 • Replies: 5
No top replies

 
Craven de Kere
 
  1  
Reply Sat 8 Nov, 2003 11:33 pm
There is no such thing as "save code". And for damn good reason, people would be tricking you into saving stuff on your computer all the time.
0 Replies
 
BobbyDouglas
 
  1  
Reply Sun 9 Nov, 2003 12:57 am
Eh.. I dunno if you understood my question or not..

You know sometime you goto a place to download a javascript code. Its like paste this in the body, and so forth? Well its the same idea here. It is just that the instead of clicking on "highlight/copy" you click on "save code" and it saves it.

Does this explain it more for you.. or is your response still the same Rolling Eyes
0 Replies
 
Craven de Kere
 
  1  
Reply Sun 9 Nov, 2003 01:03 am
You will need to create files for each script or have it generated automatically (and if you are expecting that to be an easy phpbb modification I'd like to say that saving files to your server is not child's play).

There are lots of complicated ways to do the server side of it and some could even be dynamic. It will not be easy and I won't be writing custom code for this (it would take many many hours that I can't commit to).

The saving side is easy, just link to the file. You can make it a zip for automatic download or tell users to "save as". Each operating system the user uses is different so there is no "one size fits all" solution to saving it.

In any case it's not clear what you are trying to do, there could be a simple solutrion to it all but I'd need to know what you are trying to accomplish.
0 Replies
 
BobbyDouglas
 
  1  
Reply Sun 9 Nov, 2003 01:49 am
"In any case it's not clear what you are trying to do, there could be a simple solutrion to it all but I'd need to know what you are trying to accomplish."
- Well. You know here how you post a script? You use the CODE attribute. It comes up with green text with a black background.

What I was wanting is a a way to click a button, then it will save the code inside the CODE tags, and generate a .txt file for it available for download.

I have seen a similar idea where I was installing a php script, and during the install it had me change the config.php file... Once I entered the correct informaiton, it let me download a custom php file for just my specifications... Something like that is what I would like.
0 Replies
 
Craven de Kere
 
  1  
Reply Sun 9 Nov, 2003 02:46 am
Ok, so I did understand it. Let me explain the limitations. You will almost have to rewrite the whole forum code to achieve what you want (which is why I won't be writing the code for you).

The part of the message that is in the code tags is simply not separated from the rest of the message. So there will be no easy way to write just the code into a text file. Not that it would be easy even if the code were separated from the rest.

It'd be much easier to write a mod to simply have a "highlight and copy" button for the code. I will eventually write code like that for this site.

There is another set of possible options.

Javascript can't actually save files (for obvious security reasons).

But I wrote a couple of scripts that could help.

Save to .txt file

That script takes a text and dynamically creates a .txt file and prompts the user to save it.

Now this will still be tricky, you will still need the text to escape all the characters like quotation marks that would break the javascript.

You will also need to make extensive modification to the forum software. But at least this should give you one idea of how you can do this without writing temporary text files to the server (which I'd not advise for this).

Write information to a new window

I wrote that script while thinking about this challenge but it's nopt as good as the last one.

In any case, like I have said. The modification you want will require extensive rewriting of the forum code.
0 Replies
 
 

Related Topics

Webdevelopment and hosting - Question by harisit2005
Showing an Ico File - Discussion by Brandon9000
how to earn money in internet - Discussion by rizwanaraj
The version 10 bug. Worse then Y2K! - Discussion by Nick Ashley
CSS Border style colors - Question by meesa
There is no Wisdom in Crowds - Discussion by ebrown p
THANK YOU CRAVEN AND NICK!!! - Discussion by dagmaraka
I'm the developer - Discussion by Nick Ashley
 
  1. Forums
  2. » Save [code] on forum
Copyright © 2024 MadLab, LLC :: Terms of Service :: Privacy Policy :: Page generated in 0.03 seconds on 04/25/2024 at 06:57:18