Ask a Question related to Macromedia Exchange Dreamweaver Extensions, Design and Development.
-
neo314 #1
Detecting if a template is applied in extension writing
Hello,
I have been working on an extension which inserts code into my page at the
selection point, but also inserts a link to an external javascript file. The
glitch comes with a template page. The javascript link gets inserted into an
"uneditable region" Anyone have any tips on detecting if the document has a
template applied and then inserting the link into the editable region of the
head.
neo314 Guest
-
Extension template/skeleton
Hi Does anyone/adobe have an extension template/skeleton to get newbies started with? Best practice file management with useful things like... -
Writing an extension
Dear Friends, I want to write an extension for Adobe Dreamweaver CS3 and also add an autocompletion-feature. Is there a good tutorial for... -
Writing a Dreamweaver Extension, where to start?
Hello, I want to learn how to write a dreamweaver CS4 extension, but the only material I can seem to find that provides step by step instructions... -
perl template tool kit extension development
Greetings, I would like to develop an extension to dreamweaver to allow DW to visually display the perl Template Toolkit .wld files. For those... -
[PHP-DEV] When can I expect changes to be applied
Hello, I requested some time ago that zend_parse_parameters() be altered to accept "Z" as a parameter type in order to be able to retrieve... -
Massimo Foti #2
Re: Detecting if a template is applied in extension writing
"neo314" <webforumsuser@macromedia.com> wrote in message
news:fg0cs9$dic$1@forums.macromedia.com...getAttachedTemplate() should work> Anyone have any tips on detecting if the document has a
> template applied
--
----------------------------
Massimo Foti, web-programmer for hire
Tools for ColdFusion and Dreamweaver developers:
[url]http://www.massimocorner.com[/url]
----------------------------
Massimo Foti Guest
-
neo314 #3
Re: Detecting if a template is applied in extensionwriting
Assuming that returns null or false if there is no template applied, my main
concern is finding the editable space within the head and inserting there
instead of at the end of the head tag.
I have not seen the equivalent of getEditableHead(). I do see how to get a
list of editable regions. Does one determine if there is a template; retrieve
the editable regions; and search the source of the head tag for each region to
find which is inside the head tag, or is there a better way? That method seems
cumbersome.
neo314 Guest
-
Massimo Foti #4
Re: Detecting if a template is applied in extension writing
"neo314" <webforumsuser@macromedia.com> wrote in message
news:fg1lfi$3e8$1@forums.macromedia.com...As far as I remember it should return an empty string in that case. But I> Assuming that returns null or false if there is no template applied
may be wrong, you better check by yourself
I didn't answered to this because I don't have a good solution to the> my main
> concern is finding the editable space within the head and inserting there
> instead of at the end of the head tag.
problem... Sorry
--
----------------------------
Massimo Foti, web-programmer for hire
Tools for ColdFusion and Dreamweaver developers:
[url]http://www.massimocorner.com[/url]
----------------------------
Massimo Foti Guest
-
E Michael Brandt #5
Re: Detecting if a template is applied in extension writing
dw.getDocumentDOM().getEditableRegionList()
Then loop thru that array looking at each for a headregion's comment.
--
E. Michael Brandt
[url]www.divaHTML.com[/url]
divaPOP : standards-compliant popup windows
divaGPS : you-are-here menu highlighting
divaFAQ : FAQ pages with pizazz
[url]www.valleywebdesigns.com/vwd_Vdw.asp[/url]
JustSo PictureWindow
JustSo PhotoAlbum, et alia
--
E Michael Brandt Guest
-
-
neo314 #7
Re: Detecting if a template is applied in extensionwriting
Thanx for that tid bit. I'd like to ask for a little more help.
I was really hoping for a method that determines if any given element is in an
editable region.
I can now detect if a template is applied. If one is applied, I can find the
editable region of the head instead of just inserting at the end of the head
tag.
Now I have a list of all the textareas on the page. Any good ideas for the
best way to test whether each one is in an editable region so I can exclude the
textareas that are not in an editable region.
This is probably not an issue for this project since textareas will rarely be
in a non-editable region, but I'm trying to figure out how to deal with
templates.
My only thought at this point is get the list of editable regions, get the
offsets of each region, and see if the offsets of each textarea are withing an
editable region. This seems to require two or more loops.
Is that the best solution?
neo314 Guest
-
E Michael Brandt #8
Re: Detecting if a template is applied in extension writing
I typically do something like this in the opposite direction - I loop
through the array of editable regions looking for whatever features I am
interested in finding.
--
E. Michael Brandt
[url]www.divaHTML.com[/url]
divaPOP : standards-compliant popup windows
divaGPS : you-are-here menu highlighting
divaFAQ : FAQ pages with pizazz
[url]www.valleywebdesigns.com/vwd_Vdw.asp[/url]
JustSo PictureWindow
JustSo PhotoAlbum, et alia
--
E Michael Brandt Guest
-
neo314 #9
Re: Detecting if a template is applied in extensionwriting
In other words, do what I have done if no template is applied, and if one is applied, loop through the editable regions looking for textareas...
That makes sense.
neo314 Guest
-
neo314 #10
Re: Detecting if a template is applied in extensionwriting
As a follow-up to this, I thought I would share what I did...
I first check for a template. If not insert into the head tag.
If there is a template,
loop through editable regions checking whether they are in the head.
for each in the head,
if one is named 'head' use that one;
Otherwise use the second editable region (the first is usually the
title);
Otherwise, if only one editable region use that one.
If no editable region, return an error.
neo314 Guest
-
E Michael Brandt #11
Re: Detecting if a template is applied in extension writing
I have found it best not to use the "title" region to insert your code,
rather check for the "head" region, and if not found, either create it
or return an error. Using the title region makes for headaches down the
line.
--
E. Michael Brandt
[url]www.divaHTML.com[/url]
divaPOP : standards-compliant popup windows
divaGPS : you-are-here menu highlighting
divaFAQ : FAQ pages with pizazz
[url]www.valleywebdesigns.com/vwd_Vdw.asp[/url]
JustSo PictureWindow
JustSo PhotoAlbum, et alia
--
E Michael Brandt Guest
-
neo314 #12
Re: Detecting if a template is applied in extensionwriting
I'm not using the title region unless it is the only editable region.
neo314 Guest
-
E Michael Brandt #13
Re: Detecting if a template is applied in extension writing
neo314 wrote:
yep, that's what I am saying. It is best NOT to do that. It can cause> I'm not using the title region unless it is the only editable region.
difficulties when the page interacts with other behaviors, and
especially causes trouble when the page is edited later in DWMX+ (the
pages with title regions only were created in DW4.)
So, if it is a DW4-originated page, abort with an alert explaining why.
--
E. Michael Brandt
[url]www.divaHTML.com[/url]
divaPOP : standards-compliant popup windows
divaGPS : you-are-here menu highlighting
divaFAQ : FAQ pages with pizazz
[url]www.valleywebdesigns.com/vwd_Vdw.asp[/url]
JustSo PictureWindow
JustSo PhotoAlbum, et alia
--
E Michael Brandt Guest
-
Joris van Lier #14
Re: Detecting if a template is applied in extension writing
"E Michael Brandt" <michael@valleywebdesigns.com> wrote in message
news:fhltu9$ifs$2@forums.macromedia.com...Yes I can confirm that I just got a template with meta tags in the docTitle> neo314 wrote:>>> I'm not using the title region unless it is the only editable region.
> yep, that's what I am saying. It is best NOT to do that. It can cause
> difficulties when the page interacts with other behaviors, and especially
> causes trouble when the page is edited later in DWMX+ (the pages with
> title regions only were created in DW4.)
>
> So, if it is a DW4-originated page, abort with an alert explaining why.
region and that these aren't propagating to childpages.
So when there's no editable region in the head, what should we do then?
Edit the parent template to add a region or have the user deceide from the
"Changes to locked region" dialog?
--
Joris van Lier
Joris van Lier Guest
-
neo314 #15
Re: Detecting if a template is applied in extensionwriting
Ok, I understand. I'm glad I posted the follow-up.
I wasn't including the title/docTitle region so much as choosing head first,
and the second editable region first and the only editable region last.
I have not considered having the user create a new editable region or change
the template. My plan is/was to return an error if there is no place to add the
javascript in the head.
To that end. I can drop the use second and if not use the only available
routine. Instead I can just exclude title and docTitle regions. Use head first
and any other available region if none are named head having excluded the title
region. Return an error otherwise.
I'm open to a better solution however. Thanks for the feedback.
Steven
neo314 Guest
-
E Michael Brandt #16
Re: Detecting if a template is applied in extension writing
My anwser, as I said before, is never to use anything but the "head">
> I'm open to a better solution however. Thanks for the feedback.
editable region. This is what I tell my Extension users: the first FAQ
on this page:
[url]http://valleywebdesigns.com/vwd_jspA3/vwd_jspA3_faq.asp[/url]
--
E. Michael Brandt
[url]www.divaHTML.com[/url]
divaPOP : standards-compliant popup windows
divaGPS : you-are-here menu highlighting
divaFAQ : FAQ pages with pizazz
[url]www.valleywebdesigns.com/vwd_Vdw.asp[/url]
JustSo PictureWindow
JustSo PhotoAlbum, et alia
--
E Michael Brandt Guest
-
E Michael Brandt #17
Re: Detecting if a template is applied in extension writing
hmm. well you would not expect them to. Nothing in any editable region> Yes I can confirm that I just got a template with meta tags in the
> docTitle region and that these aren't propagating to childpages.
would propagate to child pages. Being editable menas they are unique to
that page.
See the first FAQ on this page to see what I tell my Extension users:> So when there's no editable region in the head, what should we do then?
> Edit the parent template to add a region or have the user deceide from
> the "Changes to locked region" dialog?
[url]http://valleywebdesigns.com/vwd_jspA3/vwd_jspA3_faq.asp[/url]
E. Michael Brandt
[url]www.divaHTML.com[/url]
divaPOP : standards-compliant popup windows
divaGPS : you-are-here menu highlighting
divaFAQ : FAQ pages with pizazz
[url]www.valleywebdesigns.com/vwd_Vdw.asp[/url]
JustSo PictureWindow
JustSo PhotoAlbum, et alia
--
E Michael Brandt Guest



Reply With Quote

