020 555 1111
  • Old fashion, modular, procedural PHP plus some scaffolding techniques to allow it to mimic MVC simplicity.
  • A quick reference to help you find in PHP maze what needs to be done and how to do it.
  • Learn a PHP Object Oriented Programming by building a live discussion forum application.
  • MVC - Model View Controller - real life, easy reference and application.
This product has options, take a look at them and select ones you like the most.
Options are displayed under image section.

Include content of external file
[in: CKEditor example]

Sometimes you may need some dynamic data added to a WYSIWYG content delivered by CKEditor.

Examples:

  • a dynamically populated table, delivering latest data to static WYSIWYG content
  • a scroller with some dynamically fetched output
  • a dataset spread across different WYSIWYG content pages
  • etc.

In such case you can employ AJAX to fetch external file content and place it anywhere you want in WYSIWYG content.

Whole process of placinf external file content in WYSIWYG is very fast and easy.

Live example can be found here.

Lets see how it is done.

step 1:

Lets create some external file. I will use standard, non-dynamic html file for this example. It can be replaced by dynamic php file.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<ul>
	<li>		this is my external file</li>
	<li>I can put any code I want</li>
	<li>this allows me to add any custom content</li>
	<li>this also allows me to position this content anywhere in CKEditor edited content<br />
	</li>
</ul>
</body>
</html>

step 2:

Then you need to place some html element for Ajax to use a output target element. I will use div tag with cettain id (can be any) for Ajax to know that this is the right receiving div for external file content to be dumped  (loaded) to..

<div id="get_file"></div>

step 3:

I need to ad some simple jQuery code to fetch external file. I will use load() function.

<script language="javascript" type="text/javascript">$(function() { $("#get_file").load('examples/cke_ext_file/external_file.php'); }); </script>

 

This is it. We are done.

Watch movie for details.

0
select image below and hover above to zoom
  • 1