Login

Fragen damit es funzt: 

  • wo muss die .phps hin?
  • Nur der admin oder Herausgeber soll editieren können.

Easy AJAX inline text edit 2.0

aus: http://www.yvoschaap.com/index.php/weblog/ajax_inline_instant_update_text_20/

As everybody knows, refreshing pages is so 1999. AJAX, DOM, whatever you call it makes it possible to let people edit a piece of text inline without having to use a submit button.
You say: but that ain’t new at all! I say: But all of this has been made easy to use and implement: 2.0!

Example page: inline edit (no JS knowledge needed) [source ] | Inline example: Please edit me!

how you can make it work (5 easy steps for integration)

  • OK: Download this Javascript file : InstantEdit 2.0 JS save it as: instantedit.js and upload it to: /wp-includes/js/…
  • OK: Create a update file that handles the input. For example this PHP: Update File
  • ?? Wo muss die hin?
  • OK: In your page add the javascript: <script type=”text/javascript” src=”instantedit.js”></script>
  • ?? Wo, Wie: Set fixed vars (like hidden elements in a field post). These will be posted with the editable field so you can identify a user/session.<script type=”text/javascript”>
    setVarsForm(”pageID=profileEdit&userID=11″);
    </script>

<script type=”text/javascript” src=”instantedit.js”></script><script type=”text/javascript”>setVarsForm(”pageID=profileEdit&userID=11″);</script>

  • ??????? Last step: in your HTML for any editable field add a SPAN arround it:
    <span id=”userName” class=”editText”>John Doe</span>Note: id is the fieldname (?userName=John Doe&), and should be unique!



Too Cool for Internet Explorer
Close
E-mail It