0

I did some research on the problem in the title but haven't found any good solutions yet.

I'm using a Global: Custom text view field in a view and I need inline CSS to work in there.

I know that it gets stripped because security reasons, and I have to use inline CSS for my problem. So "use CSS classes" is not a solution, I'm well aware that in most cases that would be the best but it's not ok in this case.

Writing a node.tpl.php for the content instead of using a view in Fields mode is also not possible, becaue I have to use view result counter token on the same div where my inline css should go (with another token inside the inline css).

Thank you!

1 Answer 1

1

It's still not wise but use a custom PhP field : Views PhP (it's "Views custom field if you're on D6).

9
  • Already tried that with the output code <?php print $row->nothing ;?> (where $row->nothing is my custom text field with all the markup and tokens I need) but it's empty. Any idea why that could be? Commented Dec 28, 2012 at 11:33
  • 1
    yeah it's always empty, use $data instead of $row. If you need to know what's inside $data, use a dpm($data); in your php field. Commented Dec 28, 2012 at 11:34
  • I've found no sign of my custom text field in $data, but I see all the other view fields. Commented Dec 28, 2012 at 11:37
  • 1
    Did you add your field ? You have to add and hide it before the php field. Commented Dec 28, 2012 at 11:41
  • 1
    Oh I get it, your "custom field" is only in the view, not on the content type. Ok, so everything you have in your custom field, you have to set it in the php field, not re-use it in the php field. Only use this field. Commented Dec 28, 2012 at 11:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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