got error in hello world itself

Discuss anything that's related to the Raxan framework

got error in hello world itself

Postby finaxis » Thu Feb 16, 2012 1:42 pm

m getting this error "Fatal error: Exception thrown without a stack frame in Unknown on line 0".

I followed the steps in installation guide and upon loading the file in the browser; got the above error. If I echo hello world in Index php , it works fine. I've tried changing the paths (views and site path) in config files with no success. I searched for the solution and many sites suggested "try - catch exceptions" but where should I place this code.

even the examples downloaded from raxan site are not working. html display is working.

m a nubie developer. need help to get started with raxan.

would appreciate if you can also verify this :
Code: Select all
$config['site.url']     = 'http://localhost:8888/raxan/raxan-sdk/sdk/raxan/';
$config['site.path']    = '/Applications/MAMP/htdocs/raxan/raxan-sdk/sdk/raxan/';


Thanks and regards.
Finaxis
finaxis
 
Posts: 28
Joined: Thu Feb 16, 2012 1:17 pm

Re: got error in hello world itself

Postby finaxis » Thu Feb 16, 2012 2:05 pm

m getting this error "Fatal error: Exception thrown without a stack frame in Unknown on line 0".

I followed the steps in installation guide and upon loading the file in the browser; got the above error. If I echo hello world in Index php , it works fine. I've tried changing the paths (views and site path) in config files with no success. I searched for the solution and many sites suggested "try - catch exceptions" but where should I place this code.

even the examples downloaded from raxan site are not working. html display is working.

m a nubie developer. need help to get started with raxan.

would appreciate if you can also verify this :
Code: Select all
$config['site.url']     = 'http://localhost:8888/raxan/raxan-sdk/sdk/raxan/';
$config['site.path']    = '/Applications/MAMP/htdocs/raxan/raxan-sdk/sdk/raxan/';


Thanks and regards.
Finaxis[/quote]
finaxis
 
Posts: 28
Joined: Thu Feb 16, 2012 1:17 pm

Re: got error in hello world itself

Postby raymond » Fri Feb 17, 2012 2:46 am

Hi Finaxis,

Your site path/url is incorrect. It should be set to the root of your application.

Try changing it to the following:

Code: Select all
$config['site.url']     = 'http://localhost:8888/raxan/raxan-sdk/sdk/';
$config['site.path']    = '/Applications/MAMP/htdocs/raxan/raxan-sdk/sdk/';



__
Raymond
raymond
Site Admin
 
Posts: 215
Joined: Tue Mar 17, 2009 5:04 am

Re: got error in hello world itself

Postby finaxis » Wed Feb 29, 2012 3:48 am

Hey Raymond,
Your work is fantastic and best is plugin handling among many remarkable features.
being a beginner, need your help for the following (just thought to share in one go, please pardon me if too many):
1. switching page controller through pageid / controller function or any other way. can't figure it out.
2. can I combine css files like you've combined js.
3. floatVal($val, 2) is not controlling the precision, it displays the total number of decimals.
4. filtervalues is posting the literal fields instead of values. its posting login, pass, title, role, author. instead of their values.
Code: Select all
$this->post->filterValues(array(
            'login' => 'alphanumeric',
            'pass' => 'text',
            'title' => 'text',
            'role' => 'float',
            'author' => 'int'
         ));

5.How do I check the js enabled / disabled on the client and render different index.php in different circumstances.
6. is their any function that sanitizes file uploads.
7. handling cache (cache flow, page, element, table etc.) or the system handles it automagically.
8. is system handling the sessions? if not should I use plugin route of the page controller for session class.
9 can I delete adodb since I only know pdo.

10.how do I use this expression in my class else where and put it in _load via plugin. Actualy I am trying to get this "submit1" and ('click', array()) from other functions for automating the task
Code: Select all
$this->submit1->bind('click', array('callback' => '.admin'));

I want to use the id value as $variable and array as $variable.



Thanks and Regards,
Finaxis
finaxis
 
Posts: 28
Joined: Thu Feb 16, 2012 1:17 pm

Re: got error in hello world itself

Postby finaxis » Fri Mar 02, 2012 8:00 am

Hello Raxan Team and members,
I've been reading the forum topics and observed that no problem was left unresolved which is a great feeling to experience as a newbie in this php world. Also, got the solution for some but below are the un-resolved. Would appreciate the reply !
finaxis wrote:1. switching page controller through pageid / controller function or any other way. can't figure it out.
4. filtervalues is posting the literal fields instead of values. its posting login, pass, title, role, author. instead of their values.
Code: Select all
$this->post->filterValues(array(
            'login' => 'alphanumeric',
            'pass' => 'text',
            'title' => 'text',
            'role' => 'float',
            'author' => 'int'
         ));

5.How do I check the js enabled / disabled on the client and render different index.php in different circumstances.
6. is their any function that sanitizes file uploads.
8. is system handling the sessions? if not should I use plugin route of the page controller for session class.

cache solution is still not found and I'll be more specific later.

Thanks and Regards,
Finaxis
finaxis
 
Posts: 28
Joined: Thu Feb 16, 2012 1:17 pm

Re: got error in hello world itself

Postby raymond » Sun Mar 04, 2012 3:37 pm

Many thanks for your feedback. I will try to answer the questions below:

finaxis wrote:1. switching page controller through pageid / controller function or any other way. can't figure it out.


Have a look at the URL Router plugin: viewtopic.php?f=15&t=119

2. can I combine css files like you've combined js.


Yes, you can combine your css into a single stylesheet and then load it using loadCSS()

3. floatVal($val, 2) is not controlling the precision, it displays the total number of decimals.


floatval just converts the value. Try using round() or number_format()

4. filtervalues is posting the literal fields instead of values. its posting login, pass, title, role, author. instead of their values.
Code: Select all
$this->post->filterValues(array(
            'login' => 'alphanumeric',
            'pass' => 'text',
            'title' => 'text',
            'role' => 'float',
            'author' => 'int'
         ));


The filterValues function should return an associative with both field names and values. Here's a quick example:
Code: Select all
<?php
class TestFilterValues extends RaxanWebPage {
   
    protected function button($e) {
               
        $data = $this->post->textVal('text1');
        $data = $this->post->filterValues(array(
            'text1'=>'text',
            'text2'=>'int',
        ));
       
        $this->findById('pre1')->html(print_r($data,true));
    }
}
?>

<!DOCTYPE html>

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <title>Your title here...</title>
    </head>

    <body>
        <form name="form1" action="" method="post">
            <input type="text" name="text1" id="text1" value="mary" />
            <input type="text" name="text2" id="text2" value="1234" />
            <input type="submit" name="button1" id="button1" value="Button" xt-bind="click,button"/>
        </form>
        <pre id="pre1"></pre>
    </body>

</html>


The above should output the following when the button is clicked:

Code: Select all
Array
(
    [text1] => mary
    [text2] => 1234
)


5.How do I check the js enabled / disabled on the client and render different index.php in different circumstances.

You can either use the <noscript> tag to display a message to the client when JS is not available or you could use an intermediate page or view to check for javascript. Here's an example:
Code: Select all
<?php
class IndexPage extends RaxanWebPage {
   
    protected function _init() {
        if (!Raxan::data('client-js-checked')) {
            $status = $this->get->textVal('js');
            if (!$status) {
                $this->activeView = 'checkjs';
            }
            else {
                Raxan::data('client-js-checked',$status);
                if ($status=='enabled') $this->redirectTo('index.php'); // redirect to the index page
                else $this->redirectTo('another.php'); // or if no js then redirect to another page
            }
        }
    }
   
    protected function _checkjsView() {
        $url = $this->clientPostbackUrl;
        $this->source('<html><head>
            <script type="text/javascript"> window.location = "'.$url.'?js=enabled";</script>
            <meta http-equiv="refresh" content="0; url='.$url.'?js=disabled">
        </head><body></body></html>');
    }

}
?>


6. is their any function that sanitizes file uploads.


I don't have any method to santize file uploads but you can check out the following methods that are available on the $this->post object:
http://raxanpdi.com/sdk/docs/RaxanDataS ... ileContent

7. handling cache (cache flow, page, element, table etc.) or the system handles it automagically.


There's is currently no built-in support for full page caching but you can implement this as a plugin or use a third party library. Check out this cache lib: http://www.rooftopsolutions.nl/blog/107

8. is system handling the sessions? if not should I use plugin route of the page controller for session class.


Yes, the framework support session handlers. See State & Session Management - http://raxanpdi.com/sdk/docs/state-management.html

9 can I delete adodb since I only know pdo.


The adodb-time library is only used for PHP versions that do not support the DateTime object. So if you've using 5.2 or higher then adodb-time will not be loaded.

10.how do I use this expression in my class else where and put it in _load via plugin. Actualy I am trying to get this "submit1" and ('click', array()) from other functions for automating the task
Code: Select all
$this->submit1->bind('click', array('callback' => '.admin'));

I want to use the id value as $variable and array as $variable.


If you're using a plugin then a reference to the page controller should be passed intto the page_load event otherwise you can get the current page controller by calling RaxanWebPage::controller(). For example:
Code: Select all
$page = RaxanWebPage::controller();
$page->bind('click',array($this,'methodName')); // note methodName must be a public method



Best regards,
Raymond
raymond
Site Admin
 
Posts: 215
Joined: Tue Mar 17, 2009 5:04 am

Re: got error in hello world itself

Postby finaxis » Sun Mar 04, 2012 10:02 pm

class Me implements RaymondSolutions
{
$member = ' ' ;
function problemSolved ()
{
$this->'member' = 'Thanks for being there Raymond. Your solutions hits a bulls eye.'
$consequency = ' problems reduced - life is easier ';
echo $consequency;
}
}

Please verify if I did it the correct way: I've applied url.router.php (put it in plugin)
/***** in gateway.php******/
include_once '/Applications/MAMP/htdocs/MyApp/pages/index.php';
RaxanWebPage::init('Index');
/******* gateway.php ends********/
but have to type "http://localhost:8888/MyApp/index". want to load the index file with "http://localhost:8888/MyApp/"

$a = "Cannot override final method Exception::__clone()" [edited :: IT OCCURS BECAUSE OF MY newform() thing, kind of solved (my apologies) ]

protected function _load()
{
RaxanWebPage::controller('Client.php');
$this->bind('click', Client::Form()->newform());
} // class Client (client.php) is loaded through a plugin called (Client.php)

$b = 'want to bind an element id ='submit1'
Code: Select all
 $this->submit1->bind('click',Client::Form()->newform());
so when its clicked this function results are displayed in the div( loading a form created by this function)'. However, the above code ($a) results replaced the entire page while showing an exception ($a).

$c = asynchronous event types (#) is not working. although the console shows http://localhost:8888/MyApp/index ........200 ok 21ms.

$d = xt- (attributes) applied to the form which is created by php code is reflecting as an html attribute in the browser.


Other solutions have worked Great (didn't try the js ckeck yet)!
Thanks and Regards,
Finaxis
finaxis
 
Posts: 28
Joined: Thu Feb 16, 2012 1:17 pm

Re: got error in hello world itself

Postby raymond » Mon Mar 05, 2012 1:46 pm

It appears that the plugin is not installed correctly. Check to make sure that you have done the following:

1. Copy url.router.php to raxan/plugins
2. Rename you existing index.php file to main.php
2. Copy the files index.php and router.htaccess files to your web application root.
3. Rename router.htaccess to .htaccess

You don't need to modify the gateway.php to include the plugin. It's already loaded from inside the index.php that comes with the url router plugin.

To create an alias, edit the index.php and add your alias:

Code: Select all
// setup routes (aliases)
$router->addRoute('/','/main');
// the above alias will map http://localhost:8888/MyApp/ to http://localhost:8888/MyApp/main.php


$a = "Cannot override final method Exception::__clone()" [edited :: IT OCCURS BECAUSE OF MY newform() thing, kind of solved (my apologies) ]

protected function _load()
{
RaxanWebPage::controller('Client.php');
$this->bind('click', Client::Form()->newform());
} // class Client (client.php) is loaded through a plugin called (Client.php)


It appears that the plugin is not being loaded correctly. Try doing something linke this:

Code: Select all
Raxan::loadPlugin('client'); // if client.php

class WebPage extends RaxanWebPage {
   protected function _load() {       
      $form = Client::Form(); // get a reference to the form object
      $callback = array($form,'newform'); // setup user defined callback handler.
      $this->findById('elementId')->bind('click', $callback);  // bind callback to click event
   }
}

Here's some more information on user-defined callbacks - http://php.net/manual/en/language.pseudo-types.php

$b = 'want to bind an element id ='submit1...'


Try doing the following:

Code: Select all
$form = Client::Form(); // get a reference to the form object
$callback = array($form,'newform'); // setup user defined callback handler.
$this->findById('submit1')->bind('click', $callback);  // bind callback to click event


$c = asynchronous event types (#) is not working...


Not sure if this is caused by ($a)

$d = xt- (attributes) applied to the form which is created by php...


It appears that the page is not being rendered. Check for php errors inside the code


Best regards,
__
Raymond
raymond
Site Admin
 
Posts: 215
Joined: Tue Mar 17, 2009 5:04 am

Re: got error in hello world itself

Postby finaxis » Mon Mar 12, 2012 7:37 am

Thanks buddy.
dont know the exact problem so, I started all over again from the download. Now its working but when the event fires (any element, any event) , the console shows error
Code: Select all
elm is undefined  (startup.js line 514)
I am using click and focusout event (separate bind statements) on an input (type=text).

Once again Thanks. I got it (form thing) working like this:
Code: Select all
$form = Client::Form(); // wrapped in the _load
      $new = $form->newform(); //wrapped in functionName
      $this->text1->bind('click', .functionName);  // bind callback to click event
   }


Still trying to work out to attach xt-autoupdate on the fly to an element. let me give you the exact thing later.
appreciate your support
thanks and Regards
Finaxis
finaxis
 
Posts: 28
Joined: Thu Feb 16, 2012 1:17 pm

Re: got error in hello world itself

Postby raymond » Wed Mar 14, 2012 1:02 am

Hi,

Nice to hear that you've got it to work :)

finaxis wrote: Now its working but when the event fires (any element, any event) , the console shows error
Code: Select all
elm is undefined  (startup.js line 514)
I am using click and focusout event (separate bind statements) on an input (type=text).


I think there's a problem when it's try to update an element. This might be due to xt-autoupdate or updateClient().

[/quote]
Still trying to work out to attach xt-autoupdate on the fly to an element. let me give you the exact thing later.
appreciate your support
thanks and Regards
Finaxis[/quote]

Try using the updatClient() method to update the content of the element on the client:

Code: Select all
<div id="box1"></dv>
....
$elm = $this->findById("box1");
$elm->text("it is working!");
$elm->updateClient();


Best regards,
__
Raymond
raymond
Site Admin
 
Posts: 215
Joined: Tue Mar 17, 2009 5:04 am

Next

Return to General Discussions

Who is online

Users browsing this forum: No registered users and 1 guest

cron