CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner: Re: [sunrise11] Need to change browser's title for one page: Edit Log



Zhris
Enthusiast

Apr 12, 2011, 11:19 AM


Views: 6136
Re: [sunrise11] Need to change browser's title for one page

PHP being more secure than Perl is just an oppinion. Both languages will require you to validate i.e. form data in much the same way. The statistics show that in relation to the number of PHP users / Perl users, there are still more security issues arrousing with PHP, but that could just be down to chance.

You have to keep in mind, that in order for PHP code to run, the PHP "file" will need the PHP extension .php. Its not as simple as being able to put PHP code inside Perl code, although there may be modules available to help.

Heres a very basic example how I usually build a webpage, although it depends on how much traffic I expect:

Create 3 files:
Header.php
Content.html
Footer.php

Create a Perl script to "glue" the files together and print:


Code
use LWP::Simple; 

my $header = "Header.php?Title=mytitle";
my $content = "Content.html";
my $footer = "Footer.php";

print "Content-type: text/html\n\n";
print get($header);
print get($content);
print get($footer);


The Header.php will receive a param variable "Title" e.g.:


Code
<?php 
if (isset($_GET['Title'])) {
$title = $_GET['Title'];
}
else {
$title = 'Default title';
}
?>

<html>
<head>
<title><?php echo $title ?></title>
</head>
<body>


Thats how I usually use PHP in my Perl scripts, by literally sending a request and printing its output.

Chris


(This post was edited by Zhris on Apr 12, 2011, 1:34 PM)


Edit Log:
Post edited by Zhris (Enthusiast) on Apr 12, 2011, 1:34 PM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives