ActionsDev

23 replies to this thread. Most Recent

waltd

20 May 2014, 1:20 pm

Useful function to get complete URL of current page

Walter

Freeway user since 1997

http://www.walterdavisstudio.com

Tim Plumb

20 May 2014, 1:57 pm

Hi Walter, Clever stuff. Unfortunately this highlights the need for some good documentation as you can already do this with fwPage.fwWebAddress() rather than building the path from the site root yourself. I believe you can use any site level item here so document, folder or page should all work. Regards, Tim.

On 20 May 2014, at 14:20, Walter Lee Davis wrote:

Tim Plumb - Experienced Freeway designer for hire

FreewayActions.com - Freeware and commercial Actions for Freeway Express & Pro

FreewayStyle.com - Free Freeway templates and parts to download, use and explore

waltd

20 May 2014, 2:43 pm

Damn! Here, I thought I was being clever because I rewrote something I found in the Blogger Action.

Walter

On May 20, 2014, at 9:57 AM, Tim Plumb wrote:

Hi Walter, Clever stuff. Unfortunately this highlights the need for some good documentation as you can already do this with fwPage.fwWebAddress() rather than building the path from the site root yourself. I believe you can use any site level item here so document, folder or page should all work. Regards, Tim.

On 20 May 2014, at 14:20, Walter Lee Davis wrote:

Freeway user since 1997

http://www.walterdavisstudio.com

Joe Billings

20 May 2014, 2:52 pm

On 20 May 2014, at 15:43, Walter Lee Davis <[email protected]> wrote:

Damn! Here, I thought I was being clever because I rewrote something I found in the Blogger Action.

:-)

Joe Billings

Freeway & Exhibeo: Visual web design apps for Mac


http://www.softpress.com

waltd

20 May 2014, 3:09 pm

While you all are busy smirking at me, any hope of understanding what it would take to unpack JSON in an Action? I’ve tried eval, and I keep getting an “invalid label” error. The test string I am unpacking is this:

{"url":"http://www.wdstudio.com/test/deeper/index.html","controller":"pages","action":"inspect","format":"json"} 

Are there any magic words in there that an Action’s eval method would choke on explicitly? The really odd thing is that when I put that string in the Action, I do get an object back. But when I insert it as the return of a method, I get the error.

Walter

On May 20, 2014, at 10:52 AM, Joe Billings wrote:

On 20 May 2014, at 15:43, Walter Lee Davis <[email protected]> wrote:

Damn! Here, I thought I was being clever because I rewrote something I found in the Blogger Action.

:-)

Freeway user since 1997

http://www.walterdavisstudio.com

Joe Billings

20 May 2014, 3:33 pm

I’ve used this before:

function parseJSON(data)
{
    if(!data)
        return;
    return !(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(data.replace(/"(\\.|[^"\\])*"/g, ""))) && eval("(" + data + ")"); //"
}

Source: http://www.json.org/draft-crockford-jsonorg-json-04.txt

On 20 May 2014, at 16:09, Walter Lee Davis <[email protected]> wrote:

While you all are busy smirking at me, any hope of understanding what it would take to unpack JSON in an Action? I’ve tried eval, and I keep getting an “invalid label” error. The test string I am unpacking is this:

{“url”:”http://www.wdstudio.com/test/deeper/index.html”,”controller”:”pages”,”action”:”inspect”,”format”:”json”}

Are there any magic words in there that an Action’s eval method would choke on explicitly? The really odd thing is that when I put that string in the Action, I do get an object back. But when I insert it as the return of a method, I get the error.

Walter

On May 20, 2014, at 10:52 AM, Joe Billings wrote:

On 20 May 2014, at 15:43, Walter Lee Davis <[email protected]> wrote:

Damn! Here, I thought I was being clever because I rewrote something I found in the Blogger Action.

:-)

Joe Billings

Freeway & Exhibeo: Visual web design apps for Mac


http://www.softpress.com

waltd

20 May 2014, 3:40 pm

Wow. That is making my head spin. But it does work.

Thanks very much,

Walter

On May 20, 2014, at 11:32 AM, Joe Billings wrote:

I’ve used this before:

function parseJSON(data)
{
  if(!data)
      return;
  return !(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(data.replace(/"(\\.|[^"\\])*"/g, ""))) && eval("(" + data + ")"); //"
}

Source: http://www.json.org/draft-crockford-jsonorg-json-04.txt

On 20 May 2014, at 16:09, Walter Lee Davis <[email protected]> wrote:

While you all are busy smirking at me, any hope of understanding what it would take to unpack JSON in an Action? I’ve tried eval, and I keep getting an “invalid label” error. The test string I am unpacking is this:

{“url”:”http://www.wdstudio.com/test/deeper/index.html”,”controller”:”pages”,”action”:”inspect”,”format”:”json”}

Are there any magic words in there that an Action’s eval method would choke on explicitly? The really odd thing is that when I put that string in the Action, I do get an object back. But when I insert it as the return of a method, I get the error.

Walter

On May 20, 2014, at 10:52 AM, Joe Billings wrote:

On 20 May 2014, at 15:43, Walter Lee Davis <[email protected]> wrote:

Damn! Here, I thought I was being clever because I rewrote something I found in the Blogger Action.

:-)

Freeway user since 1997

http://www.walterdavisstudio.com

Joe Billings

22 May 2014, 10:33 am

Just in case you have a need for this: you can go the other way (Object to String) using Object.toSource()

Joe

Joe Billings

Freeway & Exhibeo: Visual web design apps for Mac


http://www.softpress.com

JDW

26 Jan 2017, 2:49 am

I discovered this thread while searching for ways to hack the SiteMapper action to enable HTTPS links instead of the default HTTP. Inside the SiteMapper action, I see the following code:

outputcode += "tt<loc>" + myPage.fwWebAddress() + "</loc>r";

The resulting XML file generates “http://” links within the “” tags. I want to change it to “https://” but how do I accomplish that?

Thanks,

James Wages

P.S. I’ll be honest. I detest the SiteMapper action because it perpetually dirties all the pages in my site. But to not use it would mean a lot of many labor for me in that I’d need to use an online tool to generate the sitemap AND THEN I would need to upload it to my site and then ping search engines as to its location. The SiteMapper action does all that for me.

Tim Plumb

26 Jan 2017, 9:35 am

Hi James, Change the Web Address setting in File > Document Setup to https and you should find that all of your links in the site map get updated. Regards, Tim.

On 26 Jan 2017, at 02:49, JDW <[email protected]> wrote:

The resulting XML file generates “http://” links within the “” tags. I want to change it to “https://” but how do I accomplish that?

Tim Plumb - Experienced Freeway designer for hire

FreewayActions.com - Freeware and commercial Actions for Freeway Express & Pro

FreewayStyle.com - Free Freeway templates and parts to download, use and explore

JDW

26 Jan 2017, 9:43 am

File > Document Setup > Upload > Web Address

Perfect! Thank you for the hand-holding, Tim!

James W.

Tim Plumb

26 Jan 2017, 10:18 am

No problem James. The fwWebAddress() function simply pulls the value from this field so whatever you add will be used in the Action.

This is one of those Actions that has always had issues with pages getting dirtied (published) out of place. Make sure you are using the latest version of the Action (I’m looking at version 1.5.3 in Freeway 7.1.3) as I seem to recall we added the Site Mapper File Location Action to try and overcome some of these issues. That Action is set to always publish the page as it needs to trawl through the site and force the other sitemapper pages to update their content.

It’s been a long while since I’ve last looked at this Action but you could try editing it to remove the fwIsDirty() function (line 541) which should stop the Action from dirtying the rest of the site each time the sitemap needs updating.

function fwIsDirty()
{
    return true;
}

To prevent publishing a partial sitemap (which is what will happen if this is disabled) I’d suggest holding down the control key when you select File > Publish which will change the menu to Publish Everything and should force Freeway to rebuild the site with a complete XML sitemap. Regards, Tim.

On 26 Jan 2017, at 09:43, JDW <[email protected]> wrote:

Perfect! Thank you for the hand-holding, Tim!

Tim Plumb - Experienced Freeway designer for hire

FreewayActions.com - Freeware and commercial Actions for Freeway Express & Pro

FreewayStyle.com - Free Freeway templates and parts to download, use and explore

JDW

26 Jan 2017, 11:58 pm

Tim,

I too am using Site Mapper 1.5.3 on Freeway Pro 7.1.3 along with the Site Mapper Location action 1.0. I have the Site Mapper 1.5.3 action applied to the folder containing all my web pages and “Change frequency” is set to “Weekly” but still I get dirtied pages about every 24 hours. And when they happens I must Publish the site twice before all pages stop dirtying themselves. I consider that strange. You’d think that the first Publish would do it, but it doesn’t. If I Publish all pages and then go to Upload, it builds the pages again before uploading. But usually after that I am good until the next day. I’ve been using this Action for ages, and I use Freeway often, so this is a painful part of my daily routine.

Because of the page dirtying problem, I’ve long wanted to ditch the action entirely, but I want site maps and using this action is the easiest way to not only get the Site Map built automatically but ping the search engines automatically too. Nothing else I’ve seen online (third party site mappers) does all that.

Thank you for the code-change suggestion. If I delete those 4 lines, you are telling me that the Action won’t dirty the entire site anymore (bringing great joy to my soul), but you are also telling me that if the Action needs to update itself, it would create a partial Site Map (which is bad). Since there is no way for me to confirm WHEN the Action thinks it needs to update itself (again, my “Weekly” setting doesn’t seem to be working since my site dirties itself every 24 hours), the Action might in fact try to update daily, and in that case I would have a partial (defective) site map most of the time, at least until I manually dirty the entire site with Publish Everything. What are your thoughts on this?

Many thanks,

James W.

JDW

30 Jan 2017, 1:08 am

Tim,

I probably typed too my info in my previous post for you to spot my QUESTION, so here it is again…

If I delete those 4 lines, you are telling me that the Action won’t dirty the entire site anymore (bringing great joy to my soul), but you are also telling me that if the Action needs to update itself, it would create a partial Site Map (which is bad). Since there is no way for me to confirm WHEN the Action thinks it needs to update itself (again, my “Weekly” setting doesn’t seem to be working since my site dirties itself every 24 hours), the Action might in fact try to update daily, and in that case I would have a partial (defective) site map most of the time, at least until I manually dirty the entire site with Publish Everything. What are your thoughts on this?

Tim Plumb

30 Jan 2017, 9:16 am

Hi James, The setting in the action doesn’t set the frequency the Action crawls the site looking for data but the suggested frequency that search engines return and trawl the site. If you set this to a week then you are giving these bots the indication that they can find new content on a weekly basis. A news site, on the other hand, will have updates on a daily basis.

If the constant publishing issues are annoying you then try the suggestion I made in my email and see if it works for you. If it doesn’t then simply revert back to your existing workflow. Regards, Tim.

On 30 Jan 2017, at 01:08, JDW <[email protected]> wrote:

If I delete those 4 lines, you are telling me that the Action won’t dirty the entire site anymore (bringing great joy to my soul), but you are also telling me that if the Action needs to update itself, it would create a partial Site Map (which is bad). Since there is no way for me to confirm WHEN the Action thinks it needs to update itself (again, my “Weekly” setting doesn’t seem to be working since my site dirties itself every 24 hours), the Action might in fact try to update daily, and in that case I would have a partial (defective) site map most of the time, at least until I manually dirty the entire site with Publish Everything. What are your thoughts on this?

Tim Plumb - Experienced Freeway designer for hire

FreewayActions.com - Freeware and commercial Actions for Freeway Express & Pro

FreewayStyle.com - Free Freeway templates and parts to download, use and explore

JDW

30 Jan 2017, 9:22 am

Hi Tim,

If I delete the following code from the Site Mapper action, and then edit a couple pages in my site and upload, a “partial” site map will be created, right? And in that case, I would need to Publish Everything to force the Site Mapper action to then act as if the following 4 lines were still there, right? So, if I need to Publish Everything each time I upload in order to avoid uploaded “partial” (incomplete) site maps, how would that be an advantage over just leaving things the way they are now?

function fwIsDirty()
{
    return true;
}

Tim Plumb

30 Jan 2017, 9:47 am

Did you try it James? If you try it and it works for you then great. If you don’t try it then that is also great. I’m just putting a suggestion to you here.

On 30 Jan 2017, at 09:22, JDW <[email protected]> wrote:

If I delete the following code from the Site Mapper action, and then edit a couple pages in my site and upload, a “partial” site map will be created, right? And in that case, I would need to Publish Everything to force the Site Mapper action to then act as if the following 4 lines were still there, right? So, if I need to Publish Everything each time I upload in order to avoid uploaded “partial” (incomplete) site maps, how would that be an advantage over just leaving things the way they are now?

Tim Plumb - Experienced Freeway designer for hire

FreewayActions.com - Freeware and commercial Actions for Freeway Express & Pro

FreewayStyle.com - Free Freeway templates and parts to download, use and explore

JDW

31 Jan 2017, 12:39 am

Tim,

I did precisely as you suggested. I used dual-slashes to comment-out those 4 lines inside Freeway Pro.app/Contents/Shared Support/Actions/ FAST/SiteMapper.fwaction, as follows:

// Commented-out the next 4 lines as per Tim Plumb 1/30/2017 to prevent page dirtying:
// function fwIsDirty()
// {
//  return true;
// }

I did that using TextWrangler and saved. I then used File Buddy to delete the “TYPE” (but leaving CREATOR intact), so as to restore the icon.

I then relaunched Freeway.

I opened each of my sites and did a File/Publish. All pages were dirtied and rebuilt. I thought that happened because I just edited the Site Mapper action, however, I then did another File/Publish and all pages got dirtied and rebuilt again, so that means things have not changed. I tried File/Publish a third time, and nothing got dirtied or published, which is normal (even before I commented out those 4 lines).

I then looked in my Site Folder and I see “sitemap.xml” with a modification time stamp showing the same time I published the site. Looking inside, I see today’s date applied.

So it seems that commenting-out those 4 lines has no effect whatsoever. Should I notice something different?

Thanks,

James

JDW

1 Feb 2017, 6:45 am

Tim,

Should I interpret your lack of reply to my previous post as “put the action code back the way it was before”?

:-)

—James W.

JDW

2 Feb 2017, 7:03 am

Tim…?

JDW

15 Feb 2017, 5:22 am

Tim,

Now that SoftPress2 is back, it’s perhaps worth your time to reply to me. :-)

Here it is again…

I commented-out the 4 lines inside Freeway Pro.app/Contents/Shared Support/Actions/ FAST/SiteMapper.fwaction, as follows:

// Commented-out the next 4 lines as per Tim Plumb 1/30/2017 to prevent page dirtying:
// function fwIsDirty()
// {
//  return true;
// }

I did that using TextWrangler and saved. I then used File Buddy to delete the “TYPE” (but leaving CREATOR intact), so as to restore the icon.

I then relaunched Freeway.

Pages are still all getting dirtied the same as before I commented-out those 4 lines. And the content of my site maps seem to be getting updated. It’s almost like those 4 lines were always being ignored. Maybe this is the root bug in the Action that is triggering all pages to get dirtied all the time?

Please let me know your thoughts.

Thank you,

James Wages

H.Banken

21 Mar 2017, 7:41 am

Hello Freeway user. I use the ‘readfeed’-action and i’m happy with it. But i’m a little bit happier if there would be a simple way to add a linked ‘read more’ element (button or text link) below each <li>?

WebSiCo - the WebSite Company / http://www.websico.de

waltd

21 Mar 2017, 12:37 pm

ReadFeed allows you to do almost anything with the feed. By default, it creates a link on the headline to the story, but you can get in there with tweezers and do almost anything you like.

The key thing to understand is that it takes the content of the feed, breaks it into pieces (one per story in that feed) and then breaks each of those stories down into multiple variables. It does not prescribe what those are, but by convention, most RSS feeds include link, title and description, so it uses those as the defaults.

If you read (with a text editor, not an RSS reader) through the XML that makes up a feed, you will see that there are considerably more options available — a published date, maybe an image tag, all of which can be accessed individually. The PHP code that the Action writes is completely agnostic about this part, and it’s up to you to decide which of them you want to use, and in what order.

Once the feed has been broken into tiny pieces, it gets filtered back out through a template. This is a snippet of HTML with placeholders in it to describe where the pieces go when you put it back together. You don’t have to use all the pieces, as I will show in a moment.

The documentation on ActionsForge goes into a bit of detail about this: http://actionsforge.com/actions/readfeed (read down to the part where it starts “The template follows the Unix-standard printf format.”).

The default template looks like this: <a href="%s" rel="new_window">%s</a><br />%s. If you wanted to add a link at the end, you could do it like this:

<a href="%s" rel="new_window">%s</a><br />%s<br /><a href="%s" rel="new_window">Read more</a>

Then, in the Elements field, you would also need to account for that additional use of a variable, by changing the value from link, title, description to link, title, description, link.

See how that does for you. This is (believe it or not) a very tiny and gentle introduction to programming. To get a different output, just change the input. You can do almost anything you want with this Action, because it’s a very simple tool, and does not prescribe a single way to do the job.

Walter

On Mar 21, 2017, at 3:41 AM, H.Banken <[email protected]> wrote:

Hello Freeway user. I use the ‘readfeed’-action and i’m happy with it. But i’m a little bit happier if there would be a simple way to add a linked ‘read more’ element (button or text link) below each <li>?

Freeway user since 1997

http://www.walterdavisstudio.com

Back to Top

H.Banken

21 Mar 2017, 7:28 pm

Thank youe Walter for this great explanation.

But your solution didn’t work for me (don’t know why). I figured it out with: title, description, link.

And it worked fine.

WebSiCo - the WebSite Company / http://www.websico.de