get url by passing node

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

get url by passing node

Leah Wang
Hello, everyone,

Does MM has a function to pass a node id and return the page(s) url?

Thanks,

Leah

---

You are currently subscribed to monster_menus as: [hidden email].

To unsubscribe click here: http://lists.middlebury.edu/u?id=685503.6b071f880fe6a965a128164e6d09ea81&n=T&l=monster_menus&o=718199

(It may be necessary to cut and paste the above URL if the line is broken)

or send a blank email to [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: get url by passing node

McBride, Ian S.
Yup! Sort of.

$nid = 12345;
$urls = array();
$mmtids = mm_content_get_by_nid($nid);

foreach ($mmtids as $mmtid) {
  $path = ‘mm/‘ . $mmtid;
  $urls[] = drupal_alter('url_outbound', $path, $options, $path);
}


Ian McBride
[hidden email]
skype: [hidden email]
Web Technologies & Services
Information Technology Services
Middlebury College

On Jul 13, 2015, at 2:05 PM, Leah Wang <[hidden email]> wrote:

Hello, everyone,

Does MM has a function to pass a node id and return the page(s) url?

Thanks,

Leah

---

You are currently subscribed to monster_menus as: [hidden email].

To unsubscribe click here: http://lists.middlebury.edu/u?id=685439.7e7cbccf9bb225cf8471bffe1cb67503&n=T&l=monster_menus&o=718199

(It may be necessary to cut and paste the above URL if the line is broken)

or send a blank email to [hidden email]


---

You are currently subscribed to monster_menus as: [hidden email].

To unsubscribe click here: http://lists.middlebury.edu/u?id=685503.6b071f880fe6a965a128164e6d09ea81&n=T&l=monster_menus&o=718201

(It may be necessary to cut and paste the above URL if the line is broken)

or send a blank email to [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: get url by passing node

Leah Wang
In reply to this post by Leah Wang
Thanks a lot Ian! 

Haven't seen you for a while. How's going?

Enjoy you summer,

Leah

On Mon, Jul 13, 2015 at 2:18 PM, McBride, Ian S. <[hidden email]> wrote:
Yup! Sort of.

$nid = 12345;
$urls = array();
$mmtids = mm_content_get_by_nid($nid);

foreach ($mmtids as $mmtid) {
  $path = ‘mm/‘ . $mmtid;
  $urls[] = drupal_alter('url_outbound', $path, $options, $path);
}


Ian McBride
[hidden email]
skype: [hidden email]
Web Technologies & Services
Information Technology Services
Middlebury College

On Jul 13, 2015, at 2:05 PM, Leah Wang <[hidden email]> wrote:

Hello, everyone,

Does MM has a function to pass a node id and return the page(s) url?

Thanks,

Leah

---

You are currently subscribed to monster_menus as: [hidden email].

To unsubscribe click here: http://lists.middlebury.edu/u?id=685439.7e7cbccf9bb225cf8471bffe1cb67503&n=T&l=monster_menus&o=718199

(It may be necessary to cut and paste the above URL if the line is broken)

or send a blank email to [hidden email]


---

You are currently subscribed to monster_menus as: [hidden email].

To unsubscribe click here: http://lists.middlebury.edu/u?id=778321.6456e599a2dca2f16c45e2dbe7856937&n=T&l=monster_menus&o=718201

(It may be necessary to cut and paste the above URL if the line is broken)

or send a blank email to [hidden email]


---

You are currently subscribed to monster_menus as: [hidden email].

To unsubscribe click here: http://lists.middlebury.edu/u?id=685503.6b071f880fe6a965a128164e6d09ea81&n=T&l=monster_menus&o=718202

(It may be necessary to cut and paste the above URL if the line is broken)

or send a blank email to [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: get url by passing node

Dan Wilga-2
In reply to this post by Leah Wang
You can use Ian's suggestion, but if you're going to be using the url() or l() function, it's actually easier to let MM handle it for you. Just pass either function "node/1234" and it will get prefixed with the correct MM page's path, automatically.

On 7/13/15 2:05 PM, Leah Wang wrote:
Hello, everyone,

Does MM has a function to pass a node id and return the page(s) url?

Thanks,

Leah

---

You are currently subscribed to monster_menus as: [hidden email].

To unsubscribe click here: http://lists.middlebury.edu/u?id=685500.19fa7de7038497527f6a88cf1629251d&n=T&l=monster_menus&o=718199

(It may be necessary to cut and paste the above URL if the line is broken)

or send a blank email to [hidden email]


---

You are currently subscribed to monster_menus as: [hidden email].

To unsubscribe click here: http://lists.middlebury.edu/u?id=685503.6b071f880fe6a965a128164e6d09ea81&n=T&l=monster_menus&o=718203

(It may be necessary to cut and paste the above URL if the line is broken)

or send a blank email to [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: get url by passing node

Leah Wang
In reply to this post by Leah Wang
Dan,

What do you mean using the  url() or l() function? Could you give me an example?

Thanks a lot,

Leah

On Mon, Jul 13, 2015 at 2:30 PM, Dan Wilga <[hidden email]> wrote:
You can use Ian's suggestion, but if you're going to be using the url() or l() function, it's actually easier to let MM handle it for you. Just pass either function "node/1234" and it will get prefixed with the correct MM page's path, automatically.

On 7/13/15 2:05 PM, Leah Wang wrote:
Hello, everyone,

Does MM has a function to pass a node id and return the page(s) url?

Thanks,

Leah

---

You are currently subscribed to monster_menus as: [hidden email][hidden email].

To unsubscribe click here: http://lists.middlebury.edu/u?id=685500.19fa7de7038497527f6a88cf1629251d&n=T&l=monster_menus&o=718199

(It may be necessary to cut and paste the above URL if the line is broken)

or send a blank email to [hidden email]


---

You are currently subscribed to monster_menus as: [hidden email].

To unsubscribe click here: http://lists.middlebury.edu/u?id=778321.6456e599a2dca2f16c45e2dbe7856937&n=T&l=monster_menus&o=718203

(It may be necessary to cut and paste the above URL if the line is broken)

or send a blank email to [hidden email]


---

You are currently subscribed to monster_menus as: [hidden email].

To unsubscribe click here: http://lists.middlebury.edu/u?id=685503.6b071f880fe6a965a128164e6d09ea81&n=T&l=monster_menus&o=718204

(It may be necessary to cut and paste the above URL if the line is broken)

or send a blank email to [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: get url by passing node

Dan Wilga-2
In reply to this post by Leah Wang
$nid = 1234;
$link = l('my link', "node/$nid");  // Generate a whole HTML tag
// or
$url = url("node/$nid");  // Just the URL

On 7/13/15 2:34 PM, Leah Wang wrote:
Dan,

What do you mean using the  url() or l() function? Could you give me an example?

Thanks a lot,

Leah

On Mon, Jul 13, 2015 at 2:30 PM, Dan Wilga <[hidden email]> wrote:
You can use Ian's suggestion, but if you're going to be using the url() or l() function, it's actually easier to let MM handle it for you. Just pass either function "node/1234" and it will get prefixed with the correct MM page's path, automatically.

On 7/13/15 2:05 PM, Leah Wang wrote:
Hello, everyone,

Does MM has a function to pass a node id and return the page(s) url?

Thanks,

Leah

---

You are currently subscribed to monster_menus as: [hidden email].

To unsubscribe click here: http://lists.middlebury.edu/u?id=685500.19fa7de7038497527f6a88cf1629251d&n=T&l=monster_menus&o=718199

(It may be necessary to cut and paste the above URL if the line is broken)

or send a blank email to [hidden email]


---

You are currently subscribed to monster_menus as: [hidden email].

To unsubscribe click here: http://lists.middlebury.edu/u?id=778321.6456e599a2dca2f16c45e2dbe7856937&n=T&l=monster_menus&o=718203

(It may be necessary to cut and paste the above URL if the line is broken)

or send a blank email to [hidden email]


---

You are currently subscribed to monster_menus as: [hidden email].

To unsubscribe click here: http://lists.middlebury.edu/u?id=685500.19fa7de7038497527f6a88cf1629251d&n=T&l=monster_menus&o=718204

(It may be necessary to cut and paste the above URL if the line is broken)

or send a blank email to [hidden email]


---

You are currently subscribed to monster_menus as: [hidden email].

To unsubscribe click here: http://lists.middlebury.edu/u?id=685503.6b071f880fe6a965a128164e6d09ea81&n=T&l=monster_menus&o=718205

(It may be necessary to cut and paste the above URL if the line is broken)

or send a blank email to [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: get url by passing node

McBride, Ian S.
In reply to this post by Leah Wang
Dan’s method is undoubtedly better than mine, provided the node is only on one page of your site or you don’t mind the link going to the first value of $node->mm_catlist.

And, by the way, that’s even easier if you’ve already loaded the node object using node_load() or are in its template or preprocess function:

$node = node_load(1234);
$mmtids = $node->mm_catlist;

Ian McBride
[hidden email]
skype: [hidden email]
Web Technologies & Services
Information Technology Services
Middlebury College

On Jul 13, 2015, at 3:24 PM, Dan Wilga <[hidden email]> wrote:

$nid = 1234;
$link = l('my link', "node/$nid");  // Generate a whole HTML tag
// or
$url = url("node/$nid");  // Just the URL

On 7/13/15 2:34 PM, Leah Wang wrote:
Dan,

What do you mean using the  url() or l() function? Could you give me an example?

Thanks a lot,

Leah

On Mon, Jul 13, 2015 at 2:30 PM, Dan Wilga <[hidden email]> wrote:
You can use Ian's suggestion, but if you're going to be using the url() or l() function, it's actually easier to let MM handle it for you. Just pass either function "node/1234" and it will get prefixed with the correct MM page's path, automatically.

On 7/13/15 2:05 PM, Leah Wang wrote:
Hello, everyone,

Does MM has a function to pass a node id and return the page(s) url?

Thanks,

Leah

---

You are currently subscribed to monster_menus as: [hidden email][hidden email].

To unsubscribe click here: http://lists.middlebury.edu/u?id=685500.19fa7de7038497527f6a88cf1629251d&n=T&l=monster_menus&o=718199

(It may be necessary to cut and paste the above URL if the line is broken)

or send a blank email to [hidden email]


---

You are currently subscribed to monster_menus as: [hidden email][hidden email].

To unsubscribe click here: http://lists.middlebury.edu/u?id=778321.6456e599a2dca2f16c45e2dbe7856937&n=T&l=monster_menus&o=718203

(It may be necessary to cut and paste the above URL if the line is broken)

or send a blank email to [hidden email]


---

You are currently subscribed to monster_menus as: [hidden email][hidden email].

To unsubscribe click here: http://lists.middlebury.edu/u?id=685500.19fa7de7038497527f6a88cf1629251d&n=T&l=monster_menus&o=718204

(It may be necessary to cut and paste the above URL if the line is broken)

or send a blank email to [hidden email]


---

You are currently subscribed to monster_menus as: [hidden email].

To unsubscribe click here: http://lists.middlebury.edu/u?id=685439.7e7cbccf9bb225cf8471bffe1cb67503&n=T&l=monster_menus&o=718205

(It may be necessary to cut and paste the above URL if the line is broken)

or send a blank email to [hidden email]


---

You are currently subscribed to monster_menus as: [hidden email].

To unsubscribe click here: http://lists.middlebury.edu/u?id=685503.6b071f880fe6a965a128164e6d09ea81&n=T&l=monster_menus&o=718207

(It may be necessary to cut and paste the above URL if the line is broken)

or send a blank email to [hidden email]

Loading...