Just getting started.

View: New views
12 Messages — Rating Filter:   Alert me  

Just getting started.

by Jim Sheffer-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello Everyone!

A little background:
I'm at a point with Lasso that I need to redefine how I write and  
organize my code.
99% of my work centers around cart and administrative systems for  
clients.
I typically keep as much of my Lasso code as possible in include  
folders and pages, separating it from the HTML code.  Most clients  
never touch any code whatsoever, but a few maintain their design with  
programs such as Dreamweaver (With little to no knowledge of even  
basic HTML), making it problematic as they tend to "munge" any Lasso  
type code on the pages.

I spend the majority of my time working with forms, database updates,  
searches and reports for the administrative section work.
For the cart side of things, the biggest problem I run into is making  
the code "compartmentalized"; trying to make it easy to add additional  
features into existing solutions.  At some point, I hit a wall where  
the entire process needs to be re-written because added features begin  
to "degrade' others.
Most of the administrative sections I write tend to use "one file"  
systems, so I'm familiar with, and like the concept.

I'm not too concerned at this point about integrating something like  
Knop into an existing system, but rather using it from the ground up  
on new systems (I have a big re-write of an existing system that I'm  
going to be starting later thins month).

I've read over the manual, looked at the examples and started looking  
at some of the pages (like the Knop.lasso page).  It's a bit daunting  
at this point, and I'm sure I'll have  some annoying questions for the  
list.  For example, does anyone have a sample form page they could  
show me that allows for form fields to be pre-populated if the  
information is there, already formated with HTML?  (example of what I  
do now:

<input name="main_part_1" type="radio" value="b" [if:($plan_info-
 >find:'main_part_1')=='b'] checked[/if]>

I know It seems stupid, but It makes it a lot easier for me to see  
that then the "1-simple-form" example :)

Thanks Johan and all the others for your patience!
Seeing the names on the mailing list, I can see there are a lot of  
"old timers" here, letting me know that If I can wrap my head around  
this, It must be a good choice :)

Those that remember me probably remember the list woes experienced  
with the change over from Mac OS 9 systems, to OS X, 3 different list  
server software changes, and 2 office moves all within about 6  
months.  As the Systems Admin at Blueworld back in the mid 90's, I'm  
sure there was some colorful language that was used when my name came  
up regarding the lists :)

Thanks also to Jolle for the "invitation" on the Lasso list to take a  
closer look at Knop!


James

James Sheffer          jim@...
Lasso Developer        http://www.higherpowered.com
phone:  469-256-0268




--
#############################################################
This message is sent to you because you are subscribed to
the mailing list <knop@...>.
To unsubscribe, E-mail to: <knop-off@...>
Send administrative queries to  <knop-request@...>
List archive http://www.nabble.com/Knop-Framework-Discussion-f29076.html
Project homepage http://montania.se/projects/knop/
Google Code has the latest downloads at http://code.google.com/p/knop/

Re: Just getting started.

by Jolle Carlestam-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

9 mar 2009 kl. 18.26 skrev James Sheffer:

> For example, does anyone have a sample form page they could
> show me that allows for form fields to be pre-populated if the
> information is there, already formated with HTML?  (example of what I
> do now:
>
> <input name="main_part_1" type="radio" value="b" [if:($plan_info-  
> find:'main_part_1')=='b'] checked[/if]>

This is an easy one.

Knop_form takes care of comparing found values with the list items  
used in radio, checkbox and select inputs.

First you create the database object:

var('dDemo' = knop_database( -database='knopdemo', -table='demo',
        -username='knop', -password='knop', // examples only
        -keyfield='keyfield', -lockfield='lockfield'));

Followed by a var holding the values that's supposed to be selected:
        var('options'=array);
You can populate the values here but also wait until later, like after  
you've done a search in another table holding the values you want. You  
just need the var created because if not declared Lasso will object.

Then the form object:
        var('fDemo' = knop_form(
                        -formaction = ($nav -> url( 'advanced')),
                        -method = 'post',
                        -database = $dDemo,
                        -actionpath = 'advanced/edit',
                        -legend = $lang_ui -> editcustomer
                        ));

The fields that you want in the form:
        $fDemo -> addfield(
                        -type = 'text',
                        -name = 'somefield', // note that by using a different name than  
the dbfield you'll hide the real field name from being exposed in the  
web form.
                        -dbfield = 'DEMO_somefield',
                        -label = $lang_ui -> somefield,
                        -required,
                        -size=40);


Here we add a radio field:
        $fDemo -> addfield(
                        -type = 'radio',
                        -name = 'mainpart1',
                        -dbfield = 'DEMO_main_part_1',
                        -options = $options,
                        );

Later in the process you populate the options var:
$options = array( 'b' = 'b', 'b' = $lang_ui -> cvalue, 'b' = $lang_ui -
 > nvalue);

When it's time to render the form:
$fDemo -> renderform;

The code above will automatically create a form with one textfield and  
one set of radio buttons. One for each value in the options array. And  
if the field DEMO_main_part_1 contains the value b it will be checked.

HDB
Jolle

--
#############################################################
This message is sent to you because you are subscribed to
the mailing list <knop@...>.
To unsubscribe, E-mail to: <knop-off@...>
Send administrative queries to  <knop-request@...>
List archive http://www.nabble.com/Knop-Framework-Discussion-f29076.html
Project homepage http://montania.se/projects/knop/
Google Code has the latest downloads at http://code.google.com/p/knop/

Re: Just getting started.

by Johan Solve-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Welcome to Knop, James! I see Jolle is already taking good care of you while I'm on some vacation.

At 19.00 +0100 2009-03-09, Jolle Carlestam wrote:
>Followed by a var holding the values that's supposed to be selected:
> var('options'=array);
>You can populate the values here but also wait until later, like after you've done a search in another table holding the values you want. You just need the var created because if not declared Lasso will object.
...

>Here we add a radio field:
> $fDemo -> addfield(
> -type = 'radio',
> -name = 'mainpart1',
> -dbfield = 'DEMO_main_part_1',
> -options = $options,
> );
>
>Later in the process you populate the options var:
>$options = array( 'b' = 'b', 'b' = $lang_ui -> cvalue, 'b' = $lang_ui -> nvalue);


Some background to explain this behavior.
The $options variable might look like magic but it's simply how it works when having a custom type store a parameter by reference. So when the knop_form ctype stores the options parameter internally, it uses the @ prefix to store a reference to the passed variable instead of copying the variable. By storing a reference it maintains a live connection to the variable.

This way, any change to the variable after passing it to the ctype will conveniently propagate into the ctype.

Just a little techie Lasso perspective to this...

--
     Johan Sölve    [FSA Member, Lasso Partner]
     Web Application/Lasso/FileMaker Developer
     MONTANIA SOFTWARE & SOLUTIONS
http://www.montania.se   mailto:joh-n@...
 (spam-safe email address, replace '-' with 'a')

--
#############################################################
This message is sent to you because you are subscribed to
the mailing list <knop@...>.
To unsubscribe, E-mail to: <knop-off@...>
Send administrative queries to  <knop-request@...>
List archive http://www.nabble.com/Knop-Framework-Discussion-f29076.html
Project homepage http://montania.se/projects/knop/
Google Code has the latest downloads at http://code.google.com/p/knop/

Re: Just getting started.

by Jim Sheffer-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks Johan!

That makes sense about the options  "reference"!

Quick question:

I was trying to get an idea on how the nav variable works.
In Jolle's example concerning the knop_form tag, there is the line:

-formaction = ($nav -> url( 'advanced')),

This throws the error: Page variable "nav" not found.
I thought from looking through the knop.lasso page the variable is set  
there.
In case it was looking for a referrer page, and since I was hitting  
the page directly, I added a page with a link to my test page, but  
still the same error...

So then I copied the example for knop_nav and added to the top of my  
test page, which then threw the error: Page variable"lang_ui" not found.

Is there a config page that I'm not calling, or do I have to make sure  
these variables are set for each page?

James



On Mar 9, 2009, at 5:22 PM, Johan Solve wrote:

> Welcome to Knop, James! I see Jolle is already taking good care of  
> you while I'm on some vacation.
>
> At 19.00 +0100 2009-03-09, Jolle Carlestam wrote:
>> Followed by a var holding the values that's supposed to be selected:
>> var('options'=array);
>> You can populate the values here but also wait until later, like  
>> after you've done a search in another table holding the values you  
>> want. You just need the var created because if not declared Lasso  
>> will object.
> ...
>> Here we add a radio field:
>> $fDemo -> addfield(
>> -type = 'radio',
>> -name = 'mainpart1',
>> -dbfield = 'DEMO_main_part_1',
>> -options = $options,
>> );
>>
>> Later in the process you populate the options var:
>> $options = array( 'b' = 'b', 'b' = $lang_ui -> cvalue, 'b' =  
>> $lang_ui -> nvalue);
>
>
> Some background to explain this behavior.
> The $options variable might look like magic but it's simply how it  
> works when having a custom type store a parameter by reference. So  
> when the knop_form ctype stores the options parameter internally, it  
> uses the @ prefix to store a reference to the passed variable  
> instead of copying the variable. By storing a reference it maintains  
> a live connection to the variable.
>
> This way, any change to the variable after passing it to the ctype  
> will conveniently propagate into the ctype.
>
> Just a little techie Lasso perspective to this...
>
> --
>     Johan Sölve    [FSA Member, Lasso Partner]
>     Web Application/Lasso/FileMaker Developer
>     MONTANIA SOFTWARE & SOLUTIONS
> http://www.montania.se   mailto:joh-n@...
> (spam-safe email address, replace '-' with 'a')
>
> --
> #############################################################
> This message is sent to you because you are subscribed to
> the mailing list <knop@...>.
> To unsubscribe, E-mail to: <knop-off@...>
> Send administrative queries to  <knop-request@...>
> List archive http://www.nabble.com/Knop-Framework-Discussion-f29076.html
> Project homepage http://montania.se/projects/knop/
> Google Code has the latest downloads at http://code.google.com/p/knop/


--
#############################################################
This message is sent to you because you are subscribed to
the mailing list <knop@...>.
To unsubscribe, E-mail to: <knop-off@...>
Send administrative queries to  <knop-request@...>
List archive http://www.nabble.com/Knop-Framework-Discussion-f29076.html
Project homepage http://montania.se/projects/knop/
Google Code has the latest downloads at http://code.google.com/p/knop/

Re: Just getting started.

by Jolle Carlestam-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

10 mar 2009 kl. 01.29 skrev James Sheffer:
I was trying to get an idea on how the nav variable works.
In Jolle's example concerning the knop_form tag, there is the line:

-formaction = ($nav -> url( 'advanced')),

This throws the error: Page variable "nav" not found.
I thought from looking through the knop.lasso page the variable is set  
there.
In case it was looking for a referrer page, and since I was hitting  
the page directly, I added a page with a link to my test page, but  
still the same error...

So then I copied the example for knop_nav and added to the top of my  
test page, which then threw the error: Page variable"lang_ui" not found.

Is there a config page that I'm not calling, or do I have to make sure  
these variables are set for each page?

Sorry about that. I copied a snippet from the demo example and just tweaked it a little to illustrate my point.

In the example there's an assumption that you have a language object and a nav object.

To start with the language object. It's created with Knop_lang and I illustrated how to do that in the "marketing" speech I made on LassoTalk.

If you want to use the language feature it's best to create that in a separate page and include it early in your index.lasso or whatever you use as your onefile starting point.
Here's how I described it on LassoTalk:
First create a lang object:
var('lang_buttons' = knop_lang( -default = 'en', -fallback));

Assign language snippets:
$lang_buttons -> addlanguage(-language = 'en', -strings = map(
'save' = 'Save',
'delete' = 'Delete',
'cancel' = 'Cancel',
'create' = 'Create',
'reset' = 'Reset form',
));

$lang_buttons -> addlanguage(-language = 'sv', -strings = map(
'save' = 'Spara',
'delete' = 'Radera',
'cancel' = 'Avbryt',
'create' = 'Skapa',
'reset' = 'Återställ',
));

Take a look at the demo example specifically the file cfg__lang.inc. I recommend that you copy that file into your own system and just add your own language strings to it.
But this is interesting only if you ever plan to release the site as multi language. If not replace $lang_ui -> xyz with a suitable text string of your own choice. Using Knop_lang is very optional.

Regarding the nav object. It's more intertwined with the form object, but not necessary.

This is my original example:
var('fDemo' = knop_form(
-formaction = ($nav -> url( 'advanced')),
-method = 'post',
-database = $dDemo,
-actionpath = 'advanced/edit',
-legend = $lang_ui -> editcustomer
));
Change it to:
var('fDemo' = knop_form(
-formaction = '/where/to/go',
-method = 'post',
-database = $dDemo,
-actionpath = '/where/you/came/from',
-legend = 'My cool form'
));

In the presented form it will look like this:
<form action="/where/to/go" method="post">
<input type="hidden" name="-action" value="/where/you/came/from">
When you submit the form on the other hand the usefulness of the nav object becomes clearer. Using it you have a ready made line of action to handle the form on the server side. I have not used the form object in situations where I didn't have a nav object. Something I realise now when trying to describe it for you. But use of Knop_nav also means adopting the Knop file structure to master  the nav objects full potential. Once you have the file structure in place Knop_nav will find where you are, include all necessary files and glue them together for you in a usable and presentable way.

In the common case of a form you probably have two items in a nav object. A list view presenting the found records of a search and a detail view for editing a record. Here's a slightly modified example from the demo package:

// create main navigation object
var('nav'=knop_nav( 
-default='customer', // this turns the customer nav object into the default page of the site
-root='/', 
-navmethod='path'); // can be path or param. Path is used in a onefile system using the optional AtBegin handler

var('subnav_temp'=null);

// create nav object for children items
// you start with the child objects so that you later on can add them to their mother
$subnav_temp = knop_nav;
$subnav_temp -> insert( 
-key='list', 
-label='A list');
$subnav_temp -> insert( 
-key='edit', 
-label='Edit');

// add nav item with children items
$nav -> insert( 
-key='customer', 
-label='Customer', 
-children=$subnav_temp, // adding the children previously created
-default='list'); // this turns the list page into the default when navigating to /customer. And since customer is the default for the entire nav object you'll get to the list view using just /

The knop_nav object is typically created in a separate config file. In the demo called cfg__nav.inc. And then inserted into your onefile starting point.

Take a look at the file structure of the demo package and mimic it on your own setup.
For each form (page) you want in your solution you create a config file, library, content and action file. You don't need all of them for every page, it depends on what you'll use the page for.

In the demo the _config,  _library, _content and _action folders are all in the root of the site.
I prefer to toss them into a _site folder  keeping the root as lean as possible. I then direct Knop to look into the _site folder by setting a 'siteroot' variable and use that in all Knop calls.

HDB
Jolle

actionpath questions

by Jim Sheffer-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks everyone for the help so far!

I've had some time to re-read the Knop paper and look over the files in some of the examples and demo, which of course brings up a host of questions, but here are 3 :)

right now I'm concentrating on the form and nav portions.

I'm working on creating some test pages, and starting with a simple sign in page.
I've got the cfg_lang.inv file written, so far seems pretty self explanatory. 

1. I have my index.lasso page that sets up the nav objects and all.  I haven't quit figured out how to call the page any of the links go to.  For example, I'm looking at the "3-nav" page.  The links are displaying, but I'm not sure where to go from there in terms of writing the next page (example, how do I call and display a page: "Latest News").
I'm used to sending a link with the include page name so I know what page to call into my index.lasso page in projects I do now.  I know this is a lame question, but hey, what can I say :)
--------------------------

2.  I'm trying to get the nav objects set up, and have a question regarding actionpath.

 In the examples, the "form action" is written out on the page.  I'd like to use the nav to decide the form actions, rather than writing them out (as Jolle sugested below if not using the nav objects).  In the example below, I'm not sure where "-formaction = ($nav -> url( 'advanced'))," is coming from.

I know there is a nav object called advanced, but not sure on the "$nav -> url" part.


Regarding the nav object. It's more intertwined with the form object, but not necessary.

This is my original example:
var('fDemo' = knop_form(
-formaction = ($nav -> url( 'advanced')),
-method = 'post',
-database = $dDemo,
-actionpath = 'advanced/edit',
-legend = $lang_ui -> editcustomer
));
Change it to:
var('fDemo' = knop_form(
-formaction = '/where/to/go',
-method = 'post',
-database = $dDemo,
-actionpath = '/where/you/came/from',
-legend = 'My cool form'
));

In the presented form it will look like this:
<form action="/where/to/go" method="post">
<input type="hidden" name="-action" value="/where/you/came/from">
When you submit the form on the other hand the usefulness of the nav object becomes clearer. Using it you have a ready made line of action to handle the form on the server side. I have not used the form object in situations where I didn't have a nav object. Something I realise now when trying to describe it for you. But use of Knop_nav also means adopting the Knop file structure to master  the nav objects full potential. Once you have the file structure in place Knop_nav will find where you are, include all necessary files and glue them together for you in a usable and presentable way.

In the common case of a form you probably have two items in a nav object. A list view presenting the found records of a search and a detail view for editing a record. Here's a slightly modified example from the demo package:

// create main navigation object
var('nav'=knop_nav( 
-default='customer', // this turns the customer nav object into the default page of the site
-root='/', 
-navmethod='path'); // can be path or param. Path is used in a onefile system using the optional AtBegin handler

var('subnav_temp'=null);

// create nav object for children items
// you start with the child objects so that you later on can add them to their mother
$subnav_temp = knop_nav;
$subnav_temp -> insert( 
-key='list', 
-label='A list');
$subnav_temp -> insert( 
-key='edit', 
-label='Edit');

// add nav item with children items
$nav -> insert( 
-key='customer', 
-label='Customer', 
-children=$subnav_temp, // adding the children previously created
-default='list'); // this turns the list page into the default when navigating to /customer. And since customer is the default for the entire nav object you'll get to the list view using just /

---------------------------
3.  Next, If someone wouldn't mind explaining these includes, I'd greatly appreciate it (taken from the "demo" index.lasso file- never mind the "library/lib_global.inc" one):

// First load the configuration for the action path
$nav -> (include: 'actionconfig');
// Now execute the application logics for the action path
$nav -> (include: 'action');


// PART 2 - Prepare the output for the page we are showing, specified by the path. 

// First load the configuration for the path.
// It will not be loaded again if it has already been loaded as action config, to avoid overriding the result of the action. 
$nav -> (include: 'config'); // config is a special keyword for -> include

// Run some code that is common for all pages and that needs to be run after the action. 
$nav -> (include: '_library/lib__global.inc'); // -> include is called with a specific filename

// Run page logics to prepare what will be displayed for the current path.
$nav -> (include: 'library');


Thanks again all.
The more I look at the files, the more I know this is exactly where I want to go!

Thanks so much for all the work put into this project Johan and others!

James



Re: actionpath questions

by Johan Solve-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

At 15.49 -0500 2009-03-12, James Sheffer wrote:

>Thanks everyone for the help so far!
>
>I've had some time to re-read the Knop paper and look over the files in some of the examples and demo, which of course brings up a host of questions, but here are 3 :)
>
>right now I'm concentrating on the form and nav portions.
>
>I'm working on creating some test pages, and starting with a simple sign in page.
>I've got the cfg_lang.inv file written, so far seems pretty self explanatory.
>
>1. I have my index.lasso page that sets up the nav objects and all.  I haven't quit figured out how to call the page any of the links go to.  For example, I'm looking at the "3-nav" page.  The links are displaying, but I'm not sure where to go from there in terms of writing the next page (example, how do I call and display a page: "Latest News").
>I'm used to sending a link with the include page name so I know what page to call into my index.lasso page in projects I do now.  I know this is a lame question, but hey, what can I say :)

The example file in 3-nav is only to demonstrate the nav object and is missing the actual meat of a normal page.

This is the normal includes needed to handle actions and display of content.

$nav -> (include: 'actionconfig');
$nav -> (include: 'action');
$nav -> (include: 'config');
$nav -> (include: 'library');
$nav -> (include: 'content');




>--------------------------
>
>2.  I'm trying to get the nav objects set up, and have a question regarding actionpath.
>
> In the examples, the "form action" is written out on the page.  I'd like to use the nav to decide the form actions, rather than writing them out (as Jolle sugested below if not using the nav objects).  In the example below, I'm not sure where "-formaction = ($nav -> url( 'advanced'))," is coming from.

Make sure you're not confusing the form action attribute (specified as -formaction) with the Knop action (specified as -actionpath).

The form action attribute specifies "where to go", and the Knop action specifies where you come from. "Where you go" can be anywhere you want, for example after saving a record after editing it you might want to return to the list. Thus the nav path for the list will be used as the form action attribute (-formaction in knop_form).

The Knop action path specifies how the form input will be processed, and logically it's usually directly related to the form the user came from.

I might be a bit unclear in my attempts to explain this but I hope you get it, or someone else might fill in with better explanations.

>I know there is a nav object called advanced, but not sure on the "$nav -> url" part.

$nav -> url always give you the "real" url of the current location (as determined by $nav -> getlocation)


>---------------------------
>3.  Next, If someone wouldn't mind explaining these includes, I'd greatly appreciate it (taken from the "demo" index.lasso file- never mind the "library/lib_global.inc" one):
>
>// First load the configuration for the action path
>$nav -> (include: 'actionconfig');
>// Now execute the application logics for the action path
>$nav -> (include: 'action');
>
>
>// PART 2 - Prepare the output for the page we are showing, specified by the path.
>
>// First load the configuration for the path.
>// It will not be loaded again if it has already been loaded as action config, to avoid overriding the result of the action.
>$nav -> (include: 'config'); // config is a special keyword for -> include
>
>// Run some code that is common for all pages and that needs to be run after the action.
>$nav -> (include: '_library/lib__global.inc'); // -> include is called with a specific filename
>
>// Run page logics to prepare what will be displayed for the current path.
>$nav -> (include: 'library');

Well there you go, this is the actual meat of the Knop application flow.  I've tried my best to explain this on page 35-36 in the LDC 2008 binder. I hope I didn't fail completely with explaining this. Maybe you have specific questions about it? Otherwise I hope someone else might chime in...



>
>Thanks again all.
>The more I look at the files, the more I know this is exactly where I want to go!
>
>Thanks so much for all the work put into this project Johan and others!
>
>James

Sounds fantastic!

--
     Johan Sölve    [FSA Member, Lasso Partner]
     Web Application/Lasso/FileMaker Developer
     MONTANIA SOFTWARE & SOLUTIONS
http://www.montania.se   mailto:joh-n@...
 (spam-safe email address, replace '-' with 'a')

--
#############################################################
This message is sent to you because you are subscribed to
the mailing list <knop@...>.
To unsubscribe, E-mail to: <knop-off@...>
Send administrative queries to  <knop-request@...>
List archive http://www.nabble.com/Knop-Framework-Discussion-f29076.html
Project homepage http://montania.se/projects/knop/
Google Code has the latest downloads at http://code.google.com/p/knop/

Re: actionpath questions

by Jolle Carlestam-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

12 mar 2009 kl. 21.49 skrev James Sheffer:

> Thanks everyone for the help so far!
>
> I've had some time to re-read the Knop paper and look over the files  
> in some of the examples and demo, which of course brings up a host  
> of questions, but here are 3 :)
>
> right now I'm concentrating on the form and nav portions.
>
> I'm working on creating some test pages, and starting with a simple  
> sign in page.
> I've got the cfg_lang.inv file written, so far seems pretty self  
> explanatory.
>
> 1. I have my index.lasso page that sets up the nav objects and all.  
> I haven't quit figured out how to call the page any of the links go  
> to.  For example, I'm looking at the "3-nav" page.  The links are  
> displaying, but I'm not sure where to go from there in terms of  
> writing the next page (example, how do I call and display a page:  
> "Latest News").
> I'm used to sending a link with the include page name so I know what  
> page to call into my index.lasso page in projects I do now.  I know  
> this is a lame question, but hey, what can I say :)

Actually you'll still send the page name in the link. If you want to.

Say you create a nav object with two items.

First the nav object:
var: 'nav'=(knop_nav:
                -root='/',
                -navmethod='path');

Then the two items that correspond to URLs or pages
$nav -> (insert:
                -key='signin',
                -label='Sign in here'
                );
$nav -> (insert:
                -key='morestuff',
                -label='Some other stuff',
                );


These two nav items translates to the URLs mydomain.tld/signin and  
mydomain.tld/morestuff

Once creating the nav object you call
$nav -> getlocation;
And from now on Knop knows what page you're looking for.

Say you click on a link looking like this:
mydomain.tld/morestuff/somedata

When you ask the nav object to getlocation it knows that there's a  
"page" called morestuff. And since there's no child to morestuff it  
keeps "somedata" as a param that you can call and use in a search for  
example.

So by now the nav object knows that you want a page called morestuff.

These calls will then look for the action, config, library and content  
files corresponding to that name:
$nav -> (include: 'actionconfig');
$nav -> (include: 'action');
$nav -> (include: 'config');
$nav -> (include: 'library');
$nav -> (include: 'content');

In this case files called like cfg_ morestuff.inc, lib_ morestuff.inc  
etc. If Knop can't find one of the files it will silently proceed.
Depending on your needs you can have all or some of them created. Like  
if there's no form used on a page you wont need act_morestuff.inc.

If you have subpages then you create the nav starting with the  
children first.

Let's build some more into the same navobject
$subnav_temp = knop_nav;
$subnav_temp -> (insert:
                -key='list',
                -label='My list');
$subnav_temp -> (insert:
                -key='edit',
                -label='Edit me');

// add nav item with children items
$nav -> (insert:
                -key='otherstuff',
                -label='Yet some more stuff',
                -children=$subnav_temp,
                -default='list');

For these items you really don't need any page for the nav item  
otherstuff since it will go to list as it's default.

These new nav items correspond to the URLs mydomain.tld/otherstuff/  
(or mydomain.tld/otherstuff/list/, same page) and mydomain.tld/
otherstuff/edit/

The pages that Knop will look for is named for example  
act_otherstuff_list.inc for URL mydomain.tld/otherstuff/list/ or  
lib_otherstuff_edit.inc for URL mydomain.tld/otherstuff/edit/

Get it?

> --------------------------
>
> 2.  I'm trying to get the nav objects set up, and have a question  
> regarding actionpath.
>
>  In the examples, the "form action" is written out on the page.  I'd  
> like to use the nav to decide the form actions, rather than writing  
> them out (as Jolle sugested below if not using the nav objects).  In  
> the example below, I'm not sure where "-formaction = ($nav ->  
> url( 'advanced'))," is coming from.
>
> I know there is a nav object called advanced, but not sure on the  
> "$nav -> url" part.

-formaction and -actionpath is tricky to understand. it took several  
explanations from Johan for me to grasp it and I still feel a bit  
shaky about them. But I'll try to explain as far as I understand  
myself. :-)

-formaction will translate to the action part of the HTML form tag

So:
-formaction=($nav -> (url: 'otherstuff'))

will in the HTML come out like:
<form action="/otherstuff/" method="post" id="form1" onsubmit="return  
validateform(this)">
Don't mind the id, onsubmit etc. What's interesting here is only the  
action param. When you submit this form the browser will tell the  
server that you want to send the for mto the page mydomain.tld/
otherstuff/. Since we told the nav object that if someone wants the  
page mydomain.tld/otherstuff/ they really wants mydomain.tld/
otherstuff/list/ that's the page that will eventually get loaded. But,  
the files cfg_otherstuff_list.inc etc are not prepared to deal with  
the form that's sent from the browser. Those instructions are in  
cfg_otherstuff_edit.inc and act_otherstuff_edit.inc.
To deal with that you also have to set an -actionpath in the form  
object.
-actionpath=('otherstuff/edit'),
This will insert a hidden field into the form like this:
<input type="hidden" name="-action" value="otherstuff/edit">
If there's an action_param called -action in the response Knop knows  
that it's time to load and perform the action_config and action files  
first. In this case cfg_otherstuff_edit.inc and  
act_otherstuff_edit.inc. Once that's done it goes on to load the files  
needed to display the result. In this case the otherstuff_list files.
See, easy as baking a cake...

HDB
Jolle

--
#############################################################
This message is sent to you because you are subscribed to
the mailing list <knop@...>.
To unsubscribe, E-mail to: <knop-off@...>
Send administrative queries to  <knop-request@...>
List archive http://www.nabble.com/Knop-Framework-Discussion-f29076.html
Project homepage http://montania.se/projects/knop/
Google Code has the latest downloads at http://code.google.com/p/knop/

Re: actionpath questions

by Jim Sheffer-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Johan-

Thanks for helping!
I try to read everything I could before asking questions, but It  
didn't dawn on my to read the 2008 binder from Lasso Summit (I did  
watch the video though :)

I'll look this over before responding!

Thanks!

James


On Mar 12, 2009, at 4:41 PM, Johan Solve wrote:

> At 15.49 -0500 2009-03-12, James Sheffer wrote:
>> Thanks everyone for the help so far!
>>
>> I've had some time to re-read the Knop paper and look over the  
>> files in some of the examples and demo, which of course brings up a  
>> host of questions, but here are 3 :)
>>
>> right now I'm concentrating on the form and nav portions.
>>
>> I'm working on creating some test pages, and starting with a simple  
>> sign in page.
>> I've got the cfg_lang.inv file written, so far seems pretty self  
>> explanatory.
>>
>> 1. I have my index.lasso page that sets up the nav objects and  
>> all.  I haven't quit figured out how to call the page any of the  
>> links go to.  For example, I'm looking at the "3-nav" page.  The  
>> links are displaying, but I'm not sure where to go from there in  
>> terms of writing the next page (example, how do I call and display  
>> a page: "Latest News").
>> I'm used to sending a link with the include page name so I know  
>> what page to call into my index.lasso page in projects I do now.  I  
>> know this is a lame question, but hey, what can I say :)
>
> The example file in 3-nav is only to demonstrate the nav object and  
> is missing the actual meat of a normal page.
>
> This is the normal includes needed to handle actions and display of  
> content.
>
> $nav -> (include: 'actionconfig');
> $nav -> (include: 'action');
> $nav -> (include: 'config');
> $nav -> (include: 'library');
> $nav -> (include: 'content');
>
>
>
>
>> --------------------------
>>
>> 2.  I'm trying to get the nav objects set up, and have a question  
>> regarding actionpath.
>>
>> In the examples, the "form action" is written out on the page.  I'd  
>> like to use the nav to decide the form actions, rather than writing  
>> them out (as Jolle sugested below if not using the nav objects).  
>> In the example below, I'm not sure where "-formaction = ($nav ->  
>> url( 'advanced'))," is coming from.
>
> Make sure you're not confusing the form action attribute (specified  
> as -formaction) with the Knop action (specified as -actionpath).
>
> The form action attribute specifies "where to go", and the Knop  
> action specifies where you come from. "Where you go" can be anywhere  
> you want, for example after saving a record after editing it you  
> might want to return to the list. Thus the nav path for the list  
> will be used as the form action attribute (-formaction in knop_form).
>
> The Knop action path specifies how the form input will be processed,  
> and logically it's usually directly related to the form the user  
> came from.
>
> I might be a bit unclear in my attempts to explain this but I hope  
> you get it, or someone else might fill in with better explanations.
>
>> I know there is a nav object called advanced, but not sure on the  
>> "$nav -> url" part.
>
> $nav -> url always give you the "real" url of the current location  
> (as determined by $nav -> getlocation)
>
>
>> ---------------------------
>> 3.  Next, If someone wouldn't mind explaining these includes, I'd  
>> greatly appreciate it (taken from the "demo" index.lasso file-  
>> never mind the "library/lib_global.inc" one):
>>
>> // First load the configuration for the action path
>> $nav -> (include: 'actionconfig');
>> // Now execute the application logics for the action path
>> $nav -> (include: 'action');
>>
>>
>> // PART 2 - Prepare the output for the page we are showing,  
>> specified by the path.
>>
>> // First load the configuration for the path.
>> // It will not be loaded again if it has already been loaded as  
>> action config, to avoid overriding the result of the action.
>> $nav -> (include: 'config'); // config is a special keyword for ->  
>> include
>>
>> // Run some code that is common for all pages and that needs to be  
>> run after the action.
>> $nav -> (include: '_library/lib__global.inc'); // -> include is  
>> called with a specific filename
>>
>> // Run page logics to prepare what will be displayed for the  
>> current path.
>> $nav -> (include: 'library');
>
> Well there you go, this is the actual meat of the Knop application  
> flow.  I've tried my best to explain this on page 35-36 in the LDC  
> 2008 binder. I hope I didn't fail completely with explaining this.  
> Maybe you have specific questions about it? Otherwise I hope someone  
> else might chime in...
>
>
>
>>
>> Thanks again all.
>> The more I look at the files, the more I know this is exactly where  
>> I want to go!
>>
>> Thanks so much for all the work put into this project Johan and  
>> others!
>>
>> James
>
> Sounds fantastic!
>
> --
>     Johan Sölve    [FSA Member, Lasso Partner]
>     Web Application/Lasso/FileMaker Developer
>     MONTANIA SOFTWARE & SOLUTIONS
> http://www.montania.se   mailto:joh-n@...
> (spam-safe email address, replace '-' with 'a')
>
> --
> #############################################################
> This message is sent to you because you are subscribed to
> the mailing list <knop@...>.
> To unsubscribe, E-mail to: <knop-off@...>
> Send administrative queries to  <knop-request@...>
> List archive http://www.nabble.com/Knop-Framework-Discussion-f29076.html
> Project homepage http://montania.se/projects/knop/
> Google Code has the latest downloads at http://code.google.com/p/knop/


--
#############################################################
This message is sent to you because you are subscribed to
the mailing list <knop@...>.
To unsubscribe, E-mail to: <knop-off@...>
Send administrative queries to  <knop-request@...>
List archive http://www.nabble.com/Knop-Framework-Discussion-f29076.html
Project homepage http://montania.se/projects/knop/
Google Code has the latest downloads at http://code.google.com/p/knop/

Re: actionpath questions

by Jim Sheffer-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Jolli-

Thanks for all the help (and the excellent sales pitch on Lassotalk!-  
It shoved me to take some action instead of sitting on the fence  
procrastinating on which way to go, and the more time I spend, the  
more I'm glad I did!).
On Mar 12, 2009, at 4:51 PM, Jolle Carlestam wrote:

> 12 mar 2009 kl. 21.49 skrev James Sheffer:
>
>> Thanks everyone for the help so far!
>>
>> I've had some time to re-read the Knop paper and look over the  
>> files in some of the examples and demo, which of course brings up a  
>> host of questions, but here are 3 :)
>>
>> right now I'm concentrating on the form and nav portions.
>>
>> I'm working on creating some test pages, and starting with a simple  
>> sign in page.
>> I've got the cfg_lang.inv file written, so far seems pretty self  
>> explanatory.
>>
>> 1. I have my index.lasso page that sets up the nav objects and  
>> all.  I haven't quit figured out how to call the page any of the  
>> links go to.  For example, I'm looking at the "3-nav" page.  The  
>> links are displaying, but I'm not sure where to go from there in  
>> terms of writing the next page (example, how do I call and display  
>> a page: "Latest News").
>> I'm used to sending a link with the include page name so I know  
>> what page to call into my index.lasso page in projects I do now.  I  
>> know this is a lame question, but hey, what can I say :)
>
> Actually you'll still send the page name in the link. If you want to.
>
> Say you create a nav object with two items.
>
> First the nav object:
> var: 'nav'=(knop_nav:
> -root='/',
> -navmethod='path');
>
> Then the two items that correspond to URLs or pages
> $nav -> (insert:
> -key='signin',
> -label='Sign in here'
> );
> $nav -> (insert:
> -key='morestuff',
> -label='Some other stuff',
> );
>
>
> These two nav items translates to the URLs mydomain.tld/signin and  
> mydomain.tld/morestuff
>
> Once creating the nav object you call
> $nav -> getlocation;
> And from now on Knop knows what page you're looking for.
>
> Say you click on a link looking like this:
> mydomain.tld/morestuff/somedata
>
> When you ask the nav object to getlocation it knows that there's a  
> "page" called morestuff. And since there's no child to morestuff it  
> keeps "somedata" as a param that you can call and use in a search  
> for example.
>
> So by now the nav object knows that you want a page called morestuff.
>
> These calls will then look for the action, config, library and  
> content files corresponding to that name:
> $nav -> (include: 'actionconfig');
> $nav -> (include: 'action');
> $nav -> (include: 'config');
> $nav -> (include: 'library');
> $nav -> (include: 'content');

