Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Software > Macromedia Dreamweaver > Can this Perl s...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 14 Topic 93831 of 98347
Post > Topic >>

Can this Perl solution be replicated in PHP?

by "mjs" <no@[EMAIL PROTECTED] > Aug 7, 2008 at 12:58 PM

My legacy websites use an old CGI (perl) script that inserts a raw content 
file inside a master template (aka the layout).

The way this worked is by way of url. The syntax would be :
domain.com/article.cgi?file=content.html

Where "content.html" would be inserted inside "template.html" (at an 
insertion point called <!-- RAW --> somewhere on a blank line inside the 
template file), then displayed to the user. There would be hundreds of 
"content" files, but just 1 "template.html".

Since then, I've switched to PHP includes, and completely forgotten about 
the old perl script. But as I'm dusting off my legacy websites and
bringing 
them up to code, I realize that this old perl script holds two major 
advantages over the PHP includes.

1. FEWER FILES ON THE SERVER. Since the url tells article.cgi what to
parse 
with what, there's no need for a separate file telling the server what 
pieces to combine with what. In PHP, you'd need the file with the includes

inside, AS WELL as the raw content file. For each instance of new content,

you'd also need a new "assembler" file containing all the includes. So if 
you have 200 content files, you've got an additional 200 php files 
containing all the necessary includes.

2. ABILITY TO EDIT TEMPLATE DIRECTLY IN DW. With PHP, you've got your
header 
as one include, the content as another, and the footer as a third. If
you're 
used to the design view, you can't edit the header or the footer any other

way than by re-combining them in a temp file and working on THAT... then 
splitting them up again as header and footer files (the reason being that 
most of the tags opened in the header aren't closed until you get to the 
footer, so opening either one on its own will cause Dreamweaver to freak
out 
and kick you in the balls as a reflex).

I was therefore wondering how difficult it would be to mimic the perl 
behavior in PHP.

In other words, have a "template.html" file with an insertion point 
specified via comment somewhere inside it, and have all files targeted by 
the URL go there before the combined webpage is displayed to the user.
There 
might even be a way to modify .htaccess so that every webpage on the site
is 
included inside this "template.html" file before display.

How do-able is any of this? Depending on the level of complexity, I'd even

be willing to pay for the help.
 




 14 Posts in Topic:
Can this Perl solution be replicated in PHP?
"mjs" <no@[E  2008-08-07 12:58:52 
Re: Can this Perl solution be replicated in PHP?
"Murray *ACE*"   2008-08-07 13:45:06 
Re: Can this Perl solution be replicated in PHP?
"Murray *ACE*"   2008-08-07 13:46:02 
Re: Can this Perl solution be replicated in PHP?
Michael Fesser <netize  2008-08-07 21:59:16 
Re: Can this Perl solution be replicated in PHP?
"mjs" <no@[E  2008-08-07 16:27:16 
Re: Can this Perl solution be replicated in PHP?
Michael Fesser <netize  2008-08-07 22:43:36 
Re: Can this Perl solution be replicated in PHP?
"mjs" <no@[E  2008-08-07 16:59:10 
Re: Can this Perl solution be replicated in PHP?
"Murray *ACE*"   2008-08-07 17:32:29 
Re: Can this Perl solution be replicated in PHP?
"mjs" <no@[E  2008-08-07 19:16:43 
Re: Can this Perl solution be replicated in PHP?
"Murray *ACE*"   2008-08-07 20:40:55 
Re: Can this Perl solution be replicated in PHP?
"mjs" <no@[E  2008-08-07 21:50:21 
Re: Can this Perl solution be replicated in PHP?
"Murray *ACE*"   2008-08-08 07:19:58 
Re: Can this Perl solution be replicated in PHP?
"mjs" <no@[E  2008-08-07 16:26:38 
Re: Can this Perl solution be replicated in PHP?
"Murray *ACE*"   2008-08-07 17:16:34 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Thu Nov 20 5:03:33 CST 2008.