Freeway's publishing order

Hello all,
I’ve an Action that I’m working on that inserts markup items into the page at any or all of the standard entry points (before , after etc). This works well in isolation but coupled with Freeway’s own markup it starts to get a little confusing.

Essentially the problem I’m encountering is that code added through the Action will stick as close to the target tag ( for example) as possible and give me a page where the markup order is;

  1. Freeway’s own markup
  2. The Action’s markup

where the code is placed BEFORE tags (before , before etc)

BUT…

reversed when placed AFTER tags (after , after etc)

  1. The Action’s markup
  2. Freeway’s own markup

What I’m looking for is a way to consistently add the code either before of after Freeway’s own code. I can see why Freeway is doing what it is doing (it is doing what I’ve asked of it) but in terms of working with this it makes adding markup in both freeway and through an Action quite hit and miss as you have to stop and think about which code block will get placed first in the code.

If anyone has any sage advice, or pain killers, please let me know.
Thanks!
Tim.

FreewayActions.com - Freeware and commercial Actions for Freeway Express & Pro - http://www.freewayactions.com
FreewayStyle.com - Free Freeway templates and parts to download, use and explore - http://www.freewaystyle.com


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

I have never really understood the thinking behind freeway’s publishing cycle coupled with code placement it can be really odd for third party actions need to place code in specific areas… It seems fine when I am just squirting in bits of code, but when it come to actual code placement then I personally find it a hideous method. Especially when I have to use the ‘move’ and ‘dummy’ tags… It just seems really awkward to me.

Coming back to your question I have never seen a particular good method, but I did remember and subsequently found, Weaver having a different approach to pacing things after a tag. It may be of some use… here is what he wrote:


Weaver
Unless I am remembering this wrong…

See pages 44-46 of the Action JSrefScreen.pdf about the methods (fwAddJavascript, fwAddRaw[Ln,Opt]). The thing to note, though not completely explained, is the argument ‘after’ or ‘after tag’.

The reference to your div, myDiv in the previous examples, may be used again as an effective pointer to the ‘beginning’ of itself.

Example:

 var myDiv = fwDocument.fwTags.fwFind(fwItem,'div');
 //so we have a reference to our div to which we want to add the JS
 
 myDiv.fwAddRaw('string to add', myDiv);
 //______________________________^^^^^ new AFTER argument

This last reference, since it is used in a method on itself effectively links to the opening tag of the ‘div’.

So the output would normally be:

 <div>
     {{other content}}
     CONTENT ADDED VIA FWADDRAW AS LAST ITEM
 </div>

The trick adding ‘myDiv’ as an argument in the fwAddRAw method inserts the content as follows:

 <div>
     CONTENT ADDED VIA FWADDRAW JUST AFTER OPENING TAG
     {{other content}}
 </div>

P.S. This only works when myDiv is both the parent object and the ‘after’ reference, else, the item added would be inserted after the entire myDiv tag:

 myParentDiv.fwAddRaw('text',myDiv);

would result in:

 <div> {myParentDiv}
     <div> {myDiv}
         {other content}
     </div>
     Inserted text with fwAddRaw
 </div>

PS what happened to weaver I haven’t seen him on the forum for some time… Come back Weaver all is forgiven… :o)


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options