silverorange labs

Comments

Comments are locked. No additional comments may be posted.

Jon -

Followed you steps. Doesnt seem like the zip structure is right. I had to move the Swat folder in the root directory of the zip, into the demo/www folder. I am also experiencing some bugs on the SwatDetails view part of the demo.

Mike Gauthier -

Hi Jon,

The problem you're probably experiencing with having to move the Swat directory into demo/www is related to your PHP include path. Ideally, you should set your include path to include the root directory of the zip archive using the PHP set_include_path()/get_include_path() functions.

Can you let us know what bugs you are experiencing with the DetailsView demo?

Shawn -

When trying to run the demo I get this

<pre style="overflow: auto; width: 500px;">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<?=$html_head_entries?>
<style type="text/css" media="all">@import "styles/demo.css";</style>
<title><?=$title?></title>
<link rel="icon" href="favicon.ico" type="image/x-icon" />
</head>
<body>

<?=$ui?>
</body>
</html>
</pre>

[edit] cleaned pasted XHTML output.

Mike Gauthier -

Shawn,

Either your PHP installation has the short_open_tags directive turned off, or Apache is not set up to handle PHP files. The short_open_tags directive is on by default in PHP so we didn't think using short open tags in our template would be a problem. In a future release, we'll update the template to not use short open tags. In the meantime, you can change all occurrences of:

<pre>
<?=$variable?>
</pre>

to

<pre>
<?php echo $variable; ?>
</pre>

Jon -

Hey Shawn,

Here is what I get when I try the DetailsView part of the demo:

<pre style="overflow: auto; width: 500px; height: 250px;">
Message:
moneyFormat() method is not available on this operating system. See http://php.net/manual/en/function.money-format.php for details.
Created in file C:\Program Files\xampp\htdocs\swat\demo\www\Swat\SwatString.php on line 691.

Stack Trace:

17.In file C:\Program Files\xampp\htdocs\swat\demo\www\Swat\SwatMoneyCellRenderer.php line 83.
Method: SwatString::moneyFormat(0.5, 'en_CA', , <null>)
16.In file C:\Program Files\xampp\htdocs\swat\demo\www\Swat\SwatDetailsViewField.php line 217.
Method: SwatMoneyCellRenderer->render()
15.In file C:\Program Files\xampp\htdocs\swat\demo\www\Swat\SwatDetailsViewField.php line 155.
Method: SwatDetailsViewField->displayRenderers(<FruitObject object>)
14.In file C:\Program Files\xampp\htdocs\swat\demo\www\Swat\SwatDetailsViewField.php line 112.
Method: SwatDetailsViewField->displayValue(<FruitObject object>)
13.In file C:\Program Files\xampp\htdocs\swat\demo\www\Swat\SwatDetailsView.php line 242.
Method: SwatDetailsViewField->display(<FruitObject object>, 1)
12.In file C:\Program Files\xampp\htdocs\swat\demo\www\Swat\SwatDetailsView.php line 159.
Method: SwatDetailsView->displayContent()
11.In file C:\Program Files\xampp\htdocs\swat\demo\www\Swat\SwatContainer.php line 436.
Method: SwatDetailsView->display()
10.In file C:\Program Files\xampp\htdocs\swat\demo\www\Swat\SwatForm.php line 216.
Method: SwatContainer->displayChildren()
9.In file C:\Program Files\xampp\htdocs\swat\demo\www\Swat\SwatContainer.php line 436.
Method: SwatForm->display()
8.In file C:\Program Files\xampp\htdocs\swat\demo\www\Swat\SwatFrame.php line 118.
Method: SwatContainer->displayChildren()
7.In file C:\Program Files\xampp\htdocs\swat\demo\www\Swat\SwatContainer.php line 436.
Method: SwatFrame->display()
6.In file C:\Program Files\xampp\htdocs\swat\demo\www\Swat\SwatDisplayableContainer.php line 31.
Method: SwatContainer->displayChildren()
5.In file C:\Program Files\xampp\htdocs\swat\demo\www\Swat\SwatContainer.php line 436.
Method: SwatDisplayableContainer->display()
4.In file C:\Program Files\xampp\htdocs\swat\demo\www\Swat\SwatContainer.php line 421.
Method: SwatContainer->displayChildren()
3.In file C:\Program Files\xampp\htdocs\swat\demo\www\Swat\SwatUI.php line 267.
Method: SwatContainer->display()
2.In file C:\Program Files\xampp\htdocs\swat\demo\include\DemoApplication.php line 408.
Method: SwatUI->display()
1.In file C:\Program Files\xampp\htdocs\swat\demo\include\DemoApplication.php line 81.
Method: DemoApplication->buildLayout()
0.In file C:\Program Files\xampp\htdocs\swat\demo\www\index.php line 19.
Method: DemoApplication->run()
</pre>

Sorry I didn't post it before. I appreciate your help with this, I am really interested in using Swat in some upcoming web developments.

-Jon

Mike Gauthier -

Hi Jon,

Are you using Swat on Windows? If this is the case, the message field of the exception accurately describes what is happening. PHP on Windows does not have a money_format() function.

The SwatDetailsView demo uses SwatMoneyCellRenderer which in turn uses SwatString::moneyFormat() which in turn uses PHP's money_format() function.

Working around this in the DetailsView demo can be done by replacing SwatMoneyCellRenderer with SwatNumericCellRenderer in the XML and then removing the currency specific properties in the XML.

If you need SwatString::moneyFormat() to work on Windows, we'd gladly accept a patch that emulates PHP's money_format() function on Windows.

Feel free to ask further questions here or on the swat-devel mailing list. The mailing list is read more frequently by more Swat developers.

johnrembo -

dooh!
it took me for a while to set-up swat's demo on windows box.

several notes to make it less paintfull:
    a) start from putting
    ini_set('display_errors',1);
    error_reporting(E_ALL);
    at the top of "c:/root/Swat/Swat-1.2.35/demo/www/index.php" to make sure you have debug messages visible.

    b) php_gettext.dll - as far as I am not using this at all -I found it nearly impossible to find for php5. After long hour of digging I had to install WAMP (www.wampserver.com) and voila - under /wamp/bin/php/ext there was working php_gettext.dll
    c) as it was already mentioned above - all of the includes fails, so place the following line at demo/www/index.php
set_include_path("c:/root/Swat/Swat-1.2.35;c:/root/Swat/Swat-1.2.35/Date/Date-1.4.7");
    d) alternatively, create a folder named "packages" under c:/root and extract yahoo yui there.
    e) create folder "swat" in c:/root/packages and put "styles" folder from c:/root/Swat/Swat-1.2.35/www/ there

jonrembo -

a little correction:
ignore prievious "d)"
d) - put the contents of yui/build to c:/root/Swat/Swat-1.2.35/demo/www/packages/yui

Johnston -

Hey, thank you for this timely tutorial. I was just about to give up on SWAT, not being able to understand it. But this tutorial explains it very well, and to be honest, SWAt seems quite simple now.
Regards, Johnston from rocky point auto insurance