Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Adding Bootstrap to Shopping Cart in Perl ?

by glennpm (Novice)
on Jan 04, 2016 at 20:41 UTC ( #1151873=perlquestion: print w/replies, xml ) Need Help??
glennpm has asked for the wisdom of the Perl Monks concerning the following question:

I redid my web site using a Bootstrap based template and have done some basic Bootstrap changes to my web site but my site is an e-commerce site that uses a shopping cart written in Perl.

All I want to do is change the tables, buttons, input text boxes and such in the <form> code so that the shopping cart look good on mobile devices. I know nothing about Perl but I'm a programmer by trade using C#/Visual Studio.

What is the easiest way to call Bootstrap classes/functions inside .PL scripts?

Thanks, Glenn
  • Comment on Adding Bootstrap to Shopping Cart in Perl ?

Replies are listed 'Best First'.
Re: Adding Bootstrap to Shopping Cart in Perl ?
by hotchiwawa (Scribe) on Jan 04, 2016 at 21:06 UTC
    Source: http://getbootstrap.com/getting-started/
    <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1 +"> <!-- The above 3 meta tags *must* come first in the head; any othe +r head content must come *after* these tags --> <title>Your title</title> <!-- Bootstrap --> <link href="css/bootstrap.min.css" rel="stylesheet"> </head> <body> <h1>Hello, world!</h1> <!-- jQuery (necessary for Bootstrap's JavaScript plugins) --> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/j +query.min.js"></script> <!-- Include all compiled plugins (below), or include individual f +iles as needed --> <script src="js/bootstrap.min.js"></script> </body> </html>
    Import the files in local and change the paths ;)

    After that you can include this code in a .cgi script with print.

    CGI: http://www.tutorialspoint.com/perl/perl_cgi

    Example:
    #!/usr/bin/perl print "Content-type:text/html\r\n\r\n"; print '<html>'; print '<head>'; print '<title>Hello Word - First CGI Program</title>'; print '</head>'; print '<body>'; print '<h2>Hello Word! This is my first CGI program</h2>'; print '</body>'; print '</html>'; 1;
    Now put some jquery instructions if needed, server side codes (perl), custom some boostrap style definition (but not always necessary), data, include others jquery objects...
      Thanks hotchiwawa, but how do you import the Bootstrap files, like <script src="js/bootstrap.min.js"></script> in a Perl .PL script?
        Yep, the url was not good in the page of bootstrap!!

        http://getbootstrap.com/dist/js/bootstrap.min.js
        https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js

        Check the CGI script above and add some print like this:
        print "<script src='http://getbootstrap.com/dist/js/bootstrap.min.js'> +</script>";
      All interactions is via jquery FW => learn the basics, it's very simple but you can also take another way and instead of using Boostrap & Jquery, you can use Bootstrap & AngularJS.

      AngularJS is very popular, it's a MVC pattern.

      http://www.tutorialspoint.com/angularjs/angularjs_mvc_architecture.htm
Re: Adding Bootstrap to Shopping Cart in Perl ?
by hotchiwawa (Scribe) on Jan 05, 2016 at 08:43 UTC
    examples of their doc:
    <div class="panel panel-default"> <div class="panel-body"> Basic panel example </div> </div> <div class="panel panel-default"> <div class="panel-body"> Panel content </div> <div class="panel-footer">Panel footer</div> </div> <a href="#">Inbox <span class="badge">42</span></a> <button class="btn btn-primary" type="button"> Messages <span class="badge">4</span> </button>
    Source: http://getbootstrap.com/components/#badges

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1151873]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (10)
As of 2018-07-20 13:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















    Results (431 votes). Check out past polls.

    Notices?