With or without the 'send aliases' checkbox selected i can't seem to get the drupal system paths sent as a deep link (i understand that it should be unchecked).

I'm using the latest version of SWFAddress (2.1) and when using the SWFAddress.getValue() function i'm always getting the aliased path.

This only happens for paths that are aliased, i've just enabled pathauto and only nodes created since them are doing that. I've also tried just using the path module and that has the same results - nodes aliased with the path module get their deep link sent as the aliased verson.

How do i get the drupal system paths sent? Or get the aliased paths sent but with the node id as something separate (thats the important bit)

Comments

smerrill’s picture

Priority: Normal » Minor

Hey amcc,

The "send aliased paths" setting merely sends a path through drupal_get_path_alias().

The procedure to get the unaliased path would be to call drupal_lookup_path('source', $path).

I would recommend making a service that could load a node by path if you need it - I'm not sure that a lot of people would be interested in sending unaliased paths.

bmcmurray’s picture

Component: User interface » Miscellaneous
Category: bug » support

Hi ammc,

You mentioned in the last line of your issue that what you are really looking for is the node ID. You can add this to the list of fields that you are asking for in your Services call. Add 'nid' to your array of fields.

amcc’s picture

Version: 5.x-1.2 » 6.x-1.x-dev
Component: Miscellaneous » User interface
Category: support » bug

Cheers for the help - system paths would be preferable as i'm trying to build a more abstract set of classes in Flash that enable me to get nodes and views etc but also have nice verbose URLS. So if Flash gets a path like content/my-shiny-new-node then its hard to know what node to get, but obviously node/5 is easy as i just plug 5 into the node service.

Ideally i suppose it would be handy to have both paths - as the system path is useful in getting nodes easily with services, but the aliased path is necessary in order for Flash to set the path (for instance if i get a view and click on a node in Flash i want to set the path to the aliased path).

If you want a completely flexible system I can't see any way to have verbose paths for nodes AND allow Flash to call that node via services (unless you code in every URL you make into the Actionscript). I'm trying to make a fairly abstract, flexible framework for Flash to handle Drupal node data and maybe this is a service thing not an swfAddress thing, but I don't fully understand how swfAddress send the data to Flash. It seems to me that clicking on an html link or Flash link needs to set the browser URL to the aliased path - but send Flash, or send Drupal the system path. In drupal you'd use the l() function and always use system paths as they don't change, but if you code your Flash with aliased paths and the later change you're in trouble.

Hope you can help with some of that - or point me in the right direction, sorry if its a ramble (oh and i'm using the 6 - dev version right now too)

amcc’s picture

@bmcmurray I should have been clearer (and i may have misunderstood how this works) but if Flash is using swfAddress to respond to changes in the URL then the following process happens:

If you're using aliases and someone clicks a link from a Google search for example like - http://www.yoursite.com/some-aliased-node

Flash will receive the address using getValue as some-aliased-node - that currently is no use when you're trying to get the node using services (or is it, can services use aliased addresses). Hope you can help clear this up as its bugging me, thanks

smerrill’s picture

@amcc

You should be able to write a path service that runs a drupal_lookup_path('source', $path) call, and if that comes back as node/x, noad_load(x).

(You could probably also write a modified Services node_load() service that takes a single arg, and if $arg is non-numeric, tries to run it though drupal_lookup_path('source', $arg); first.)

That's what I'd do, in any case.

amcc’s picture

That sounds like a plan - I'll have a dig around in Services, it seems like a much better way of going about things. If you're building a full scale Flash site with Drupal it seems essential if you want nice URLs. I just had the suspicion that I was doing something wrong, as unless everyone ends their URLs with the NID then I don't see how other people are doing this. Unless they're only passing a limited set of paths to Flash and hard coding them all in. I'm building the whole site with Flash and as such will have thousands of nodes to deal with so this isn't an option.

smerrill’s picture

Category: bug » support
Status: Active » Fixed

@amcc

Here's some pseudocode - I haven't tested it at all, so I don't guarantee that this works.

(Anything else should probably go in the Services issue queue, so I'm closing this one.)

function mymodule_node_load_path($path, $fields = array()) { 
  $return_path = drupal_get_normal_path($path);  
  
  $exploded_str = explode('/', $return_path);
  if ($exploded_str[0] == "node") {
    // we have a node, load the nid
    $nid = $exploded_str[1];
    $return = services_node_load(node_load(array('nid' => $nid)), $fields);
  }
  else {
    $return = FALSE;
  }
  
  return $return;
}
amcc’s picture

@smerrill cheers - i'll jump over to services now....

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.