Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > Adobe Web Programming > Dreamweaver (all versions)
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Dreamweaver (all versions) section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 10th, 2004, 01:28 PM
Registered User
 
Join Date: Sep 2004
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default A challenging one....Can this be done?

Hi,

I have some 2200 html pages written in a variety of different layouts which I need to turn into a templated structure. Basically the site is full of content but the majority of pages only use a couple of library files. I can't put the content in a database as I would prefer (due to search engine visibility) nor can I rename files to PHP or ASP which is why I have turned to dreamweaver templates.

What would be the best way of going about this?

I figured when I got MX I would be able to simply apply the template to a page and migrate the template to the entire site keeping the content of the old pages intact. I can do that (1 page at a time which I want to avoid at all costs otherwise I will be on for a year) but is there a way to migrate the template file to the entire site while keeping the content of each page? Can this be done?

Any help much appreciated.


Steve Jackson is CEO of Aboavista, editor of The Conversion Chronicles and a published writer. You can get a free copy of his e-book sent to you upon subscription to the Conversion Chronicles web site.
http://www.conversionchronicles.com
Reply With Quote
  #2 (permalink)  
Old September 10th, 2004, 02:03 PM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi Steve,

I don't think this is possible, or is going to be easy. After all, what is "content" and what would you like to migrate to the new template?

There may be extensions for Dreamweaver that allow you to apply a template to multiple pages at once. You can search the DW Extensions site and see i they exist.

Still, you manually need to define / point to the content you want to embed in your new template. The old pages probably have the entire html structure in them, so you need to find a way to replace that with the code from the new template.

I have done something similar once in another site. I solved this problem by writing a little page parser in VB. This parser opened the old document, searched for some repeating stuff in the page (you could, for example, take the entire <body> tag) and then dumped that content in the Content region of a template. Once I had the entire code I needed in a string, I used the File System Object to write the new file to disk.

Depending on the size and complexity of your current site, this may save you a lot of time converting the pages by hand. But it all really depends on the current pages. If you have a lot of complex / nested tables, but still want to move specific page regions to certain template regions, you may have a hard time trying to break the page apart, looking for those sections.

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Reply With Quote
  #3 (permalink)  
Old September 10th, 2004, 03:22 PM
Registered User
 
Join Date: Sep 2004
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Imar,

The site content basically consists of two blocks...A headline and a number of paragraphs of body text. While the pages are all currently in a bit of a mess I think the majority of them have this feature running through them. Unfortunately the owner hasn't defined this as an editable section so my job is not easy.

I thought of writing a script to parse the page content, but haven't figured out how to do it and keep the page name (whatever.html) the same.

Is there any way to add libraries to pages automatically?
Thanks for the help.

Steve Jackson is CEO of Aboavista, editor of The Conversion Chronicles and a published writer. You can get a free copy of his e-book sent to you upon subscription to the Conversion Chronicles web site.
http://www.conversionchronicles.com
Reply With Quote
  #4 (permalink)  
Old September 10th, 2004, 03:36 PM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Dreamweaver templates and Library Items are actually just embedded HTML comments that have special meaning. So, theoretically, you could create a templated page in Notepad, by simply typing in the code that Dreamweaver adds for you when you create a new page based on a template.

What you could do is build an application (VB application, ASP page, something .NET, whatever, as long as it can read and write plain text files) that reads the files, retrieves the content from that page and creates a new page on the fly. You could add templates and Library Items to that page, simply by adding some additional text to the text string that holds your file.
You could do something like this:
Code:
Dim myPageString
Dim myNewMenuString
Dim myNewPageString

'Pseudo code:
myPageString = RetrieveContentFromOldFile()
myNewMenuString = "LongStringThatDefinesTheMenuHTML"

myNewPageString = "<html> etc etc including template stuff"

myNewPageString = myNewPageString & ""
myNewPageString = myNewPageString & myNewMenuString 
myNewPageString = myNewPageString & ""
This way, you build up a string that holds a mix of HTML, template comments, code for your new menus and other non editable regions from your new template and the stuff you have read from your old page.

So, you could take it completely outside Dreamweaver, and outside your current site, into a custom application. Once all the files have been generated you can copy them back to your site and then use Dreamweaver to maintain the site.

Does that make any sense?

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Reply With Quote
  #5 (permalink)  
Old September 10th, 2004, 03:52 PM
Registered User
 
Join Date: Sep 2004
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Does that make any sense?


Yes. This is the kind of thing I was thinking of doing using PHP, but if I do so, how do I capture the name of the html file and the specific text within the html file that I need? That is the puzzler for me, I'm a layman programmer, not an expert.

What I guess I'm asking is, doesn't dreamweaver have any kind of functionality which does this? given that you can write library objects and parse them site wide. I thought this was one of the things that MX could do? or have I wasted my dollars?

Steve Jackson is CEO of Aboavista, editor of The Conversion Chronicles and a published writer. You can get a free copy of his e-book sent to you upon subscription to the Conversion Chronicles web site.
http://www.conversionchronicles.com
Reply With Quote
  #6 (permalink)  
Old September 10th, 2004, 04:17 PM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

If you write some code that recursively searches the path of your site, you can retrieve the name and location of each file, and use that to create the new file.

In ASP you could do something like this:

For Each File in MyFolder
  MyFileName = MyFile.Name
Next

Then you can use MyFileName as the name of your new file.

I am not too fluent in PHP, but I am sure you can create the same recursive code that retrieves each and every file in your site.

Using regular expressions, or simple string parsing (e.g. in ASP / VB you could use Instr to determine the location of, say, the starting <body> tag) you can find the content in your string that you need.

Dreamweaver cannot do what you're asking here. It can apply templates on a single page only, and perform updates on multiple pages that use your template.

The idea about Library Items and Templates is that Dreamweaver knows how to handle them after it has created them. So Dreamweaver relies on the additional code / comment tags that it has added. Remove those comments from en external application, and you render the functionality useless. The same applies the other way around: if you haven't added Template stuff or Library Items to a page, that page is beyond control of Dreamweaver's update features.

So, to make this work, you'll need to apply the template to all those pages. From what I can see, you have three options:

1. Manually
2. Use a (commercial) DW extension that deals with multiple pages
3. Write your own parser that generates the pages for you.

Other than this, I don;t think there are many options.....

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: I Am The Highway by Audioslave (Track 8 from the album: Audioslave) What's This?
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Challenging Query Jonas Access 3 July 25th, 2007 02:01 PM
Challenging questions... rguru VB.NET 2002/2003 Basics 2 May 21st, 2004 01:40 PM
Challenging questions... rguru VBScript 0 May 16th, 2004 06:36 AM
Challenging questions... rguru Beginning VB 6 0 May 16th, 2004 06:35 AM



All times are GMT -4. The time now is 10:26 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.