0

I made change in setting.php for base url

$base_url = 'http://www.example.com/drupal

Pattern for this content type paths are

[node:title]

pathauto works ok, in the database path is exactly as pattern.

Problem starts when I want to print Content:path in view I am getting

/drupal/[node:title]

I have a problem with path field because I want to rewrite result for logo field using

<a href="/company/[nid][path]">[field_company_logo]</a>

And link is http://www.example.com/company/[nid]/drupal/[node:title] instead of http://www.example.com/drupal/company/[nid]/[node:title]

1

Changing the $base_url variable by no means makes drupal look through every bit of text in the system checking for href's. So, if you put in

 <a href="/company/.....

it is going to use it exactly as is because it has no idea to do anything else. It will, however, be more than glad to put it in front of a path if you use some of its built in functions, for example:

 <?php print l('Foo Bar Baz', 'company/foo/bar/baz'); ?>

will create a link to /company/foo/bar/baz if $base_url is not set, or if it is set to drupal, to /drupal/company/foo/bar/baz.

So, to your problem. Have you tried Views' Output as a link instead of creating the <a> ... </a> code yourself in Rewrite the output of this field? That should put that $base_url in there automagically if in the Link path: you enter company/[nid][path] (or whatever tokens you need as you use several different ones in your question).

  • The things are better when I choose 'Output as a link'. The '$base_url' is now ok, but path has again part of '$base_url' as prefix and looks /drupal/[path] And the problem still exist, if I enter 'Link path: company/[nid][path]' now I am getting www.example.com/drupal/company/314/drupal/some-title – miske Aug 21 '12 at 7:52
  • I'd then look into your path alias settings to see if you have inadvertently put $base_url in there. – Jimajamma Aug 21 '12 at 14:37
  • I take a look at url aliases and as pattern I wrote '[node:title]' nothing more – miske Aug 22 '12 at 8:24
1

I resolved this using Global:php field and in output code I wrote drupal function to find alias

<?php echo drupal_lookup_path('alias',"node/".$row->nid); ?>

Then as Jimajamma said in views I choose Output as a link and in Link path: i wrote company/[nid]/[php] and everything works.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.