开发者

Modifying the menu navigation to include the domain

开发者 https://www.devze.com 2023-02-18 01:26 出处:网络
Some background if you want to see why I\'m doing what I\'m doing: I have a client who wanted a new blog done with Wordpress on a separate subdomain. Their existing website is on Drupal, which I have

Some background if you want to see why I'm doing what I'm doing:

I have a client who wanted a new blog done with Wordpress on a separate subdomain. Their existing website is on Drupal, which I have had 0 experience with prior to this. They have a pretty extensive navigation on that site (multiple levels), so rather than create duplicates of nav menus that would need updated on both wordpress and drupal, I am using YQL to pull in the whole navigation onto the Wordpress website. I know this isn't great for SEO, but at this point I'm not worried about that.

The issue I have is that all of the links on the Drupal website do not include the http://domain.com so that none of the links work on the blog site, because they're going to relative pages on that subdomain that don't exist.

So in summary, what I'm trying to accomplish:

I need each href that Drupal is generating to begin with 'http://domain.com'. Currently they just start with '/pagename'. I have no clue what Drupal version the site is on nor on how to find it, sorry. The site is using Drupal's Nice Menu plugin as well. I've been digging through the files for a couple of hours now, and can't figure out where I need to make the change. Please help! Thanks


Edit: dobeerman mentioned using custom_url_rewrite_outbound to settings.php. This seems to accomplish close to what I want. I tried adding thi开发者_开发知识库s to the end of settings.php:

function custom_url_rewrite_outbound(&$path, &$options, $original_path) {
  global $user;
  $path = 'http://www.reillypainting.com/'.$path;
}

However, the end result of an href in the menu becomes this example:

href="/http%3A/%252Fwww.reillypainting.com/services/sell/rent-your-house"

So the other code generating Drupal's menu is trying to escape the :// and it's also still adding a / to the beginning of the href. Anyone know how to avoid this?


Drupal has function custom_url_rewrite_outbound you can add to settings.php

Use this code:

function custom_url_rewrite_outbound(&$path, &$options, $original_path) {
  $options['absolute'] = 1;
}
0

精彩评论

暂无评论...
验证码 换一张
取 消