Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^2: Doubt about Template Toolkit

by Anonymous Monk
on Jul 15, 2022 at 15:04 UTC ( [id://11145535]=note: print w/replies, xml ) Need Help??


in reply to Re: Doubt about Template Toolkit
in thread Doubt about Template Toolkit

Hi haj, that ttml file was incorrect. This is the correct one

[%# template.ttml %] <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <TITLE>Some title</TITLE> <meta http-equiv="refresh" content="$link" /> </head> <body> <center> </center> <form action=""> </form> </body> </html>

The idea with all of this, is when this cgi is executed, every processed url appears in a new tab. But first url does that, second url does not do anything. I made changes to cgi script to see that it reached after loop is executed and it efectively did. That is why I mention that second url is not executed.

Replies are listed 'Best First'.
Re^3: Doubt about Template Toolkit
by haj (Vicar) on Jul 15, 2022 at 16:35 UTC

    It is not TT's fault that this doesn't work as expected: Browsers don't work that way. If you use refresh (I'd recommend that you check the syntax, you did not specify the intended delay), browsers are not supposed to open a new tab.

    Also, hash keys are returned in random order, so you can't say for sure which of the URLs is inserted into the template first.

    If you are on Linux and have LWP installed, the easiest way to check your CGI is the following command:

    GET http://your-server.com/your.cgi.url/

      I am developing in an AIX server, so I do not know if LWP is installed. Is there any way to check if URL sql text is correct with all these characters used?: ',() (quotes, commas or parenthesis). Because that is why I am using meta http-equiv, with this does not matter if sql text has single quotes, commas or parenthesis. Now I am trying to use JS window.open and another problem arises with these characters.

Re^3: Doubt about Template Toolkit
by Bod (Parson) on Jul 15, 2022 at 22:21 UTC
    The idea with all of this, is when this cgi is executed, every processed url appears in a new tab

    Sending multiple HTML documents to the browser will not achieve this...

    I think I would approach this by adding all the URLs into an array and passing a reference to the array into Template to process a single template file. In the template file, have a some Javascript and a FOREACH loop that adds the Javascript calls to window.open for each URL.

    Rather than processing the template file multiple times within Perl, assemble the data in Perl and pass that once to the template file and let that do the iterations.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11145535]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (5)
As of 2024-03-28 12:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found