Where is the information for "(include: 'actionconfig')"?
I have folders for the other four, but not for this...
>
> In this case files called like cfg_ morestuff.inc, lib_  
> morestuff.inc etc. If Knop can't find one of the files it will  
> silently proceed.
> Depending on your needs you can have all or some of them created.  
> Like if there's no form used on a page you wont need  
> act_morestuff.inc.
So, clicking on the link:
http://www.mydomain.tld/knop/my_stuff/admin/
Will automatically know to search  _action,  _config,  _content and  
_library folders for the appropriate files named (knowing my_stuff is  
the root, which it does):
act_ admin.inc
cfg_ admin.inc
cnt_ admin.inc
lib_ admin.inc

Please tell me I'm right on this- This would be soooo cool!!!
That was the part I was missing- I didn't know how the system knew  
where to go!
Again,  PLEASE tell me this is so :)

>
> If you have subpages then you create the nav starting with the  
> children first.
>
> Let's build some more into the same navobject
> $subnav_temp = knop_nav;
> $subnav_temp -> (insert:
> -key='list',
> -label='My list');
> $subnav_temp -> (insert:
> -key='edit',
> -label='Edit me');
>
> // add nav item with children items
> $nav -> (insert:
> -key='otherstuff',
> -label='Yet some more stuff',
> -children=$subnav_temp,
> -default='list');
>
> For these items you really don't need any page for the nav item  
> otherstuff since it will go to list as it's default.
>
> These new nav items correspond to the URLs mydomain.tld/otherstuff/  
> (or mydomain.tld/otherstuff/list/, same page) and mydomain.tld/
> otherstuff/edit/
>
> The pages that Knop will look for is named for example  
> act_otherstuff_list.inc for URL mydomain.tld/otherstuff/list/ or  
> lib_otherstuff_edit.inc for URL mydomain.tld/otherstuff/edit/
>
> Get it?
>
>> --------------------------
>>
>> 2.  I'm trying to get the nav objects set up, and have a question  
>> regarding actionpath.
>>
>> In the examples, the "form action" is written out on the page.  I'd  
>> like to use the nav to decide the form actions, rather than writing  
>> them out (as Jolle sugested below if not using the nav objects).  
>> In the example below, I'm not sure where "-formaction = ($nav ->  
>> url( 'advanced'))," is coming from.
>>
>> I know there is a nav object called advanced, but not sure on the  
>> "$nav -> url" part.
>
> -formaction and -actionpath is tricky to understand. it took several  
> explanations from Johan for me to grasp it and I still feel a bit  
> shaky about them. But I'll try to explain as far as I understand  
> myself. :-)
>
> -formaction will translate to the action part of the HTML form tag
>
> So:
> -formaction=($nav -> (url: 'otherstuff'))
>
> will in the HTML come out like:
> <form action="/otherstuff/" method="post" id="form1"  
> onsubmit="return validateform(this)">
> Don't mind the id, onsubmit etc. What's interesting here is only the  
> action param. When you submit this form the browser will tell the  
> server that you want to send the for mto the page mydomain.tld/
> otherstuff/. Since we told the nav object that if someone wants the  
> page mydomain.tld/otherstuff/ they really wants mydomain.tld/
> otherstuff/list/ that's the page that will eventually get loaded.  
> But, the files cfg_otherstuff_list.inc etc are not prepared to deal  
> with the form that's sent from the browser. Those instructions are  
> in cfg_otherstuff_edit.inc and act_otherstuff_edit.inc.
> To deal with that you also have to set an -actionpath in the form  
> object.
> -actionpath=('otherstuff/edit'),
> This will insert a hidden field into the form like this:
> <input type="hidden" name="-action" value="otherstuff/edit">
ok, just like I currently use- A hidden field: "page=pagename.inc"

> If there's an action_param called -action in the response Knop knows  
> that it's time to load and perform the action_config and action  
> files first. In this case cfg_otherstuff_edit.inc and  
> act_otherstuff_edit.inc. Once that's done it goes on to load the  
> files needed to display the result. In this case the otherstuff_list  
> files.
> See, easy as baking a cake...

Thanks so much- If I'm right, that was the missing piece I wasn't  
seeing!

James

>
> HDB
> Jolle


--
#############################################################
This message is sent to you because you are subscribed to
the mailing list <knop@...>.
To unsubscribe, E-mail to: <knop-off@...>
Send administrative queries to  <knop-request@...>
List archive http://www.nabble.com/Knop-Framework-Discussion-f29076.html
Project homepage http://montania.se/projects/knop/
Google Code has the latest downloads at http://code.google.com/p/knop/

Re: actionpath questions

by Jolle Carlestam-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

13 mar 2009 kl. 00.50 skrev James Sheffer:

>
> Jolli-

My name is Jolle. And I take it bad if someone get it wrong.
;-)

Anyway, Jamis, Here's some more insights.

>> These calls will then look for the action, config, library and
>> content files corresponding to that name:
>> $nav -> (include: 'actionconfig');
>> $nav -> (include: 'action');
>> $nav -> (include: 'config');
>> $nav -> (include: 'library');
>> $nav -> (include: 'content');
>
> Where is the information for "(include: 'actionconfig')"?
> I have folders for the other four, but not for this...

actionconfig will call the config file, like cfg_mystuff.inc.

Knop needs the same info as when it built the form. But this time it  
will also include act_mystuff.cfg.

One the action needed to deal with the sent in form data is done it  
will proceed with the work needed for the place you're going to. If  
that's a different page it will include that pages config file.

>
>>
>> In this case files called like cfg_ morestuff.inc, lib_
>> morestuff.inc etc. If Knop can't find one of the files it will
>> silently proceed.
>> Depending on your needs you can have all or some of them created.
>> Like if there's no form used on a page you wont need
>> act_morestuff.inc.
> So, clicking on the link:
> http://www.mydomain.tld/knop/my_stuff/admin/

That link looks like it's rather long.
Why do you put knop/mystuff in it? Only makes it longer in my eyes.

> Will automatically know to search  _action,  _config,  _content and
> _library folders for the appropriate files named (knowing my_stuff is
> the root, which it does):
> act_ admin.inc
> cfg_ admin.inc
> cnt_ admin.inc
> lib_ admin.inc

Well yes, if knop/mystuff is set as site root then it will find those  
files.

Combining site root and files to get a match can take some iterations.  
Early in the site build process I tend to just put some simple content  
into, say the content file to see that it shows up testing the URL in  
question.
A simple 'hello world' will do.

> Please tell me I'm right on this- This would be soooo cool!!!
> That was the part I was missing- I didn't know how the system knew
> where to go!
> Again,  PLEASE tell me this is so :)

I think it is.

>> To deal with that you also have to set an -actionpath in the form
>> object.
>> -actionpath=('otherstuff/edit'),
>> This will insert a hidden field into the form like this:
>> <input type="hidden" name="-action" value="otherstuff/edit">
> ok, just like I currently use- A hidden field: "page=pagename.inc"

Yes, only Knop will create the hidden input for you. It will also  
create a hidden input -keyfield if it's a new record you're creating  
or a hidden input -lockfield if you're editing an existing record.
-lockfield will be populated with an encrypted time stamp id.

> Thanks so much- If I'm right, that was the missing piece I wasn't
> seeing!

See if we can turn on the light for you!

HDB
Jolle

--
#############################################################
This message is sent to you because you are subscribed to
the mailing list <knop@...>.
To unsubscribe, E-mail to: <knop-off@...>
Send administrative queries to  <knop-request@...>
List archive http://www.nabble.com/Knop-Framework-Discussion-f29076.html
Project homepage http://montania.se/projects/knop/
Google Code has the latest downloads at http://code.google.com/p/knop/

Re: actionpath questions

by Jim Sheffer-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Jolle-

Apologies on the misspelling!

I spilled a big glass of iced tea on my keyboard 2 days ago, and had  
to run out  at ten in the evening to buy a new keyboard- One of these  
"wave" keyboards was all they had.  Having used the classic rectangle  
keyboard forever, I'm having hell typing anything these days :)


On Mar 13, 2009, at 1:01 AM, Jolle Carlestam wrote:

> 13 mar 2009 kl. 00.50 skrev James Sheffer:
>
>>
>> Jolli-
>
> My name is Jolle. And I take it bad if someone get it wrong.
> ;-)
>
> Anyway, Jamis, Here's some more insights.
>>> These calls will then look for the action, config, library and
>>> content files corresponding to that name:
>>> $nav -> (include: 'actionconfig');
>>> $nav -> (include: 'action');
>>> $nav -> (include: 'config');
>>> $nav -> (include: 'library');
>>> $nav -> (include: 'content');
>>
>> Where is the information for "(include: 'actionconfig')"?
>> I have folders for the other four, but not for this...
>
> actionconfig will call the config file, like cfg_mystuff.inc.
>
> Knop needs the same info as when it built the form. But this time it  
> will also include act_mystuff.cfg.
>
> One the action needed to deal with the sent in form data is done it  
> will proceed with the work needed for the place you're going to. If  
> that's a different page it will include that pages config file.
I think I understand that, but as I delve deeper I'm sure it will  
become clearer!

>
>>
>>>
>>> In this case files called like cfg_ morestuff.inc, lib_
>>> morestuff.inc etc. If Knop can't find one of the files it will
>>> silently proceed.
>>> Depending on your needs you can have all or some of them created.
>>> Like if there's no form used on a page you wont need
>>> act_morestuff.inc.
>> So, clicking on the link:
>> http://www.mydomain.tld/knop/my_stuff/admin/
>
> That link looks like it's rather long.
> Why do you put knop/mystuff in it? Only makes it longer in my eyes.
I have a domain I use for development and testing( my "play" domain),  
that's why the "knop/my_stuff" folder :)

>
>> Will automatically know to search  _action,  _config,  _content and
>> _library folders for the appropriate files named (knowing my_stuff is
>> the root, which it does):
>> act_ admin.inc
>> cfg_ admin.inc
>> cnt_ admin.inc
>> lib_ admin.inc
>
> Well yes, if knop/mystuff is set as site root then it will find  
> those files.
>
> Combining site root and files to get a match can take some  
> iterations. Early in the site build process I tend to just put some  
> simple content into, say the content file to see that it shows up  
> testing the URL in question.
> A simple 'hello world' will do.
That's kind of what I'm doing now- just playing around to see what  
does what.  Starting with a simple "sign in" Isn't for any particular  
job, just a starting point for me to learn.
>
>> Please tell me I'm right on this- This would be soooo cool!!!
>> That was the part I was missing- I didn't know how the system knew
>> where to go!
>> Again,  PLEASE tell me this is so :)
>
> I think it is.
I think this weekend will be fun now that I understand that!

>
>>> To deal with that you also have to set an -actionpath in the form
>>> object.
>>> -actionpath=('otherstuff/edit'),
>>> This will insert a hidden field into the form like this:
>>> <input type="hidden" name="-action" value="otherstuff/edit">
>> ok, just like I currently use- A hidden field: "page=pagename.inc"
>
> Yes, only Knop will create the hidden input for you. It will also  
> create a hidden input -keyfield if it's a new record you're creating  
> or a hidden input -lockfield if you're editing an existing record.
> -lockfield will be populated with an encrypted time stamp id.
>
>> Thanks so much- If I'm right, that was the missing piece I wasn't
>> seeing!
>
> See if we can turn on the light for you!
Good luck!  Even when the light is on, sometimes It's still to dim to  
see anything in my world :)

Again, thanks everyone for the help!

James

>
> HDB
> Jolle
>
> --
> #############################################################
> This message is sent to you because you are subscribed to
> the mailing list <knop@...>.
> To unsubscribe, E-mail to: <knop-off@...>
> Send administrative queries to  <knop-request@...>
> List archive http://www.nabble.com/Knop-Framework-Discussion-f29076.html
> Project homepage http://montania.se/projects/knop/
> Google Code has the latest downloads at http://code.google.com/p/knop/


--
#############################################################
This message is sent to you because you are subscribed to
the mailing list <knop@...>.
To unsubscribe, E-mail to: <knop-off@...>
Send administrative queries to  <knop-request@...>
List archive http://www.nabble.com/Knop-Framework-Discussion-f29076.html
Project homepage http://montania.se/projects/knop/
Google Code has the latest downloads at http://code.google.com/p/knop/