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: 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?

No comments posted yet

Your Answer:

Login to answer
231 Like 34 Dislike
Previous forums Next forums
Other forums

What are the two different files you download to update kernel?
What are the two different files you download to update kernel?

Why does first ever HttpSendRequest take longer?
I promise this isn't as simple as it sounds. I'm wondering why the the first ever call to HttpSendRe

If a record matches an existing record do nothing
So I don't know if I should put this here or in mysql, but what my script is for is for people to ad

COOIS - Saving Object Overview WIP Status layouts
COOIS - Would like to be able to save the layout of an Object Overview - WIP Status report. There i

Contact Form Not Working When I Add Validation Codes
So I built my first working PHP "Contact Us" like form. But, I have been trying to now mak

Simple MySQL query...
Hello,
How could I do a mysql query that does this: SELECT * WHERE date/time < 5minutes ag

Code error with Index.php
Error: Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/runevid/public_

gmmktime or mktime
I live in the UK, i am within the GMT (with daylight saving time ie 1 hour difrence between summer a

Apple's revamped lineup arrives

I'm personally curious about the magic mouse.. a multi-touch concept sounds like it could be nea

Serial number of exernal hard disk/Thumbdrive
Hi guys, I am new tio java networking concepts.Please tel me how to get Serial number of exernal

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