Hi folks,

I recently upgraded a site from D5 to D6. I 'm db between 10+ domains. The 4 blocks tables, the 5 views tables, and the vocabulary_node_type table have all been prefixed.

The problem is that the pagination links on the bottom on my main content view all point to the wrong domain. i.e. on my one.domain.com site the pagination links point to two.domain.com.

Has anyone encountered this before?

Perhaps related, the action of the form around the default user login block always points to the same two.domain.com which is not even my primary domain.

Thanks for any insight.

Comments

agentrickard’s picture

You're not hardcoding $base_url in settings.php are you?

jmunning’s picture

No, I'm not setting $base_url in settings.php. Anywhere else you can think of that I should check?

Thanks.

agentrickard’s picture

Custom templates of any sort that fail to use l() or url() properly.

jmunning’s picture

I was able to fix this. Turns out the problem was that embedding the view in a block caused the pagination links to point to the source domain of the page. If I changed the source domain on the page, the domain of the links changed also. When viewing the view that was not in a block, the pagination links were correct.

I added this to my template.php file to force the links to point to the current domain:

/*fix pagination bug (main content pagination links always point to "main content" source domain). Source of code: http://api.drupal.org/api/function/theme_pager_link/6*/
function theme_pager_link($text, $page_new, $element, $parameters = array(), $attributes = array()) {
  $page = isset($_GET['page']) ? $_GET['page'] : '';
  if ($new_page = implode(',', pager_load_array($page_new[$element], $element, explode(',', $page)))) {
    $parameters['page'] = $new_page;
  }
  $query = array();
  if (count($parameters)) {
    $query[] = drupal_query_string_encode($parameters, array());
  }
  $querystring = pager_get_querystring();
  if ($querystring != '') {
    $query[] = $querystring;
  }
  // Set each pager link title
  if (!isset($attributes['title'])) {
    static $titles = NULL;
    if (!isset($titles)) {
      $titles = array(
        t('« first') => t('Go to first page'),
        t('‹ previous') => t('Go to previous page'),
        t('next ›') => t('Go to next page'),
        t('last »') => t('Go to last page'),
      );
    }
    if (isset($titles[$text])) {
      $attributes['title'] = $titles[$text];
    }
    else if (is_numeric($text)) {
      $attributes['title'] = t('Go to page @number', array('@number' => $text));
    }
  }
  //forcing links to point to current domain
  $myq = $_GET['q'];
  $mydomain = domain_get_domain();
  $mypath = $mydomain['path'] . "?q=" . $myq;
  return l($text, $mypath, array('attributes' => $attributes, 'query' => count($query) ? implode('&', $query) : NULL));
}
agentrickard’s picture

How did you embed the view in a block? That is, what method did you use?

jmunning’s picture

using this code:

$viewName = 'FL_popular';
print views_embed_view($viewName);
agentrickard’s picture

Odd. And no custom theming or links on the View output?

agentrickard’s picture

Status: Active » Postponed (maintainer needs more info)
agentrickard’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)