CodeIgniter Forums
Is this possible? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Is this possible? (/showthread.php?tid=31041)



Is this possible? - El Forum - 06-04-2010

[eluser]Dizza[/eluser]
Hey everyone,

I want to call a function inside a textfield (CKeditor).

Let me explain it a little bit more. I'm building a CMS system and i have some functions which i want to call so it can be placed on a certain page trough the WYSIWYG editor.

So i want to call a function inside the editor with something like this #advertisment#. On the page the #advertisment# is displayed like a advertisment.

Is this possible?

Thanks,


Is this possible? - El Forum - 06-04-2010

[eluser]n0xie[/eluser]
You probably need some javascript for this. Either through your WYSIWYG editor or an external javascript library. Either way this doesn't have much to do with CodeIgniter...


Is this possible? - El Forum - 06-04-2010

[eluser]Simian Studios[/eluser]
If you just need to have "#advertisement#" or the like replaced with an actual ad code, the easiest way is to just do a str_replace() on the page content when you retrieve it from the DB, and before the content gets rendered in the view.

So you would do something like:

Code:
str_replace('#advertisement#', '<<<your ad invocation code here>>>', $this->data['page_content']);

No JS needed, and you can extend it, for example to have different types of ads, etc.