CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignCSS Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old March 12th, 2004, 04:39 PM
Quivver Quivver is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 11 Quivver User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Using <Div> and CSS in CGI.pm

Ok, so CGI.pm claims to have limited support for CSS sheets, so i decided to test this, and indeed you can apply certain styles to a newly generated page. However, one of the most imporant styling tags, <DIV> is not fully supported.

I have the following code which doesn't work. Can anyone provide insight.

Code:

#!/usr/bin/perl -w

use CGI qw(:all);
use CGI::Carp qw(fatalsToBrowser);

  my $cgi = new CGI;
  print header();
  print start_html(
      -title=>'Confirmation Page',
      -dtd=>"-//W3C//DTD HTML 4.0 Transitional//EN",
      -style=>{'src'=>'/~spendhar/css/netflixxx.css'}),


       div(-class=>{'bodyMain'},
           p({-class=>'bodyText'},"This should work",
                    h1('Hope this works'),
      end_html()));


The problem is how to access classes within <DIV> because CGI.pm won't allow you to do that.

Reply With Quote
  #2  
Old March 12th, 2004, 05:11 PM
Hero Zzyzzx's Avatar
Hero Zzyzzx Hero Zzyzzx is offline
11
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Jul 2001
Location: Lynn, MA
Posts: 4,635 Hero Zzyzzx User rank is Second Lieutenant (5000 - 10000 Reputation Level)Hero Zzyzzx User rank is Second Lieutenant (5000 - 10000 Reputation Level)Hero Zzyzzx User rank is Second Lieutenant (5000 - 10000 Reputation Level)Hero Zzyzzx User rank is Second Lieutenant (5000 - 10000 Reputation Level)Hero Zzyzzx User rank is Second Lieutenant (5000 - 10000 Reputation Level)Hero Zzyzzx User rank is Second Lieutenant (5000 - 10000 Reputation Level)Hero Zzyzzx User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 4 Days 23 h 44 m 19 sec
Reputation Power: 77
Send a message via AIM to Hero Zzyzzx
CGI.pm doesn't export it's div() method by default.

Use the object oriented CGI interface, or import the div method as well by putting it in the "use" statement
Code:
#!/usr/bin/perl
use CGI;
#use CGI ('div'); #import the div() method

my $q=CGI->new();

print $q->div(
              {-class=>"foo"},
              $q->p("Here's a paragraph")
             );
print CGI::div(
          {-class=>"foo"},
          $q->p("Here's a another paragraph")
         );

Reply With Quote
  #3  
Old March 12th, 2004, 06:16 PM
Quivver Quivver is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 11 Quivver User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
thanks Hero Zzyzzx, i actually managed to get it to work without resorting to cgi.pm (which i find is more cumbersome for my needs anyway).

I did have another question for you though. Is it possible to generate a html page via perl which also uses SSI includes ? The reason i ask is that i have my header and footer in a .shtml which i call via SSI include. Now that i'm using perl to generate new pages, i would like to dump my SSI include in the code and have perl actually interprete and use SSI to generate the header and footer.

An example of my code is :

Code:
#!/usr/bin/perl

use CGI;
use CGI qw(:all);
use CGI::Carp qw(fatalsToBrowser);

print "Content-type: text/html\n\n";

print "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"
\"http://www.w3.org/TR/html4/loose.dtd\">\n";

print "<html><head>\n";
print "<!--#set var=\"Doc_Title\" value=\"Net FlixXx Online\" -->\n";
print "<title> <!--#echo var = \"Doc_Title\" --> </title>\n";
print "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\n$
print "<link href=\"/~spendhar/css/netflixxx.css\" rel=\"stylesheet\"
type=\"text/css\">\n";

print "</head>\n";

print "<body leftmargin=\"0\" rightmargin=\"0\">\n";
print "<div class=\"mainFrame\">\n";
print "<!--#include virtual=\"/~spendhar/***1/header.shtml\" -->\n";

print "<div class=\"bodymain\">\n";
print "<p class=\"bodyTitle\"> News </p>\n";
print "<p class=\"bodyText\">Hello, world!</p>\n";
print "</div></div></body></html>\n";



The code above doesn't work with the includes, i guess perl doesn't know how to handle them. Any workarounds to this problem ?

Reply With Quote
  #4  
Old March 13th, 2004, 03:57 PM
john_coller john_coller is offline
IT Consultant
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: UK, Nottingham
Posts: 23 john_coller User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via MSN to john_coller
Have you tried looking at the html::template perl module? It makes writting sections of html a lot easier.

Reply With Quote
  #5  
Old March 14th, 2004, 07:51 AM
Hero Zzyzzx's Avatar
Hero Zzyzzx Hero Zzyzzx is offline
11
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Jul 2001
Location: Lynn, MA
Posts: 4,635 Hero Zzyzzx User rank is Second Lieutenant (5000 - 10000 Reputation Level)Hero Zzyzzx User rank is Second Lieutenant (5000 - 10000 Reputation Level)Hero Zzyzzx User rank is Second Lieutenant (5000 - 10000 Reputation Level)Hero Zzyzzx User rank is Second Lieutenant (5000 - 10000 Reputation Level)Hero Zzyzzx User rank is Second Lieutenant (5000 - 10000 Reputation Level)Hero Zzyzzx User rank is Second Lieutenant (5000 - 10000 Reputation Level)Hero Zzyzzx User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 4 Days 23 h 44 m 19 sec
Reputation Power: 77
Send a message via AIM to Hero Zzyzzx
Quote:
Originally Posted by john_coller
Have you tried looking at the html::template perl module? It makes writting sections of html a lot easier.


Yes it does. I use HTML::Template for everything I develop. But there's also CGI::SSI on www.cpan.org. Try that out, but I also suggest picking up HTML::Template.

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignCSS Help > Using <Div> and CSS in CGI.pm


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT