Templating

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

Templating

by Steve Piercy :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm trying to create a print template that lacks all the stuff
of a normal template for both on-screen display and printed
output.  I'm not sure whether this is possible with Knop using
the method I attempt as follows.

In the Knop demo file /index.lasso, there is a comment:

// Page output begins here, so from here on we could use a
template include for better separation of logic and presentation

However when I attempt to include a file from within
/index.lasso, I receive an Apache 404 file not found error.  
Here is the code snippet:

select($rfp); // $rfp == response_filepath declared in cfg__global.inc
case('/print_template');
     include('print_template.lasso');
case;
]...default html template...[/select]

I know I could put a bunch of case statements within the HTML
itself, but that just gets ugly.  I'm not sure how to implement
templates or troubleshoot this.  Any hints appreciated.

--steve

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- --
Steve Piercy               Web Site Builder              
Soquel, CA
<web@...>                  <http://www.StevePiercy.com/>


--
#############################################################
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: Templating

by Steve Piercy :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 10/18/09 at 5:11 PM, Web@... (Steve Piercy - Web
Site Builder) pronounced:

>I'm trying to create a print template that lacks all the stuff
>of a normal template for both on-screen display and printed
>output.  I'm not sure whether this is possible with Knop using
>the method I attempt as follows.
>
>In the Knop demo file /index.lasso, there is a comment:
>
>// Page output begins here, so from here on we could use a
>template include for better separation of logic and presentation
>
>However when I attempt to include a file from within
>/index.lasso, I receive an Apache 404 file not found error.  
>Here is the code snippet:
>
>select($rfp); // $rfp == response_filepath declared in cfg__global.inc
>case('/print_template');
>include('print_template.lasso');
>case;
>]...default html template...[/select]
>
>I know I could put a bunch of case statements within the HTML
>itself, but that just gets ugly.  I'm not sure how to implement
>templates or troubleshoot this.  Any hints appreciated.

Evidently either Apache, Knop or the urlhandler.inc file (or
some combination thereof) does not like either the location or
extension for print_template.lasso.  Here is my solution,
although I don't know exactly why it works.  I plunked this into
/index.lasso and removed all the other stuff after the comment
for the page output:

     select($rfp);
         case('/print_template');
             include($siteroot + '_util/print_template.inc');
         case;
             include($siteroot + '_util/index.inc');
     /select;

--steve

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- --
Steve Piercy               Web Site Builder              
Soquel, CA
<web@...>                  <http://www.StevePiercy.com/>


--
#############################################################
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: Templating

by Johan Solve-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

From Lasso's perspective, the current file location is the virtual URL so any relative includes start from there.
For example for the url /client/list/print/ Lasso will look for includes down in the folder /client/list/print/ which of course doesn't exist since it's virtual.

So you need to use absolute paths in all includes, as you've already figured out.

            include($siteroot + '_util/print_template.inc');



At 17.11 -0700 2009-10-18, Steve Piercy - Web Site Builder wrote:

>I'm trying to create a print template that lacks all the stuff of a normal template for both on-screen display and printed output.  I'm not sure whether this is possible with Knop using the method I attempt as follows.
>
>In the Knop demo file /index.lasso, there is a comment:
>
>// Page output begins here, so from here on we could use a template include for better separation of logic and presentation
>
>However when I attempt to include a file from within /index.lasso, I receive an Apache 404 file not found error.  Here is the code snippet:
>
>select($rfp); // $rfp == response_filepath declared in cfg__global.inc
>case('/print_template');
>    include('print_template.lasso');
>case;
>]...default html template...[/select]
>
>I know I could put a bunch of case statements within the HTML itself, but that just gets ugly.  I'm not sure how to implement templates or troubleshoot this.  Any hints appreciated.
>
>--steve
>
>-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
>Steve Piercy               Web Site Builder
>Soquel, CA
><web@...>                  <http://www.StevePiercy.com/>
>
>
>--
>#############################################################
>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/


--
     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/