473,387 Members | 1,318 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Dynamic Web PAge Titles using Perl and CGI

how would I go about creating a dynamic web page title that would grab the first line of text of of my web page, using perl and CGI?
Oct 5 '07 #1
3 2436
4,059 Expert 2GB
is the webpge on the same server as the perl script or on a remote server? Do you know any perl?
Oct 5 '07 #2
176 Expert 100+
You can insert a title, as well as many other attributes to the "head" section through the use of a hash reference:

Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/perl -T 
  3. # Use -T if you are going to be allowing users to submit text.
  4. # another great tool is the "fatals to browser"
  6. use CGI:Carp qw(fatalsToBrowser warningsToBrowser);
  7. use CGI qw(:standard);
  8. use strict;
  9. use warnings;
  11. print header;
  12. print start_html(-title=>'Whatever title you want', 
  13.            script=>{'src'=>'URL to src of javascript'}, 
  14.            style=>{'src'=>'source of style sheet'});
The result would be:

Content type
<doctype definition>

<meta char-set def>

<title>Whatever title you want</title>
<script type="text/javascript" src="source to javascript file"></script>
<link rel="stylesheet" href="source to stylesheet">

Read more here

How you can capture the first line of the page, and insert it into the title, would have to do with setting a scalar, and substituting it in the start_html function call.

Exactly how is up to you...
Oct 5 '07 #3
4,059 Expert 2GB
You can insert a title, as well as many other attributes to the "head" section through the use of a hash reference:
His webpage appears to already exist so the process is going to be different than for creatig a new webpage.
Oct 5 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

by: DylanM | last post by:
I have some checkboxes that are generated from the results of a database search. At the moment, the checkboxes are part of a table making up a form. Users are going through the form, clicking the...
by: Devon | last post by:
Hi All, I'm generating a pdf document using FOP .25 from Apache. I've created running dynamic headings (e.g. chapter titles) that change as dictated by the XML source I'm converting to PDF. Now...
by: Steve Gadlin | last post by:
Hi there! First off, let me apologize for the basic question... I'm very new to .NET programming. I'm building a web site using VB.NET, and am trying to include several custom user controls. ...
by: Ben Allen | last post by:
Hi, I've created a mySQL database with the fields id, title and content. 'ID' is a unique field. Any ideas on how I can use PHP to generate a list of the titles which are links. When you click on...
by: Bass Pro | last post by:
Hi, I am creating textbox, radiobuttonlist and checkboxlist dynamically depending on data from a table. It is a questionnaire. I add the control on a Panel control during the 1st load_page event....
by: Vito DeCarlo | last post by:
Does anyone have any idea as to a workaround for using dynamic TITLEs with Indexing Service? For example, due to the fact that we're using Master Pages, we're dyanamically creating the TITLE...
by: OverTheTop | last post by:
All the usual Newbie stuff applies... I have a Windows2000 Server with ActivePerl and a module (DBD-Interbase) that worked fine. Trying to duplicate the environment on Windows2003 Server for...
by: pittendrigh | last post by:
There must be millions of dynamically generated html pages out there now, built by on-the-fly php code (and jsp, perl cgi, asp, etc). Programatic page generation is transparently useful. But...
by: creative1 | last post by:
Here is how you create a complex data report that involves parent and child commands and you can update information at runtime. Its pretty straight forward to work with simple queries; however,...
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.