For Programmers: Free Programming Magazines  


Home > Archive > PERL CGI Beginners > November 2004 > was php & Perl, now reusable page elements









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author was php & Perl, now reusable page elements
Cat

2004-11-04, 3:55 am

Hi all,

And thanks to David for his response re using php & perl together.

What made me work with php was it's ability to draw reusable page elements like the header, menu, footer from another html page from a fixed html page.

Now I know that this can be done in perl when the pages are generated by a script, but my pages are fixed html to take advantage of meta tags etc plus completely different layouts required within the one function. So I was attemtping to use the function in php to call headers, footers etc from another html page so that I don't have to alter 150 odd pages each time I change one minor thing in the layout.

So, I am not sure that it would be a great idea to call a subroutined directly from a fixed html page even if it can be done....so how else would I call my headers. footers etc using perl. Tis the question at the end of all of that :-)

Thanks in advance.

Cat
David Dorward

2004-11-04, 3:55 am

On Thu, 2004-11-04 at 15:35 +1100, Cat wrote:
> What made me work with php was it's ability to draw reusable page
> elements like the header, menu, footer from another html page from a
> fixed html page.
>
> Now I know that this can be done in perl when the pages are generated
> by a script,


When a page is generated by PHP it is generated by ... a script! PHP is
just another programming language.

> but my pages are fixed html to take advantage of meta tags etc plus


If you mean "static" HTML, then:
* That will have no influence of your ability to use <meta> elements
* That will provide no advantage to any search engine optimisation you
might be trying to do

Static pages do make it somewhat less work to get sane cache control
headers, and that can provide benefits to search engines (and, more
importantly, to visitors).

> completely different layouts required within the one function.


Do I not understand what "function" means in the context of programming?

> So I was attemtping to use the function in php to call headers,
> footers etc from another html page so that I don't have to alter 150
> odd pages each time I change one minor thing in the layout.


As I believe I suggested before, you can do that with Perl.

> So, I am not sure that it would be a great idea to call a subroutined
> directly from a fixed html page even if it can be done....


Again, if you mean "static", then you can't - by definition. The moment
you start calling server side scripting functions/methods/subroutines
your page becomes dynamic, not static.

> so how else would I call my headers. footers etc using perl. Tis the
> question at the end of all of that :-)


I think I mentioned Template::Toolkit last time.

<http://search.cpan.org/~mjd/Text-Te...ext/Template.pm>

There is also HTML::Template.

<http://search.cpan.org/author/SAMTR...2.7/Template.pm>

and Mason.

<http://search.cpan.org/author/DROLS...b/HTML/Mason.pm>
Ing. Branislav Gerzo

2004-11-04, 3:55 am

Cat [C], on Thursday, November 4, 2004 at 15:35 (+1100) made these
points:

C> So, I am not sure that it would be a great idea to call a
C> subroutined directly from a fixed html page even if it can be
C> done....so how else would I call my headers. footers etc using
C> perl. Tis the question at the end of all of that :-)

I am using Mason, it is easy, look on it! Also you can use
Apache::ASP, embperl, template toolkit...

some comparing over Mason is at:
http://www.masonbook.com/book/chapter-1.mhtml

--

...m8s, cu l8r, Brano.

[I laughed for five straight minutes at this!]


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com