Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Jan 2011
    Posts
    136
    Thanks
    101
    Thanked 0 Times in 0 Posts

    How to render part of a CGI html?

    Is it possible to render only a part of a html at a time, so that I can insert some dynamic data in between? For example:

    Code:
    print "Content-type: text/html\n\n";
    
    print <<HTML;
    <html>
    
    <head>
    <title>aaa</title>
    </head>
    
    <body>
    <p> This is blah blah</p>
    After some Perl processing, I want to display the result:

    Code:
    print "<p>The result is $result. </p>";
    Then I want to render the second half of the html:
    Code:
    </body>
    </html>
    HTML
    How should I achieve this? Thank you in advance.
    Last edited by camaross; 05-12-2011 at 08:21 PM.

  • #2
    New Coder
    Join Date
    Oct 2006
    Posts
    68
    Thanks
    0
    Thanked 28 Times in 28 Posts
    Quote Originally Posted by camaross View Post
    Is it possible to render only a part of a html at a time, so that I can insert some dynamic data in between? For example:
    Nope, not possible....

    But you might want to play around just to make sure.

    - M

    </sarcastic>

  • Users who have thanked miller for this post:

    camaross (05-12-2011)

  • #3
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Code:
    use strict;
    use warnings;
    use CGI;
    
    my $cg = CGI->new;
    print $cg->header,
       $cg->start_html(-title => 'aaa'),
       q(<p>This is blah blah</p>);
    
    # ... After some Perl processing, I want to display the result
    
    print $cg->start_p, qq(The result is $result), $cg->end_p;
    
    # ... After some other Perl processing, I want to display the result
    
    print $cg->end_html;
    best regards

  • Users who have thanked oesxyl for this post:

    camaross (05-13-2011)

  • #4
    Regular Coder
    Join Date
    Jan 2011
    Posts
    136
    Thanks
    101
    Thanked 0 Times in 0 Posts
    Thank you for the reply.

    Quote Originally Posted by oesxyl View Post
    Code:
    use strict;
    use warnings;
    use CGI;
    
    my $cg = CGI->new;
    print $cg->header,
       $cg->start_html(-title => 'aaa'),
       q(<p>This is blah blah</p>);
    
    # ... After some Perl processing, I want to display the result
    
    print $cg->start_p, qq(The result is $result), $cg->end_p;
    
    # ... After some other Perl processing, I want to display the result
    
    print $cg->end_html;
    best regards


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •