?
Solved

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

Posted on 2006-04-12
10
Medium Priority
?
188 Views
Last Modified: 2010-04-25
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
0
Comment
Question by:austerhaus
  • 4
  • 2
  • 2
  • +2
10 Comments
 
LVL 70

Accepted Solution

by:
Jason C. Levine earned 800 total points
ID: 16441010
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.
0
 
LVL 1

Author Comment

by:austerhaus
ID: 16441311
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.
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 16441363
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.  
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 5

Expert Comment

by:vinkrins
ID: 16443953
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,
0
 
LVL 16

Expert Comment

by:ThinkPaper
ID: 16446838
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.
0
 
LVL 8

Expert Comment

by:radnor
ID: 16447618
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!!!

0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 16448931
Radnor,

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

0
 
LVL 8

Expert Comment

by:radnor
ID: 16450179
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....
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 16450237
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.
0
 
LVL 1

Author Comment

by:austerhaus
ID: 16481942
Thanks for the assistance. I awarded the points for jason1178 since he really answered the initial question. But thanks again for the responses.
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For those who don't know, Adobe Dreamweaver is a popular commercial web editor that enables you to design, build and manage complex websites. The editor is a WYSIWYG (What You See Is What You Get) web editor, which means that you can create your web…
This article is very specific and is only intended to help if you are installing Dreamweaver 8 in a Windows 7 environment with Office 2007 installed.   I'm not sure why Microsoft tends to release OS' that should not be released but they do.  Windows…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses
Course of the Month16 days, 23 hours left to enroll

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question