Creating DW Template to output two different versions of an html file

Hello,

I need to know if it is possible to use DW Templates to output two different versions of an HTML page from one single template interface. Basically, I need to publish content to two separate directories. One file would be a complete version with all of the content that was entered into the template (so, an entire valid HTML document). The other file, would essentially be a "stripped down" version of the complete one. The stripped version would contain basically the page's title (identified by <div id="pagetitle">) and what would be considered the "meat" of the page (everything inside <div id="maincontent">). Everything else, all the regular stuff that makes an HTML page (i.e. <html>, <head>, <body>, etc.) would be stripped. If this is possible, I would also like to know if it is something that can be user-defined. Meaning, would there be a way for the page creator to indicate whether or not a stripped version should be created?

I hope this is enough information, please let me know if there is anything else I can add.

Thank you
LVL 1
austerhausAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jason C. LevineDon't talk to me.Commented:
Hi austerhaus,

Are you trying to create a print-friendly page?

If so, you can't really do it as you describe above.  DW templates are attached to the page.  If you want to have two separate pages and attach them to two separate templates, you can do that (more work for you, though).

The far easier thing to do is to use CSS to show/hide your page elements based on the display device (screen, print, handheld).

If you want a sample, I can post one.  If I'm not reading your intention correctly, please elaborate.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
austerhausAuthor Commented:
To clarify, the stripped version is going to be used by another group that takes the contents of the file and uses server side code to wrap it in a different "frame". Not to mean an HTML frame. They basically take my raw content slap some pretty stuff around it (menus, links, other content, etc.) and send it off to the browser. CSS was discussed as a possible solution though there were concerns regarding bandwidth and response times. We basically want to send them the smallest, most relevant file possible without the manual labor of having to really manage two unique files.
Jason C. LevineDon't talk to me.Commented:
Well, as far as response time and bandwidth goes, I don't believe templates are any better than CSS for you since templates will result in two different versions of your content file.

I guess the other thing you could do is just use plain old server-side includes to call the content into the two different documents.  
OWASP: Avoiding Hacker Tricks

Learn to build secure applications from the mindset of the hacker and avoid being exploited.

Vinay RajputSr. UI LeadCommented:
See,
whatever you are developing, only HTML is delivered to client,

if you are developing a static website then you have do necessary changes to your relevant pages

or you could code your pages via help of Javascript,

or use any server side script such ASP, PHP etc.. to fullill your requirement,

in short, Dreamweaver does not have any feature to develop HTML to handle this situation,
ThinkPaperIT ConsultantCommented:
Dreamweaver doesn't really have a method to do this. The only way I can think of getting something like this is using some kind of serverside code/javascript, which would require you knowing a bit of programming

So for ASP say you have your infopage.asp which basically consists of

<html>
<body>
<% If Request("plain") = "" Then %>
   <!--#include file ="include_files/topstuff.asp"-->
<% End If %>

Here is all my funky data!!

<% If Request("plain") = "" Then %>
   <!--#include file ="include_files/bottomstuff.asp"-->
<% End If %>
</body>
</html>

you can also use:
<script language="Javascript" src="include_files/bottomstuff.js"></script>
in place of the include files, but that would require ur HTML be printed using document.write

So if you want your infopage, you just call: infopage.asp
If you want the stripped page, you call: infopage.asp?plain=yes

topstuff.asp would contain your extra html stuffs for graphics and menus or whatever and bottomstuff.asp would contain the closing portion of it.

So at least this way, you don't have 2 versions of the same file and you can use topstuff and bottomstuff for all your pages and change they way it looks by using one page.
radnorCommented:
you could use PHP....

<!-- InstanceBeginEditable name="EditRegion3" -->

<?php


//
//      This is looking for 1 parameter and it supplies the
//  name of a file to display on the site.  
//

 $txtfile = 'php/files/' . $_REQUEST[Id] . '.txt';
      
if ($txtfile <> "null") {
      $Open = fopen ($txtfile, "r");
      if ($Open) {
            $data = file ($txtfile);
            for ($n = 0; $n < count($data); $n++) {
                  $GetLine = explode("\t",$data[$n]);
                  print ("$GetLine[0]<br>");
            }

            while ($n++ < 15) {
                  print ("<br>");
            }
            fclose ($Open);
      } else {
      print ("Error opening event file.");
      }
}

?>


    <!-- InstanceEndEditable -->


Oh, is that an editable region?  Why, yes it is.....  I CURRENTLY use this for a site.  Initally wanted to let the client update pages.  But they found it easier to let me do it....  The file is just a TEXT file created with NOTEPAD!!!  To use it:  http://www.abc.com/index.php?Id=home   My page is called INDEX.PHP and CONTENT is:HOME.TXT

Hope this helps!!!

Jason C. LevineDon't talk to me.Commented:
Radnor,

How does that code help austerhaus write to two different files from one template from within DW?

radnorCommented:
Well....  He has ONE page (a template) for his site.    The URL reads in the BODY for the world to see.  Whoever need the "BODY" for their page has the SAME text file to work with.  Austerhaus said "they" will.....

To clarify, the stripped version is going to be used by another group that takes the contents of the file and uses server side code to wrap it in a different "frame"

So he will be creating the "body content" one time for BOTH sites to use....
Jason C. LevineDon't talk to me.Commented:
Ah, okay.  

I didn't see where you were going with that initally.  

austerhaus,

No matter which solution you go with, it sounds like the page content is going to be called as an include on the server side.  Because DW templates are not server parsed, there is no good way to develop one locally that "writes" two different files upon being put to the remote server.  

You can fake it, somewhat, using a server side script that writes the content to a new file when it is accessed, but is more work than necessary.  Keep the content in separate files or in a SQL table and call the includes any way you like.
austerhausAuthor Commented:
Thanks for the assistance. I awarded the points for jason1178 since he really answered the initial question. But thanks again for the responses.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Dreamweaver

From novice to tech pro — start learning today.