TemplatePower & AJAX


Posted on 16th Feb 2014 07:03 pm by admin

Hi all,



I'm currently implementing some AJAX features in my PHP-framework (which is based on TemplatePower) and I have encountered a problem:

I have a block which holds a message-div. This block is called upon (with the ->newBlock() method) by my message class. This way of showing message has worked great up until now (because every time a message should been shown, the page should be reloaded anyway).

But now I want to show a message when I click on a checkbox WITHOUT reloading the page. As I expected I received following error:
Code: [Select]Fatal error: Call to a member function newBlock() on a non-object in /home/www.myurl.com/message.php on line 28

And on line 28 i call $tpl->newBlock("MESSAGE"); where $tpl is an instance of TemplatePower.

As I didn't find a clear tutorial/solution for this via Google I'm presenting this problem to you guys: Is there an easy way to keep my current structure (with the template blocks) and let AJAX make use of this? Or should I rethink the structure?



TIA,

No comments posted yet

Your Answer:

Login to answer
344 Like 5 Dislike
Previous forums Next forums
Other forums

Display a default image
I am trying to display generic image for items that don't have one, but I can't get it to display.

If a form submits back to same page do you need to use $get
IM trying to pass page number and year that was selected back to the same page.

i have this c

IP Based Cron Jobs
I run cronjobs on my website. After one of my visitors got curious and tinkered around he realized h

Progress bar for webpage
Hi,
I want to implement a progress/waiting bar on my webpage - exactly the same thing that the Mi

Page Reload
I am having issues getting a page to reload after I submit data to a database. This form should inp

mysqli_fetch_assoc returns multiple arrays, how to return a single array
Hello, I am using mysqli_fetch_assoc which is returning multiple rows, so it looks like:

Code

Execure stored procedure on a timer
Can someone tell me an easier way to execute a stored procedure on a timer? I am using Oracle 10g R

Hit counter updating once per IP - IP HIT COUNTER
I have a hit counter, for the amount of views on a tutorial.
It'll do the query and then do..

Compare user input to flat file data
Help...Am a complete newbie to programming so my code is prolly quite long. Am trying to verify a us

Need help urgant
why down my code ony return one item instead of all the items selected.

$arr = array($date,$

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash