Revision history for GrabCodeHandler


Revision [23205]

Last edited on 2016-05-20 07:38:47 by DarTar [Replaces old-style internal links with new pipe-split links.]
Additions:
~-[2006-04-23] --- New version committed to the SVN repository (Revisions [[http://wush.net/trac/wikka/log/trunk/?action=stop_on_copy&rev=51&stop_rev=49&mode=stop_on_copy | 49-51]]): code block syntax now accepts an optional value for filename: ##""%%(php;12;myfile.php) ... %%""##. If ##filename## is specified a small header for the code block is generated, and ##filename## is used as a title for the download button and as a name for the downloadable file.
~&Now that AdvancedFormOpen and ImprovedFormatter have both been installed on this site as a [[WikkaBetaFeatures | beta feature]], I've adapted the code above slightly to take advantage of the capability of the new ##""FormOpen()""## method to add a class to the form. The new code is now as follows:%%(php;334) #return $output;
Deletions:
~-[2006-04-23] --- New version committed to the SVN repository (Revisions [[http://wush.net/trac/wikka/log/trunk/?action=stop_on_copy&rev=51&stop_rev=49&mode=stop_on_copy 49-51]]): code block syntax now accepts an optional value for filename: ##""%%(php;12;myfile.php) ... %%""##. If ##filename## is specified a small header for the code block is generated, and ##filename## is used as a title for the download button and as a name for the downloadable file.
~&Now that AdvancedFormOpen and ImprovedFormatter have both been installed on this site as a [[WikkaBetaFeatures beta feature]], I've adapted the code above slightly to take advantage of the capability of the new ##""FormOpen()""## method to add a class to the form. The new code is now as follows:%%(php;334) #return $output;


Revision [19159]

Edited on 2008-01-28 00:14:04 by DarTar [Modified links pointing to docs server]

No Differences

Revision [16913]

Edited on 2007-05-31 23:27:12 by DarTar [Reverted]
Additions:
~-[2006-04-23] --- New version committed to the SVN repository (Revisions [[http://wush.net/trac/wikka/log/trunk/?action=stop_on_copy&rev=51&stop_rev=49&mode=stop_on_copy 49-51]]): code block syntax now accepts an optional value for filename: ##""%%(php;12;myfile.php) ... %%""##. If ##filename## is specified a small header for the code block is generated, and ##filename## is used as a title for the download button and as a name for the downloadable file.
~-[2004-02-17] --- I've uploaded this handler on this server as a beta feature. Feedback is welcome. See the **issues** section at the bottom of this page for more details.
----
====The code====
==1. Modify the formatter==
Make the following modifications in **##formatters/wakka.php##**
**original**
%%(php)
return $output;
}
%%
**modified**
%%(php)
//build form
$form = $wakka->FormOpen("grabcode");
$form .= '<input type="submit" class="grabcodebutton" style="float:right; margin-right:20px; margin-top:0px; font-size: 10px; color: #000;font-weight: normal; font-family: Verdana, Arial, sans-serif; background-color: #DDD; text-decoration: none; height:18px;" name="save" value="Grab" title="Download this code"/>';
$form .= '<input type="hidden" name="code" value="'.urlencode($code).'" />';
$form .= $wakka->FormClose();

// output
return "$output \n $form";
}
%%
~&DarTar, you should get rid of the <br /> before the form - that's what causes (most of) the extra vertical whitespace between the codeblock and the button that we already discussed on #wikka. The codeblock already is a block (div), so whatever comes after it will automatically start on a new line; the <br /> is adding an //extra// one. See the weird and confusing effect this can have now on the item 'Double-click editing' on WikkaBugs (especially since you're also floating it). For readable HTML output, add a "\n" before the form instead of <br />.
~&As a next step, give it a class: putting in the styling here prevents people from giving it their own styling to fit in with their skin! --JavaWoman
~~& Good point. As we discussed, I can't give a class to the form using the ##""FormOpen()""## method, for the time being I add a class to the ##input## button, in the future this will be handled by the appropriate contextual CSS selectors -- DarTar
~~~&See AdvancedFormOpen for a solution. --JavaWoman
~&Now that AdvancedFormOpen and ImprovedFormatter have both been installed on this site as a [[WikkaBetaFeatures beta feature]], I've adapted the code above slightly to take advantage of the capability of the new ##""FormOpen()""## method to add a class to the form. The new code is now as follows:%%(php;334) #return $output;
// START DarTar modified 2005-02-17
// slight mod JavaWoman 2005-06-12: coding style, class for form
//build form
$form = $wakka->FormOpen('grabcode','','post','','grabcode');
$form .= '<input type="submit" name="save" class="grabcodebutton" style="line-height:10px; float:right; vertical-align: middle; margin-right:20px; margin-top:0px; font-size: 10px; color: #000; font-weight: normal; font-family: Verdana, Arial, sans-serif; background-color: #DDD; text-decoration: none; height:18px;" value="Grab" title="Download this code" />';
$form .= '<input type="hidden" name="code" value="'.urlencode($code).'" />';
$form .= $wakka->FormClose();
// output
return $output."\n".$form;
// END DarTar modified 2005-02-17
%%---(See ImprovedFormatter for the full code.)
~&With this, every grabcode form gets a class 'grabcode' which can now be used to properly style the form (the styling still needs to be done, though, and will make the embedded style for the button superfluous). --JavaWoman
==2. Create a ##grabcode## handler==
Save the following code as **##handlers/page/grabcode.php##**
%%(php)
<?php
/**
* Downloads a code snippet as a file.
*
* Usage: The handler is called from a form appended to any code block in Wikka pages.
*
* @package Handlers
* @name grabcode
* @author {@link http://wikka.jsnx.com/DarTar Dario Taraborelli}
* @version 0.1
* @since Wikka 1.1.X
* @todo - address header issues with different browsers.
* - modify formatter to take care of filename.
*/
$code = urldecode($_POST["code"]);
//$filename = ($_POST["name"])? $_POST["name"] : "snippet.php"; # forthcoming
$filename = "codesnippet.php"; # forthcoming
//header('Content-type: application/force-download');
header('Content-type: text/plain');
header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Content-Length: '.strlen($code));
header('Content-Description: $filename Download Data');
header('Pragma: no-cache');
header('Content-Disposition: attachment; filename="' . $filename . '"');
echo $code;
?>
%%
==3. Modify ##wikka.php##==
Make the two following modifications in **##./wikka.php##**:
**A. original**
%%(php)
// raw page handler
elseif ($this->method == "raw")
{
header("Content-type: text/plain");
print($this->Method($this->method));
}
%%
**A. modified**
%%(php)
// raw page handler
elseif ($this->method == "raw")
{
header("Content-type: text/plain");
print($this->Method($this->method));
}
// grabcode handler
elseif ($this->method == "grabcode")
{
print($this->Method($this->method));
}
%%
**B. original**
%%(php)
if (!preg_match("/(xml|raw|mm)$/", $method))
{
%%
**B. modified**
%%(php)
if (!preg_match("/(xml|raw|mm|grabcode)$/", $method))
{
%%
----
==== Issues ====
~-There are some known issues related to the way in which browsers interpret the ##Content-Disposition## header sent by PHP (especially with IE) and I will try to figure out how this can be fixed. Help/suggestions are welcome.
~-Currently the handler is stored in the ##handlers/page/## folder, but it is not a page handler (it does not perform operations on the page as a whole) so we might try to find a better organization in the handlers file structure.
~-It seems that ##Content-type: application/force-download## doesn't work under M$Windows/IE so I changed it back to ##Content-type: text/plain## which should just display a text version of the code snippet.
====References====
[[PHP:header]]
----
CategoryDevelopmentHandlers
Deletions:
~-[2006-04-23] --- New version committed to the SVN repository (Revisions [[http://wush.net/trac/wikka/log/trunk/?action=stop_on_copy


Revision [16712]

Edited on 2007-05-31 10:39:12 by Fh0Jof [Reverted]
Additions:
~-[2006-04-23] --- New version committed to the SVN repository (Revisions [[http://wush.net/trac/wikka/log/trunk/?action=stop_on_copy
Deletions:
~-[2006-04-23] --- New version committed to the SVN repository (Revisions [[http://wush.net/trac/wikka/log/trunk/?action=stop_on_copy&rev=51&stop_rev=49&mode=stop_on_copy 49-51]]): code block syntax now accepts an optional value for filename: ##""%%(php;12;myfile.php) ... %%""##. If ##filename## is specified a small header for the code block is generated, and ##filename## is used as a title for the download button and as a name for the downloadable file.
~-[2004-02-17] --- I've uploaded this handler on this server as a beta feature. Feedback is welcome. See the **issues** section at the bottom of this page for more details.
----
====The code====
==1. Modify the formatter==
Make the following modifications in **##formatters/wakka.php##**
**original**
%%(php)
return $output;
}
%%
**modified**
%%(php)
//build form
$form = $wakka->FormOpen("grabcode");
$form .= '<input type="submit" class="grabcodebutton" style="float:right; margin-right:20px; margin-top:0px; font-size: 10px; color: #000;font-weight: normal; font-family: Verdana, Arial, sans-serif; background-color: #DDD; text-decoration: none; height:18px;" name="save" value="Grab" title="Download this code"/>';
$form .= '<input type="hidden" name="code" value="'.urlencode($code).'" />';
$form .= $wakka->FormClose();

// output
return "$output \n $form";
}
%%
~&DarTar, you should get rid of the <br /> before the form - that's what causes (most of) the extra vertical whitespace between the codeblock and the button that we already discussed on #wikka. The codeblock already is a block (div), so whatever comes after it will automatically start on a new line; the <br /> is adding an //extra// one. See the weird and confusing effect this can have now on the item 'Double-click editing' on WikkaBugs (especially since you're also floating it). For readable HTML output, add a "\n" before the form instead of <br />.
~&As a next step, give it a class: putting in the styling here prevents people from giving it their own styling to fit in with their skin! --JavaWoman
~~& Good point. As we discussed, I can't give a class to the form using the ##""FormOpen()""## method, for the time being I add a class to the ##input## button, in the future this will be handled by the appropriate contextual CSS selectors -- DarTar
~~~&See AdvancedFormOpen for a solution. --JavaWoman
~&Now that AdvancedFormOpen and ImprovedFormatter have both been installed on this site as a [[WikkaBetaFeatures beta feature]], I've adapted the code above slightly to take advantage of the capability of the new ##""FormOpen()""## method to add a class to the form. The new code is now as follows:%%(php;334) #return $output;
// START DarTar modified 2005-02-17
// slight mod JavaWoman 2005-06-12: coding style, class for form
//build form
$form = $wakka->FormOpen('grabcode','','post','','grabcode');
$form .= '<input type="submit" name="save" class="grabcodebutton" style="line-height:10px; float:right; vertical-align: middle; margin-right:20px; margin-top:0px; font-size: 10px; color: #000; font-weight: normal; font-family: Verdana, Arial, sans-serif; background-color: #DDD; text-decoration: none; height:18px;" value="Grab" title="Download this code" />';
$form .= '<input type="hidden" name="code" value="'.urlencode($code).'" />';
$form .= $wakka->FormClose();
// output
return $output."\n".$form;
// END DarTar modified 2005-02-17
%%---(See ImprovedFormatter for the full code.)
~&With this, every grabcode form gets a class 'grabcode' which can now be used to properly style the form (the styling still needs to be done, though, and will make the embedded style for the button superfluous). --JavaWoman
==2. Create a ##grabcode## handler==
Save the following code as **##handlers/page/grabcode.php##**
%%(php)
<?php
/**
* Downloads a code snippet as a file.
*
* Usage: The handler is called from a form appended to any code block in Wikka pages.
*
* @package Handlers
* @name grabcode
* @author {@link http://wikka.jsnx.com/DarTar Dario Taraborelli}
* @version 0.1
* @since Wikka 1.1.X
* @todo - address header issues with different browsers.
* - modify formatter to take care of filename.
*/
$code = urldecode($_POST["code"]);
//$filename = ($_POST["name"])? $_POST["name"] : "snippet.php"; # forthcoming
$filename = "codesnippet.php"; # forthcoming
//header('Content-type: application/force-download');
header('Content-type: text/plain');
header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Content-Length: '.strlen($code));
header('Content-Description: $filename Download Data');
header('Pragma: no-cache');
header('Content-Disposition: attachment; filename="' . $filename . '"');
echo $code;
?>
%%
==3. Modify ##wikka.php##==
Make the two following modifications in **##./wikka.php##**:
**A. original**
%%(php)
// raw page handler
elseif ($this->method == "raw")
{
header("Content-type: text/plain");
print($this->Method($this->method));
}
%%
**A. modified**
%%(php)
// raw page handler
elseif ($this->method == "raw")
{
header("Content-type: text/plain");
print($this->Method($this->method));
}
// grabcode handler
elseif ($this->method == "grabcode")
{
print($this->Method($this->method));
}
%%
**B. original**
%%(php)
if (!preg_match("/(xml|raw|mm)$/", $method))
{
%%
**B. modified**
%%(php)
if (!preg_match("/(xml|raw|mm|grabcode)$/", $method))
{
%%
----
==== Issues ====
~-There are some known issues related to the way in which browsers interpret the ##Content-Disposition## header sent by PHP (especially with IE) and I will try to figure out how this can be fixed. Help/suggestions are welcome.
~-Currently the handler is stored in the ##handlers/page/## folder, but it is not a page handler (it does not perform operations on the page as a whole) so we might try to find a better organization in the handlers file structure.
~-It seems that ##Content-type: application/force-download## doesn't work under M$Windows/IE so I changed it back to ##Content-type: text/plain## which should just display a text version of the code snippet.
====References====
[[PHP:header]]
----
CategoryDevelopmentHandlers


Revision [13897]

Edited on 2006-04-23 04:39:04 by DarTar [New version committed to SVN repository]
Additions:
===Changelog===
~-[2006-04-23] --- New version committed to the SVN repository (Revisions [[http://wush.net/trac/wikka/log/trunk/?action=stop_on_copy&rev=51&stop_rev=49&mode=stop_on_copy 49-51]]): code block syntax now accepts an optional value for filename: ##""%%(php;12;myfile.php) ... %%""##. If ##filename## is specified a small header for the code block is generated, and ##filename## is used as a title for the download button and as a name for the downloadable file.
~-[2004-02-17] --- I've uploaded this handler on this server as a beta feature. Feedback is welcome. See the **issues** section at the bottom of this page for more details.
return $output;
}
//build form
$form = $wakka->FormOpen("grabcode");
$form .= '<input type="submit" class="grabcodebutton" style="float:right; margin-right:20px; margin-top:0px; font-size: 10px; color: #000;font-weight: normal; font-family: Verdana, Arial, sans-serif; background-color: #DDD; text-decoration: none; height:18px;" name="save" value="Grab" title="Download this code"/>';
$form .= '<input type="hidden" name="code" value="'.urlencode($code).'" />';
$form .= $wakka->FormClose();

// output
return "$output \n $form";
}
elseif ($this->method == "raw")
{
header("Content-type: text/plain");
print($this->Method($this->method));
}
elseif ($this->method == "raw")
{
header("Content-type: text/plain");
print($this->Method($this->method));
}
// grabcode handler
elseif ($this->method == "grabcode")
{
print($this->Method($this->method));
}
Deletions:
In the future, admin-configurable options will be added to allow:
~1) //switching this option on/off//;
~1) display a download button only for code blocks //longer than n lines//.
''[2004-02-17] - I've uploaded this handler on this server as a beta feature. Feedback is welcome. See the **issues** section at the bottom of this page for more details.''
return $output;
}
//build form
$form = $wakka->FormOpen("grabcode");
$form .= '<input type="submit" class="grabcodebutton" style="float:right; margin-right:20px; margin-top:0px; font-size: 10px; color: #000;font-weight: normal; font-family: Verdana, Arial, sans-serif; background-color: #DDD; text-decoration: none; height:18px;" name="save" value="Grab" title="Download this code"/>';
$form .= '<input type="hidden" name="code" value="'.urlencode($code).'" />';
$form .= $wakka->FormClose();

// output
return "$output \n $form";
}
elseif ($this->method == "raw")
{
header("Content-type: text/plain");
print($this->Method($this->method));
}
elseif ($this->method == "raw")
{
header("Content-type: text/plain");
print($this->Method($this->method));
}
// grabcode handler
elseif ($this->method == "grabcode")
{
print($this->Method($this->method));
}


Revision [9165]

Edited on 2005-06-12 20:34:04 by JavaWoman [new code fragment and reference to ImprovedFormatter]
Additions:
%%---(See ImprovedFormatter for the full code.)
Deletions:
%%---(See ImprovedFormatter for the full code.


Revision [9164]

Edited on 2005-06-12 20:30:16 by JavaWoman [new code fragment and reference to ImprovedFormatter]
Additions:
Documentation: ""GrabCodeHandlerInfo""
Other: ImprovedFormatter.>>This is the development page for the Grab Code handler.::c::
~~& Good point. As we discussed, I can't give a class to the form using the ##""FormOpen()""## method, for the time being I add a class to the ##input## button, in the future this will be handled by the appropriate contextual CSS selectors -- DarTar
~&Now that AdvancedFormOpen and ImprovedFormatter have both been installed on this site as a [[WikkaBetaFeatures beta feature]], I've adapted the code above slightly to take advantage of the capability of the new ##""FormOpen()""## method to add a class to the form. The new code is now as follows:%%(php;334) #return $output;
// START DarTar modified 2005-02-17
// slight mod JavaWoman 2005-06-12: coding style, class for form
//build form
$form = $wakka->FormOpen('grabcode','','post','','grabcode');
$form .= '<input type="submit" name="save" class="grabcodebutton" style="line-height:10px; float:right; vertical-align: middle; margin-right:20px; margin-top:0px; font-size: 10px; color: #000; font-weight: normal; font-family: Verdana, Arial, sans-serif; background-color: #DDD; text-decoration: none; height:18px;" value="Grab" title="Download this code" />';
$form .= '<input type="hidden" name="code" value="'.urlencode($code).'" />';
$form .= $wakka->FormClose();
// output
return $output."\n".$form;
// END DarTar modified 2005-02-17
%%---(See ImprovedFormatter for the full code.
~&With this, every grabcode form gets a class 'grabcode' which can now be used to properly style the form (the styling still needs to be done, though, and will make the embedded style for the button superfluous). --JavaWoman
Deletions:
Documentation: ""GrabCodeHandlerInfo"".>>This is the development page for the Grab Code handler.::c::
~~& Good point. As we discussed, I can't give a class to the form using the ##""FormOpen()""## action, for the time being I add a class to the ##input## button, in the future this will be handled by the appropriate contextual CSS selectors -- DarTar


Revision [8583]

Edited on 2005-05-28 11:47:29 by JavaWoman [move to subcategory]
Additions:
CategoryDevelopmentHandlers
Deletions:
CategoryDevelopment


Revision [8288]

Edited on 2005-05-18 13:25:20 by JavaWoman [referecne to AdvancedFormOpen]
Additions:
~~~&See AdvancedFormOpen for a solution. --JavaWoman


Revision [6128]

Edited on 2005-02-18 08:40:36 by DarTar [Replying to JW]
Additions:
return "$output \n $form";
Deletions:
return $output.'\n'.$form;


Revision [6127]

Edited on 2005-02-18 08:35:31 by DarTar [Replying to JW]
Additions:
~~& Good point. As we discussed, I can't give a class to the form using the ##""FormOpen()""## action, for the time being I add a class to the ##input## button, in the future this will be handled by the appropriate contextual CSS selectors -- DarTar
Deletions:
~~& Good point. As we discussed, I can't give a class to the form using the FormOpen action, for the time being I add a class to the ##input## button, in the future this will be handled by the appropriate contextual CSS selectors -- DarTar


Revision [6126]

Edited on 2005-02-18 08:34:56 by DarTar [Replying to JW]
Additions:
$form .= '<input type="submit" class="grabcodebutton" style="float:right; margin-right:20px; margin-top:0px; font-size: 10px; color: #000;font-weight: normal; font-family: Verdana, Arial, sans-serif; background-color: #DDD; text-decoration: none; height:18px;" name="save" value="Grab" title="Download this code"/>';
return $output.'\n'.$form;
~~& Good point. As we discussed, I can't give a class to the form using the FormOpen action, for the time being I add a class to the ##input## button, in the future this will be handled by the appropriate contextual CSS selectors -- DarTar
Deletions:
$form .= '<input type="submit" style="float:right; margin-right:20px; margin-top:0px; font-size: 10px; color: #000;font-weight: normal; font-family: Verdana, Arial, sans-serif; background-color: #DDD; text-decoration: none; height:18px;" name="save" value="Grab" title="Download this code"/>';
return $output.'<br />'.$form;


Revision [6118]

Edited on 2005-02-18 07:22:54 by JavaWoman [suggestion to get rid of extra whitespace and styling]
Additions:
~&DarTar, you should get rid of the <br /> before the form - that's what causes (most of) the extra vertical whitespace between the codeblock and the button that we already discussed on #wikka. The codeblock already is a block (div), so whatever comes after it will automatically start on a new line; the <br /> is adding an //extra// one. See the weird and confusing effect this can have now on the item 'Double-click editing' on WikkaBugs (especially since you're also floating it). For readable HTML output, add a "\n" before the form instead of <br />.
~&As a next step, give it a class: putting in the styling here prevents people from giving it their own styling to fit in with their skin! --JavaWoman


Revision [6101]

Edited on 2005-02-17 16:18:26 by DarTar [Styled buttons]
Additions:
$form .= '<input type="submit" style="float:right; margin-right:20px; margin-top:0px; font-size: 10px; color: #000;font-weight: normal; font-family: Verdana, Arial, sans-serif; background-color: #DDD; text-decoration: none; height:18px;" name="save" value="Grab" title="Download this code"/>';
Deletions:
$form .= '<input type="submit" style="float:right; margin-right:20px;" name="save" value="Save to file" title="Grab code"/>';


Revision [6097]

Edited on 2005-02-17 15:04:14 by DarTar [Adding documentation header]
Additions:
* @todo - address header issues with different browsers.
Deletions:
*
* @todo - Header issue.
*


Revision [6096]

Edited on 2005-02-17 15:03:01 by DarTar [Adding documentation header]
Additions:
/**
* Downloads a code snippet as a file.
*
* Usage: The handler is called from a form appended to any code block in Wikka pages.
*
* @package Handlers
* @name grabcode
*
* @author {@link http://wikka.jsnx.com/DarTar Dario Taraborelli}
* @version 0.1
* @since Wikka 1.1.X
*
* @todo - Header issue.
* - modify formatter to take care of filename.
*
*/


Revision [6095]

Edited on 2005-02-17 14:55:43 by DarTar [Uploaded as beta feature - feedback welcome]
Additions:
''[2004-02-17] - I've uploaded this handler on this server as a beta feature. Feedback is welcome. See the **issues** section at the bottom of this page for more details.''
//header('Content-type: application/force-download');
header('Content-type: text/plain');
Deletions:
''[2004-02-17] - I've uploaded this handler on this server as a beta feature. Feedback is welcome''
header('Content-type: application/force-download');


Revision [6094]

Edited on 2005-02-17 14:53:46 by DarTar [Uploaded as beta feature - feedback welcome]
Additions:
~-It seems that ##Content-type: application/force-download## doesn't work under M$Windows/IE so I changed it back to ##Content-type: text/plain## which should just display a text version of the code snippet.


Revision [6093]

Edited on 2005-02-17 14:41:03 by DarTar [Uploaded as beta feature - feedback welcome]
Additions:
''[2004-02-17] - I've uploaded this handler on this server as a beta feature. Feedback is welcome''
Deletions:
====Sample output====
""<div class="code"><ol><li><div class="de1"><span class="kw2"><?php</span></div></li>
<li><div class="de1"><a href="http://www.php.net/echo"><span class="kw3">echo</span></a> <span class="st0">"Hello world!"</span>;</div></li>
<li><div class="de1"><span class="kw2">?></span> </div></li></ol></div><br /><form action="http://wakka/TestCode/export" method="post">
<input style="float:right; margin-right:20px;margin-top:0px" type="submit" name="save" value="Save to file"
title="Download code" /><input type="hidden" name="code" value="%3C%3Fphp%0Aecho+%22Hello+world%21%22%3B%0A%3F%3E" /></form>
</div>""


Revision [6092]

Edited on 2005-02-17 14:20:08 by DarTar [First draft of GrabCode handler]
Additions:
<input style="float:right; margin-right:20px;margin-top:0px" type="submit" name="save" value="Save to file"
title="Download code" /><input type="hidden" name="code" value="%3C%3Fphp%0Aecho+%22Hello+world%21%22%3B%0A%3F%3E" /></form>
Deletions:
<input class="floatr" type="submit" name="save" value="Save to file" title="Download
code" /><input type="hidden" name="code" value="%3C%3Fphp%0Aecho+%22Hello+world%21%22%3B%0A%3F%3E" /></form>


Revision [6091]

Edited on 2005-02-17 14:16:56 by DarTar [First draft of GrabCode handler]
Additions:
<input class="floatr" type="submit" name="save" value="Save to file" title="Download
Deletions:
<input style="float:right; margin-right:20px;" type="submit" name="save" value="Save to file" title="Download


Revision [6090]

Edited on 2005-02-17 14:12:39 by DarTar [First draft of GrabCode handler]

No Differences

Revision [6089]

Edited on 2005-02-17 14:10:33 by DarTar [First draft of GrabCode handler]
Deletions:
~-Maybe we should find a better name instead of ##codesnippet.php##. I first thought of ##export.php## but this seems more appropriate for filters exporting the page content into a specific format. Any ideas?


Revision [6088]

Edited on 2005-02-17 14:09:48 by DarTar [First draft of GrabCode handler]
Additions:
""<div class="code"><ol><li><div class="de1"><span class="kw2"><?php</span></div></li>
<li><div class="de1"><a href="http://www.php.net/echo"><span class="kw3">echo</span></a> <span class="st0">"Hello world!"</span>;</div></li>
<li><div class="de1"><span class="kw2">?></span> </div></li></ol></div><br /><form action="http://wakka/TestCode/export" method="post">
<input style="float:right; margin-right:20px;" type="submit" name="save" value="Save to file" title="Download
code" /><input type="hidden" name="code" value="%3C%3Fphp%0Aecho+%22Hello+world%21%22%3B%0A%3F%3E" /></form>
Deletions:
""<div class="code"><span class="kw2"><?php</span><br />
<a href="http://www.php.net/echo"><span class="kw3">echo</span></a> <span class="st0">"Hello world!"</span>;<br />
<span class="kw2">?></span></div><br /><form action="http://wakka/TestCode/export" method="post">
<input type="submit" name="save" value="Save to file" /><input type="hidden" name="code" value="%3C%3Fphp%0Aecho+%22Hello+world%21%22%3B%0A%3F%3E" /></form>


Revision [6085]

Edited on 2005-02-17 14:07:25 by DarTar [First draft of GrabCode handler]
Additions:
=====Grab Code Handler=====
Documentation: ""GrabCodeHandlerInfo"".>>This is the development page for the Grab Code handler.::c::
$form = $wakka->FormOpen("grabcode");
$form .= '<input type="submit" style="float:right; margin-right:20px;" name="save" value="Save to file" title="Grab code"/>';
==2. Create a ##grabcode## handler==
Save the following code as **##handlers/page/grabcode.php##**
//$filename = ($_POST["name"])? $_POST["name"] : "snippet.php"; # forthcoming
$filename = "codesnippet.php"; # forthcoming
// grabcode handler
elseif ($this->method == "grabcode")
if (!preg_match("/(xml|raw|mm|grabcode)$/", $method))
Deletions:
=====Code Snippet Handler=====
Documentation: ""CodeSnippetHandlerInfo"".>>This is the development page for the Code Snippet handler.::c::
$form = $wakka->FormOpen("codesnippet");
$form .= '<input type="submit" name="save" value="Save to file" />';
==2. Create a ##codesnippet## handler==
Save the following code as **##handlers/page/codesnippet.php##**
$filename = ($_POST["name"])? $_POST["name"] : "snippet.php"; # forthcoming
//header('Content-type: text/plain');
//header('Connection: close');
// code snippet handler
elseif ($this->method == "codesnippet")
if (!preg_match("/(xml|raw|mm|codesnippet)$/", $method))


Revision [6083]

The oldest known version of this page was created on 2005-02-17 14:03:22 by DarTar [First draft of GrabCode handler]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki