How to get link path in custom block for a view? I created a view (unformatted) associated with a content type with two simple fields for a block.
The view is called "phrases" have generated two .tpl:

a) views-view-unformatted--phrases-block.tpl.php (to style row).

b) views-view-fields--phrases-block.tpl.php (to style the fields).

How to generate the link to the content, because by the variables I do not receive the direction I need.

I have available only the variable "$content", but this is formatted with something like:

&lt;span class = "field-xx-xx"&gt; 
     &lt;a href="path/to/correct/content"&gt;Path&lt;/a&gt;
&lt;/span&gt;


I need to assign a class to the "a tag" , but as I receive all formatting can not.

Example i need:

&lt;div class="my-class"&gt; 
    &lt;a class="my-link-class" href="path/to/correct/content"&gt;Path&lt;/a&gt;
&lt;/div&gt;


As I can generate the correct path to the content?
In your view, in FIELDS add Content: Path

Then in views-view-fields--phrases-block.tpl.php add:

&lt;div class="my-class"&gt; 
    &lt;a class="my-link-class" href="&lt;?php print $fields["field_path"]-&gt;raw; ?&gt;"&gt;Path&lt;/a&gt;
&lt;/div&gt;


if the above doesn't work try:

&lt;a class="my-link-class" href="&lt;?php print $fields["field_path"]-&gt;content; ?&gt;"&gt;Path&lt;/a&gt;


If the 1st and 2nd doesn't work, to make the 2nd one work, get rid off all your html markup, because it's probably printing as href="&lt;span&gt;/yourpath&lt;/span&gt;"

Click on your Path field and unchecked add default classes.



In field settings, uncheck add field wrappers.