Welcome Guest, Not a member yet? Register   Sign In
Is this possible?
#1

[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,
#2

[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...
#3

[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.




Theme © iAndrew 2016 - Forum software by © MyBB